Merge lp:~camptocamp/openobject-addons/7.0-fix_1264950-afe into lp:openobject-addons/7.0

Proposed by Alexandre Fayolle - camptocamp
Status: Needs review
Proposed branch: lp:~camptocamp/openobject-addons/7.0-fix_1264950-afe
Merge into: lp:openobject-addons/7.0
Diff against target: 31 lines (+12/-2)
1 file modified
stock/stock.py (+12/-2)
To merge this branch: bzr merge lp:~camptocamp/openobject-addons/7.0-fix_1264950-afe
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+201027@code.launchpad.net

Description of the change

[FIX] avoid writing picking state if it has not changed (fix lp:1264950)

To post a comment you must log in.

Unmerged revisions

9747. By Alexandre Fayolle - camptocamp on 2014-01-09

[FIX] avoid writing picking state if it has not changed

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock/stock.py'
2--- stock/stock.py 2013-11-28 14:50:59 +0000
3+++ stock/stock.py 2014-01-09 15:24:35 +0000
4@@ -754,7 +754,12 @@
5 @return: True
6 """
7 pickings = self.browse(cr, uid, ids, context=context)
8- self.write(cr, uid, ids, {'state': 'confirmed'})
9+ to_update = []
10+ for pick in pickings:
11+ if pick.state != 'confirmed':
12+ to_update.append(pick.id)
13+ if to_update:
14+ self.write(cr, uid, to_update, {'state': 'confirmed'})
15 todo = []
16 for picking in pickings:
17 for r in picking.move_lines:
18@@ -833,7 +838,12 @@
19 """ Changes picking state to assigned.
20 @return: True
21 """
22- self.write(cr, uid, ids, {'state': 'assigned'})
23+ to_update = []
24+ for pick in self.browse(cr, uid, ids, context=context):
25+ if pick.state != 'assigned':
26+ to_update.append(pick.id)
27+ if to_update:
28+ self.write(cr, uid, to_update, {'state': 'assigned'})
29 return True
30
31 def test_finished(self, cr, uid, ids):