From 607ad5855e382cff76ebffd9f371fbdfc6a72608 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 12 Apr 2016 15:39:42 +0200 Subject: [PATCH] [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 --- addons/stock/stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 4059565680d..251d157dcc0 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -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)