[FIX] stock: raise UserError when two inventory adjustments are in progress

When two inventory adjustments are in progress state with a common product,
raise a UserError instead of a Warning.

opw:673686
This commit is contained in:
Goffin Simon
2016-04-12 15:39:42 +02:00
parent 267097255e
commit 607ad5855e
+1 -1
View File
@@ -3002,7 +3002,7 @@ class stock_inventory_line(osv.osv):
if res:
location = self.pool['stock.location'].browse(cr, uid, values.get('location_id'), context=context)
product = product_obj.browse(cr, uid, values.get('product_id'), context=context)
raise Warning(_("You cannot have two inventory adjustements in state 'in Progess' with the same product(%s), same location(%s), same package, same owner and same lot. Please first validate the first inventory adjustement with this product before creating another one.") % (product.name, location.name))
raise UserError(_("You cannot have two inventory adjustements in state 'in Progess' with the same product(%s), same location(%s), same package, same owner and same lot. Please first validate the first inventory adjustement with this product before creating another one.") % (product.name, location.name))
if 'product_id' in values and not 'product_uom_id' in values:
values['product_uom_id'] = product_obj.browse(cr, uid, values.get('product_id'), context=context).uom_id.id
return super(stock_inventory_line, self).create(cr, uid, values, context=context)