summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Valverde <gustavo@iterativo.do>2018-09-28 12:38:34 +0000
committerGitHub <noreply@github.com>2018-09-28 12:38:34 +0000
commita9a556178d5fb4cb3fc657c4ffc455c521f1396c (patch)
tree581aba161b3f9a3d804043e5f3ae6866e7b1166a
parent56658ad8de9b9190738cec2c976613ddbdfba6de (diff)
[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
-rw-r--r--addons/stock_account/models/stock.py6
1 files 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