Merge lp:~cedric-lebrouster/openobject-addons/6.1-bug-740361-aml-novalidate into lp:openobject-addons/6.1

Proposed by Cedric Le Brouster(OpenFire)
Status: Needs review
Proposed branch: lp:~cedric-lebrouster/openobject-addons/6.1-bug-740361-aml-novalidate
Merge into: lp:openobject-addons/6.1
Diff against target: 21 lines (+2/-2)
1 file modified
account/account_move_line.py (+2/-2)
To merge this branch: bzr merge lp:~cedric-lebrouster/openobject-addons/6.1-bug-740361-aml-novalidate
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+251278@code.launchpad.net

Description of the change

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)

To post a comment you must log in.

Unmerged revisions

7372. By Cedric Le Brouster(OpenFire)

[FIX] Prevents unwanted calls to account.move validate() method, which makes moves create/write very slow when they have many lines.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account_move_line.py'
2--- account/account_move_line.py 2014-01-10 15:40:23 +0000
3+++ account/account_move_line.py 2015-02-27 15:32:38 +0000
4@@ -1193,7 +1193,7 @@
5 if journal.centralisation:
6 self._check_moves(cr, uid, context=ctx)
7 result = super(account_move_line, self).write(cr, uid, ids, vals, context)
8- if check:
9+ if check and not context.get('novalidate'):
10 done = []
11 for line in self.browse(cr, uid, ids):
12 if line.move_id.id not in done:
13@@ -1390,7 +1390,7 @@
14 self.create(cr, uid, data, context)
15 del vals['account_tax_id']
16
17- if check and ((not context.get('no_store_function')) or journal.entry_posted):
18+ if check and ((not context.get('no_store_function')) or journal.entry_posted) and not context.get('novalidate'):
19 tmp = move_obj.validate(cr, uid, [vals['move_id']], context)
20 if journal.entry_posted and tmp:
21 move_obj.button_validate(cr,uid, [vals['move_id']], context)