← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~cedric-lebrouster/ocb-addons/ocb-6.1-bug-740361-aml-novalidate into lp:ocb-addons/6.1

 

Cedric Le Brouster(OpenFire) has proposed merging lp:~cedric-lebrouster/ocb-addons/ocb-6.1-bug-740361-aml-novalidate into lp:ocb-addons/6.1.

Requested reviews:
  OpenERP Community Backports (ocb)
Related bugs:
  Bug #740361 in Odoo Addons: "[6.1][account] slow large invoice validation because validate is called for every line"
  https://bugs.launchpad.net/openobject-addons/+bug/740361

For more details, see:
https://code.launchpad.net/~cedric-lebrouster/ocb-addons/ocb-6.1-bug-740361-aml-novalidate/+merge/251279

Fix for the bug 740361.
Checks for 'novalidate' definition in account.move.line context in create() and write() method, to prevent useless calls to account.move validate() method for each line (huge time loss)
-- 
Your team OpenERP Community Backports is requested to review the proposed merge of lp:~cedric-lebrouster/ocb-addons/ocb-6.1-bug-740361-aml-novalidate into lp:ocb-addons/6.1.
=== modified file 'account/account_move_line.py'
--- account/account_move_line.py	2014-04-23 06:12:15 +0000
+++ account/account_move_line.py	2015-02-27 15:39:36 +0000
@@ -1197,7 +1197,7 @@
             if journal.centralisation:
                 self._check_moves(cr, uid, context=ctx)
         result = super(account_move_line, self).write(cr, uid, ids, vals, context)
-        if check:
+        if check and not context.get('novalidate'):
             done = []
             for line in self.browse(cr, uid, ids):
                 if line.move_id.id not in done:
@@ -1394,7 +1394,7 @@
                     self.create(cr, uid, data, context)
             del vals['account_tax_id']
 
-        if check and ((not context.get('no_store_function')) or journal.entry_posted):
+        if check and ((not context.get('no_store_function')) or journal.entry_posted) and not context.get('novalidate'):
             tmp = move_obj.validate(cr, uid, [vals['move_id']], context)
             if journal.entry_posted and tmp:
                 move_obj.button_validate(cr,uid, [vals['move_id']], context)


Follow ups