[FIX] Add missing context to some calls
authorLionel Sausin <ls@numerigraphe.com>
Thu, 13 Mar 2014 09:50:54 +0000 (10:50 +0100)
committerLionel Sausin <ls@numerigraphe.com>
Thu, 13 Mar 2014 09:50:54 +0000 (10:50 +0100)
lp bug: https://launchpad.net/bugs/1291874 fixed

bzr revid: ls@numerigraphe.com-20140313095054-3506f3tan8eyqc61

1  2 
addons/stock/stock.py

@@@ -2243,17 -1960,17 +2243,17 @@@ class stock_move(osv.osv)
          for move in self.browse(cr, uid, ids, context=context):
              if move.state in ('confirmed', 'waiting', 'assigned', 'draft'):
                  if move.picking_id:
 -                    pickings[move.picking_id.id] = True
 +                    pickings.add(move.picking_id.id)
              if move.move_dest_id and move.move_dest_id.state == 'waiting':
-                 self.write(cr, uid, [move.move_dest_id.id], {'state': 'confirmed'})
 -                self.write(cr, uid, [move.move_dest_id.id], {'state': 'assigned'}, context=context)
++                self.write(cr, uid, [move.move_dest_id.id], {'state': 'confirmed'}, context=context)
                  if context.get('call_unlink',False) and move.move_dest_id.picking_id:
                      wf_service = netsvc.LocalService("workflow")
                      wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr)
-         self.write(cr, uid, ids, {'state': 'cancel', 'move_dest_id': False})
+         self.write(cr, uid, ids, {'state': 'cancel', 'move_dest_id': False}, context=context)
          if not context.get('call_unlink',False):
 -            for pick in self.pool.get('stock.picking').browse(cr, uid, pickings.keys()):
 +            for pick in self.pool.get('stock.picking').browse(cr, uid, list(pickings), context=context):
                  if all(move.state == 'cancel' for move in pick.move_lines):
-                     self.pool.get('stock.picking').write(cr, uid, [pick.id], {'state': 'cancel'})
+                     self.pool.get('stock.picking').write(cr, uid, [pick.id], {'state': 'cancel'}, context=context)
  
          wf_service = netsvc.LocalService("workflow")
          for id in ids: