← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~numerigraphe-team/ocb-addons/7.0-stock-move-cancel-context into lp:ocb-addons

 

Lionel Sausin - Numérigraphe has proposed merging lp:~numerigraphe-team/ocb-addons/7.0-stock-move-cancel-context into lp:ocb-addons.

Requested reviews:
  OpenERP Community Backports Team (ocb)
Related bugs:
  Bug #1291874 in OpenERP Community Backports (Addons): "Method stock_move.action_cancel() loses  context"
  https://bugs.launchpad.net/ocb-addons/+bug/1291874

For more details, see:
https://code.launchpad.net/~numerigraphe-team/ocb-addons/7.0-stock-move-cancel-context/+merge/210761

This branch adds the missing context in several function calls in stock.inventory.action_cancel().
This is not necessary for the standard addons, but makes it possible to use the context in custom modules.
-- 
https://code.launchpad.net/~numerigraphe-team/ocb-addons/7.0-stock-move-cancel-context/+merge/210761
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~numerigraphe-team/ocb-addons/7.0-stock-move-cancel-context into lp:ocb-addons.
=== modified file 'stock/stock.py'
--- stock/stock.py	2014-03-04 13:08:40 +0000
+++ stock/stock.py	2014-03-13 09:53:01 +0000
@@ -2272,15 +2272,15 @@
                 if move.picking_id:
                     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': '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, 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:


Follow ups