← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~camptocamp/ocb-addons/ocb-7.0-fix_1264950-afe into lp:ocb-addons

 

Alexandre Fayolle - camptocamp has proposed merging lp:~camptocamp/ocb-addons/ocb-7.0-fix_1264950-afe into lp:ocb-addons.

Requested reviews:
  OpenERP Community Backports Team (ocb)
Related bugs:
  Bug #1264950 in OpenERP Community Backports (Addons): "7.0: stock_picking.action_cancel can cause RuntimeError: maximum recursion depth exceeded "
  https://bugs.launchpad.net/ocb-addons/+bug/1264950

For more details, see:
https://code.launchpad.net/~camptocamp/ocb-addons/ocb-7.0-fix_1264950-afe/+merge/201028

[FIX] avoid writing picking state if it has not changed (fix lp:1264950)
-- 
https://code.launchpad.net/~camptocamp/ocb-addons/ocb-7.0-fix_1264950-afe/+merge/201028
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~camptocamp/ocb-addons/ocb-7.0-fix_1264950-afe into lp:ocb-addons.
=== modified file 'stock/stock.py'
--- stock/stock.py	2013-11-28 14:50:59 +0000
+++ stock/stock.py	2014-01-09 15:25:28 +0000
@@ -754,7 +754,12 @@
         @return: True
         """
         pickings = self.browse(cr, uid, ids, context=context)
-        self.write(cr, uid, ids, {'state': 'confirmed'})
+        to_update = []
+        for pick in pickings:
+            if pick.state != 'confirmed':
+                to_update.append(pick.id)
+        if to_update:
+            self.write(cr, uid, to_update, {'state': 'confirmed'})
         todo = []
         for picking in pickings:
             for r in picking.move_lines:
@@ -833,7 +838,12 @@
         """ Changes picking state to assigned.
         @return: True
         """
-        self.write(cr, uid, ids, {'state': 'assigned'})
+        to_update = []
+        for pick in self.browse(cr, uid, ids, context=context):
+            if pick.state != 'assigned':
+                to_update.append(pick.id)
+        if to_update:
+            self.write(cr, uid, to_update, {'state': 'assigned'})
         return True
 
     def test_finished(self, cr, uid, ids):


References