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

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

Description of the change

reduce the number of unnecessary calls to trg_write in cancel_assign

when calling stock_picking.cancel_assign, the original code would call trg_write nb_move+1 times. This version only performs one call per stock.picking affected

To post a comment you must log in.

Unmerged revisions

9747. By Alexandre Fayolle - camptocamp

[FIX] reduce the number of unnecessary calls to trg_write in cancel_assign

when calling stock_picking.cancel_assign, the original code would call trg_write nb_move+1 times. This version only performs one call

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'stock/stock.py'
--- stock/stock.py 2013-11-28 14:50:59 +0000
+++ stock/stock.py 2014-01-09 15:10:15 +0000
@@ -822,11 +822,9 @@
822 """ Cancels picking and moves.822 """ Cancels picking and moves.
823 @return: True823 @return: True
824 """824 """
825 wf_service = netsvc.LocalService("workflow")
826 for pick in self.browse(cr, uid, ids):825 for pick in self.browse(cr, uid, ids):
827 move_ids = [x.id for x in pick.move_lines]826 move_ids = [x.id for x in pick.move_lines]
828 self.pool.get('stock.move').cancel_assign(cr, uid, move_ids)827 self.pool.get('stock.move').cancel_assign(cr, uid, move_ids)
829 wf_service.trg_write(uid, 'stock.picking', pick.id, cr)
830 return True828 return True
831829
832 def action_assign_wkf(self, cr, uid, ids, context=None):830 def action_assign_wkf(self, cr, uid, ids, context=None):
@@ -2161,10 +2159,12 @@
2161 # fix for bug lp:7070312159 # fix for bug lp:707031
2162 # called write of related picking because changing move availability does2160 # called write of related picking because changing move availability does
2163 # not trigger workflow of picking in order to change the state of picking2161 # not trigger workflow of picking in order to change the state of picking
2162 seen = set()
2164 wf_service = netsvc.LocalService('workflow')2163 wf_service = netsvc.LocalService('workflow')
2165 for move in self.browse(cr, uid, ids, context):2164 for move in self.browse(cr, uid, ids, context):
2166 if move.picking_id:2165 if move.picking_id and move.picking_id.id not in seen:
2167 wf_service.trg_write(uid, 'stock.picking', move.picking_id.id, cr)2166 wf_service.trg_write(uid, 'stock.picking', move.picking_id.id, cr)
2167 seen.add(move.picking_id.id)
2168 return True2168 return True
21692169
2170 #2170 #