From a9a556178d5fb4cb3fc657c4ffc455c521f1396c Mon Sep 17 00:00:00 2001 From: Gustavo Valverde Date: Fri, 28 Sep 2018 12:38:34 +0000 Subject: [PATCH] [FIX] stock_account: Use product display_name in errors When working with product variants, if the error which gets displayed does not include the product attributes, it's harder to identify the variant with the error. closes odoo/odoo#27298 --- addons/stock_account/models/stock.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/stock_account/models/stock.py b/addons/stock_account/models/stock.py index 7bcb3844b96..251c975ba92 100644 --- a/addons/stock_account/models/stock.py +++ b/addons/stock_account/models/stock.py @@ -507,9 +507,9 @@ class StockMove(models.Model): if not accounts_data.get('stock_journal', False): raise UserError(_('You don\'t have any stock journal defined on your product category, check if you have installed a chart of accounts')) if not acc_src: - raise UserError(_('Cannot find a stock input account for the product %s. You must define one on the product category, or on the location, before processing this operation.') % (self.product_id.name)) + raise UserError(_('Cannot find a stock input account for the product %s. You must define one on the product category, or on the location, before processing this operation.') % (self.product_id.display_name)) if not acc_dest: - raise UserError(_('Cannot find a stock output account for the product %s. You must define one on the product category, or on the location, before processing this operation.') % (self.product_id.name)) + raise UserError(_('Cannot find a stock output account for the product %s. You must define one on the product category, or on the location, before processing this operation.') % (self.product_id.display_name)) if not acc_valuation: raise UserError(_('You don\'t have any stock valuation account defined on your product category. You must define one before processing this operation.')) journal_id = accounts_data['stock_journal'].id @@ -538,7 +538,7 @@ class StockMove(models.Model): # check that all data is correct if self.company_id.currency_id.is_zero(debit_value): - raise UserError(_("The cost of %s is currently equal to 0. Change the cost or the configuration of your product to avoid an incorrect valuation.") % (self.product_id.name,)) + raise UserError(_("The cost of %s is currently equal to 0. Change the cost or the configuration of your product to avoid an incorrect valuation.") % (self.product_id.display_name,)) credit_value = debit_value partner_id = (self.picking_id.partner_id and self.env['res.partner']._find_accounting_partner(self.picking_id.partner_id).id) or False