← Back to team overview

banking-addons-team team mailing list archive

[Merge] lp:~camptocamp/banking-addons/invoice_force_ref into lp:banking-addons/bank-statement-reconcile-70

 

Vincent Renaville@camptocamp has proposed merging lp:~camptocamp/banking-addons/invoice_force_ref into lp:banking-addons/bank-statement-reconcile-70.

Requested reviews:
  Banking Addons Core Editors (banking-addons-team)
  Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c)

For more details, see:
https://code.launchpad.net/~camptocamp/banking-addons/invoice_force_ref/+merge/170542

Set name and ref in move and move line to be compliant with advanced reconcile module
-- 
https://code.launchpad.net/~camptocamp/banking-addons/invoice_force_ref/+merge/170542
Your team Banking Addons Core Editors is requested to review the proposed merge of lp:~camptocamp/banking-addons/invoice_force_ref into lp:banking-addons/bank-statement-reconcile-70.
=== modified file 'account_advanced_reconcile/__openerp__.py'
--- account_advanced_reconcile/__openerp__.py	2013-01-04 08:39:10 +0000
+++ account_advanced_reconcile/__openerp__.py	2013-06-20 07:48:41 +0000
@@ -26,6 +26,7 @@
  'category': 'Finance',
  'complexity': 'normal',
  'depends': ['account_easy_reconcile',
+	     'account_invoice_force_ref',
              ],
  'description': """
 Advanced reconciliation methods for the module account_easy_reconcile.

=== added directory 'account_invoice_force_ref'
=== added file 'account_invoice_force_ref/__init__.py'
--- account_invoice_force_ref/__init__.py	1970-01-01 00:00:00 +0000
+++ account_invoice_force_ref/__init__.py	2013-06-20 07:48:41 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author Vincent Renaville. Copyright 2013 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 account_invoice
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== added file 'account_invoice_force_ref/__openerp__.py'
--- account_invoice_force_ref/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_invoice_force_ref/__openerp__.py	2013-06-20 07:48:41 +0000
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author Vincent Renaville. Copyright 2013 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" : "Record move",
+    "version" : "1.0",
+    "depends" : ["account_advanced_reconcile",
+                ],
+    "author" : "Camptocamp",
+    "description": """
+    Write invoice number into reference and name in move/move line for advanced reconcile
+    """,
+    'website': 'http://www.camptocamp.com',
+    'data' : [],
+    'installable': True,
+    'active': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'account_invoice_force_ref/account_invoice.py'
--- account_invoice_force_ref/account_invoice.py	1970-01-01 00:00:00 +0000
+++ account_invoice_force_ref/account_invoice.py	2013-06-20 07:48:41 +0000
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author Vincent Renaville. Copyright 2013 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.tools.translate import _
+from openerp.osv import osv, orm
+
+
+class account_invoice(orm.TransientModel):
+    _inherit = "account.invoice"
+
+    def action_number(self, cr, uid, ids, context=None):
+        result = super(account_invoice,self).action_number(cr, uid, ids, context=context)
+        if result:
+            account_move_line_obj = self.pool.get('account.move.line')
+            account_move_obj = self.pool.get('account.move')
+            if context is None:
+                context = {}
+            ctxt = context.copy()
+            ctxt['from_parent_object'] = True
+            ## The invoices is correctly reference
+            for inv in self.browse(cr,uid,ids):
+                name = False
+                ref = False
+                if inv.type in ('in_invoice', 'in_refund'):
+                    if inv.partner_bank_id.state != 'bvr':
+                        ref = self._convert_ref(cr, uid, inv.supplier_invoice_number)
+                        name = inv.reference or '/'
+                    else:
+                        ref = inv.reference
+                        name = self._convert_ref(cr, uid, inv.supplier_invoice_number) 
+                else:
+                    if inv.partner_bank_id.state != 'bvr':
+                        name = inv.name or '/'
+                        ref = self._convert_ref(cr, uid, inv.number) 
+                    else:
+                        ref = inv.reference
+                        name = self._convert_ref(cr, uid, inv.number) 
+                ## We will write concerned move_line
+                move_line_ids = account_move_line_obj.search(cr,uid,[('move_id','=',inv.move_id.id),('account_id','=',inv.account_id.id)])
+                account_move_line_obj.write(cr,uid,move_line_ids,{'name':name,'ref':ref},context=ctxt)
+                ## We will now wrtie the move information
+                account_move_obj.write(cr,uid,[inv.move_id.id],{'ref':ref},context=ctxt)
+            ##v Then we will wrtie name in move related move_line
+            
+        return result


Follow ups