From 3f9fddf369540e7fe011ce5cb8c00ad9ce6eb3f2 Mon Sep 17 00:00:00 2001 From: Laetitia Gangloff Date: Wed, 23 Dec 2015 09:07:18 +0100 Subject: [PATCH] sale_payment_method_transaction_id : migrate to 8.0 --- oca_dependencies.txt | 1 + sale_payment_method_transaction_id/README.rst | 69 +++++++++++++++++++ .../__init__.py | 21 +----- .../__openerp__.py | 19 +---- .../models/__init__.py | 3 + .../{ => models}/sale.py | 21 +++--- 6 files changed, 88 insertions(+), 46 deletions(-) create mode 100644 sale_payment_method_transaction_id/README.rst create mode 100644 sale_payment_method_transaction_id/models/__init__.py rename sale_payment_method_transaction_id/{ => models}/sale.py (63%) diff --git a/oca_dependencies.txt b/oca_dependencies.txt index 4cbc87802da..7c432c25546 100644 --- a/oca_dependencies.txt +++ b/oca_dependencies.txt @@ -1,4 +1,5 @@ stock-logistics-workflow stock-logistics-transport account-closing +bank-statement-reconcile server-tools diff --git a/sale_payment_method_transaction_id/README.rst b/sale_payment_method_transaction_id/README.rst new file mode 100644 index 00000000000..6feaeb3d94a --- /dev/null +++ b/sale_payment_method_transaction_id/README.rst @@ -0,0 +1,69 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +================================================== +Sale Payment Method - Transaction ID Compatibility +================================================== + +Link module between the sale payment method module +and the module adding a transaction ID field (`base_transaction_id` in the +`https://github.com/OCA/bank-statement-reconcile/tree/8.0` branch). + +When a payment is created from a sales order with a transaction ID, the +move lines are created with the transaction id. + +Installation +============ + +To install this module, you need to: + +* Click on install button + +Usage +===== + +To use this module, you need to: + +* Go to ... + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/167/8.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed `feedback +`_. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Guewen Baconnier + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. \ No newline at end of file diff --git a/sale_payment_method_transaction_id/__init__.py b/sale_payment_method_transaction_id/__init__.py index e98c6a99603..cde864bae21 100644 --- a/sale_payment_method_transaction_id/__init__.py +++ b/sale_payment_method_transaction_id/__init__.py @@ -1,22 +1,3 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Author: Guewen Baconnier -# Copyright 2014 Camptocamp SA -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## -from . import sale +from . import models diff --git a/sale_payment_method_transaction_id/__openerp__.py b/sale_payment_method_transaction_id/__openerp__.py index d6547bc3bf3..ff9c03ad86e 100644 --- a/sale_payment_method_transaction_id/__openerp__.py +++ b/sale_payment_method_transaction_id/__openerp__.py @@ -20,31 +20,18 @@ ############################################################################## {'name': 'Sale Payment Method - Transaction ID Compatibility', - 'version': '1.0', + 'version': '8.0.1.0.0', 'author': "Camptocamp,Odoo Community Association (OCA)", - 'maintainer': 'Camptocamp', 'license': 'AGPL-3', 'category': 'Hidden', 'depends': ['sale_payment_method', # base_transaction_id is in - # https://github.com/OCA/bank-statement-reconcile/tree/7.0 + # https://github.com/OCA/bank-statement-reconcile/tree/8.0 'base_transaction_id', ], - 'description': """ -Sale Payment Method - Transaction ID Compatibility -================================================== - -Link module between the sale payment method module -and the module adding a transaction ID field (`base_transaction_id` in the -`lp:banking-addons/bank-statement-reconcile-7.0` branch). - -When a payment is created from a sales order with a transaction ID, the -move lines are created with the transaction id. - - """, 'website': 'http://www.camptocamp.com', 'data': [], 'tests': [], - 'installable': False, + 'installable': True, 'auto_install': True, } diff --git a/sale_payment_method_transaction_id/models/__init__.py b/sale_payment_method_transaction_id/models/__init__.py new file mode 100644 index 00000000000..78a96049607 --- /dev/null +++ b/sale_payment_method_transaction_id/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import sale diff --git a/sale_payment_method_transaction_id/sale.py b/sale_payment_method_transaction_id/models/sale.py similarity index 63% rename from sale_payment_method_transaction_id/sale.py rename to sale_payment_method_transaction_id/models/sale.py index 3a5048387b2..30d392f365e 100644 --- a/sale_payment_method_transaction_id/sale.py +++ b/sale_payment_method_transaction_id/models/sale.py @@ -19,18 +19,19 @@ # ############################################################################## -from openerp.osv import orm +from openerp import api, models -class sale_order(orm.Model): +class SaleOrder(models.Model): _inherit = 'sale.order' - def _prepare_payment_move_line(self, cr, uid, move_name, sale, journal, - period, amount, date, context=None): - debit_line, credit_line = super(sale_order, self).\ - _prepare_payment_move_line(cr, uid, move_name, sale, journal, - period, amount, date, context=context) - if sale.transaction_id: - debit_line['transaction_ref'] = sale.transaction_id - credit_line['transaction_ref'] = sale.transaction_id + @api.multi + def _prepare_payment_move_lines(self, move_name, journal, + period, amount, date): + debit_line, credit_line = super(SaleOrder, self).\ + _prepare_payment_move_lines(move_name, journal, + period, amount, date) + if self.transaction_id: + debit_line['transaction_ref'] = self.transaction_id + credit_line['transaction_ref'] = self.transaction_id return debit_line, credit_line