← Back to team overview

savoirfairelinux-openerp team mailing list archive

[Merge] lp:~camptocamp/e-commerce-addons/7.0-sale_payment_method-base_transaction_id into lp:e-commerce-addons

 

Guewen Baconnier @ Camptocamp has proposed merging lp:~camptocamp/e-commerce-addons/7.0-sale_payment_method-base_transaction_id into lp:e-commerce-addons.

Commit message:
[ADD] sale_payment_method_transaction_id: link module between sale_payment_method and base_transaction_id

Requested reviews:
  Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c): code review, no tests

For more details, see:
https://code.launchpad.net/~camptocamp/e-commerce-addons/7.0-sale_payment_method-base_transaction_id/+merge/203694

In my pursuit to streamline the usage of transaction ids (from lp:banking-addons/bank-statement-reconcile-7.0) throughout all the chain from a sales order to the reconciliation of invoices, payment and bank statements (see also my other MP [0], I propose this new link module to integrate the sale_payment_module with base_transaction_id.

This module is automatically installed when both modules are installed and it does a simple thing: when a sales order has a transaction id, it is copied to the payment move lines. This will later allow to reconcile the entries with the lines generated by the bank statement.

[0] https://code.launchpad.net/~camptocamp/banking-addons/7.0-bank-statement-reconcile-transaction_id-imp/+merge/202806
https://code.launchpad.net/~camptocamp/banking-addons/7.0-bank-statement-reconcile-account_invoice_reference/+merge/202689
https://code.launchpad.net/~camptocamp/openerp-swiss-localization/7.0-wip-invoice-ref-transaction-id/+merge/203006


-- 
https://code.launchpad.net/~camptocamp/e-commerce-addons/7.0-sale_payment_method-base_transaction_id/+merge/203694
Your team extra-addons-commiter is subscribed to branch lp:e-commerce-addons.
=== added directory 'sale_payment_method_transaction_id'
=== added file 'sale_payment_method_transaction_id/__init__.py'
--- sale_payment_method_transaction_id/__init__.py	1970-01-01 00:00:00 +0000
+++ sale_payment_method_transaction_id/__init__.py	2014-01-29 10:10:32 +0000
@@ -0,0 +1,22 @@
+# -*- 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from . import sale

=== added file 'sale_payment_method_transaction_id/__openerp__.py'
--- sale_payment_method_transaction_id/__openerp__.py	1970-01-01 00:00:00 +0000
+++ sale_payment_method_transaction_id/__openerp__.py	2014-01-29 10:10:32 +0000
@@ -0,0 +1,48 @@
+# -*- 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+{'name' : 'Sale Payment Method - Transaction ID Compatibility',
+ 'version' : '1.0',
+ 'author' : 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'license': 'AGPL-3',
+ 'category': 'Hidden',
+ 'depends' : ['sale_payment_method',
+              'base_transaction_id',  # in lp:banking-addons/bank-statement-reconcile-7.0 
+              ],
+ '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': True,
+ 'auto_install': True,
+}

=== added file 'sale_payment_method_transaction_id/sale.py'
--- sale_payment_method_transaction_id/sale.py	1970-01-01 00:00:00 +0000
+++ sale_payment_method_transaction_id/sale.py	2014-01-29 10:10:32 +0000
@@ -0,0 +1,36 @@
+# -*- 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp.osv import orm
+
+
+class sale_order(orm.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
+        return debit_line, credit_line


Follow ups