[FIX] stock: when putting product in pack from barcode interface, should return package_id instead of True

This commit is contained in:
Cedric Snauwaert 2014-12-09 14:25:19 +01:00
parent 0173e5ec35
commit a834bd208f
2 changed files with 4 additions and 2 deletions

View File

@ -878,7 +878,8 @@ function openerp_picking_widgets(instance){
if (pack_op_ids.length !== 0){
return new instance.web.Model('stock.picking')
.call('action_pack',[[[self.picking.id]], pack_op_ids])
.then(function(){
.then(function(pack){
//TODO: the functionality using current_package_id in context is not needed anymore
instance.session.user_context.current_package_id = false;
return self.refresh_ui(self.picking.id);
});

View File

@ -1450,6 +1450,7 @@ class stock_picking(osv.osv):
stock_operation_obj = self.pool.get('stock.pack.operation')
package_obj = self.pool.get('stock.quant.package')
stock_move_obj = self.pool.get('stock.move')
package_id = False
for picking_id in picking_ids:
operation_search_domain = [('picking_id', '=', picking_id), ('result_package_id', '=', False)]
if operation_filter_ids != []:
@ -1469,7 +1470,7 @@ class stock_picking(osv.osv):
stock_move_obj.check_tracking_product(cr, uid, op.product_id, op.lot_id.id, op.location_id, op.location_dest_id, context=context)
package_id = package_obj.create(cr, uid, {}, context=context)
stock_operation_obj.write(cr, uid, pack_operation_ids, {'result_package_id': package_id}, context=context)
return True
return package_id
def process_product_id_from_ui(self, cr, uid, picking_id, product_id, op_id, increment=True, context=None):
return self.pool.get('stock.pack.operation')._search_and_increment(cr, uid, picking_id, [('product_id', '=', product_id),('id', '=', op_id)], increment=increment, context=context)