Merge lp:~openerp-dev/openobject-addons/trunk-bug-740353-ara into lp:openobject-addons

Proposed by Ashvin Rathod (OpenERP)
Status: Merged
Merged at revision: 4594
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-740353-ara
Merge into: lp:openobject-addons
Diff against target: 21 lines (+5/-2)
1 file modified
account/account_move_line.py (+5/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-740353-ara
Reviewer Review Type Date Requested Status
Ashvin Rathod (OpenERP) (community) Needs Resubmitting
Olivier Dony (Odoo) Needs Fixing
qdp (OpenERP) Pending
Review via email: mp+54669@code.launchpad.net

Description of the change

Hello,

Fix: #740353 [account] dog slow invoice cancel because validate for every line; patch included

Thanks,
ara

To post a comment you must log in.
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Hello, there is a set() object for efficiently maintaining lists without duplicates.

review: Needs Fixing
Revision history for this message
Ashvin Rathod (OpenERP) (ara-tinyerp) wrote :

hello,

I have changed as Olivier Dony(OpenERP) suggestion.

Thanks,
ara

review: Needs Resubmitting
Revision history for this message
qdp (OpenERP) (qdp) wrote :

i commited in that branch how to properly use the set type. Please have a look Ashvin. By the way, why don't i see Mustufa as reviewer?

Anyway, i merged this branch with my fix

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 2011-03-03 14:59:00 +0000
3+++ account/account_move_line.py 2011-03-25 15:41:30 +0000
4@@ -1087,12 +1087,15 @@
5 move_obj = self.pool.get('account.move')
6 self._update_check(cr, uid, ids, context)
7 result = False
8+ move_ids = set()
9 for line in self.browse(cr, uid, ids, context=context):
10+ move_ids.add(line.move_id.id)
11 context['journal_id'] = line.journal_id.id
12 context['period_id'] = line.period_id.id
13 result = super(account_move_line, self).unlink(cr, uid, [line.id], context=context)
14- if check:
15- move_obj.validate(cr, uid, [line.move_id.id], context=context)
16+ move_ids = list(move_ids)
17+ if check and move_ids:
18+ move_obj.validate(cr, uid, move_ids, context=context)
19 return result
20
21 def _check_date(self, cr, uid, vals, context=None, check=True):

Subscribers

People subscribed via source and target branches

to all changes: