From b88c755b35b59d4565eafb8cd732db23b8dad047 Mon Sep 17 00:00:00 2001 From: Swapnesh Shah Date: Fri, 22 May 2020 15:55:48 +0000 Subject: [PATCH] [IMP] stock: display full product name in warning Displaying full name with code helps to Identify Products with `default_code` in the warning message. (Especially when variants are activated) closes odoo/odoo#51720 Signed-off-by: Simon Lejeune (sle) --- addons/stock/models/stock_inventory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/stock_inventory.py b/addons/stock/models/stock_inventory.py index 6dac04c3da1..cf7206fbcd3 100644 --- a/addons/stock/models/stock_inventory.py +++ b/addons/stock/models/stock_inventory.py @@ -117,7 +117,7 @@ class Inventory(models.Model): def _action_done(self): negative = next((line for line in self.mapped('line_ids') if line.product_qty < 0 and line.product_qty != line.theoretical_qty), False) if negative: - raise UserError(_('You cannot set a negative product quantity in an inventory line:\n\t%s - qty: %s') % (negative.product_id.name, negative.product_qty)) + raise UserError(_('You cannot set a negative product quantity in an inventory line:\n\t%s - qty: %s') % (negative.product_id.display_name, negative.product_qty)) self.action_check() self.write({'state': 'done'}) self.post_inventory()