[FIX] stock : assert context.get('active_model') in ('stock.picking', 'stock.picking.in', 'stock.picking.out'), 'Bad context propagation'.
bzr revid: mdi@tinyerp.com-20120723085233-wp9ag3z7aigk59cn
This commit is contained in:
@@ -96,8 +96,11 @@ class stock_partial_picking(osv.osv_memory):
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
if context is None: context = {}
|
||||
res = super(stock_partial_picking, self).default_get(cr, uid, fields, context=context)
|
||||
picking_ids = context.get('active_ids', [])
|
||||
if context['active_model'] == 'purchase.order':
|
||||
for purchase_order in self.pool.get('purchase.order').browse(cr, uid, picking_ids, context=context):
|
||||
picking_ids = [picking.id for picking in purchase_order.picking_ids]
|
||||
res = super(stock_partial_picking, self).default_get(cr, uid, fields, context=context)
|
||||
if not picking_ids or len(picking_ids) != 1:
|
||||
# Partial Picking Processing may only be done for one picking at a time
|
||||
return res
|
||||
@@ -105,7 +108,7 @@ class stock_partial_picking(osv.osv_memory):
|
||||
# (already seen in previous bug where context passed was containing ir.ui.menu as active_model and the menu
|
||||
# ID as active_id). Though this should be fixed in clients now, this place is sensitive enough to ensure the
|
||||
# consistancy of the context.
|
||||
assert context.get('active_model') in ('stock.picking', 'stock.picking.in', 'stock.picking.out'), 'Bad context propagation'
|
||||
assert context.get('active_model') in ('stock.picking', 'stock.picking.in', 'stock.picking.out', 'purchase.order'), 'Bad context propagation'
|
||||
picking_id, = picking_ids
|
||||
if 'picking_id' in fields:
|
||||
res.update(picking_id=picking_id)
|
||||
|
||||
Reference in New Issue
Block a user