Define product variable to raise error when cost price expression is not a Decimal
The product variable is used to format the error message but also as for 50bf49b7b031 it may be empty. Closes #14062
This commit is contained in:
@@ -1317,11 +1317,12 @@ class CostPriceRevision(ModelSQL, ModifyCostPriceStart):
|
||||
product=product.rec_name if product else '',
|
||||
exception=exception)) from exception
|
||||
if not isinstance(amount, Decimal):
|
||||
product = self.product or self.template
|
||||
raise ProductCostPriceError(
|
||||
gettext('stock.msg_invalid_cost_price_not_number',
|
||||
value=amount,
|
||||
cost_price=self.cost_price,
|
||||
product=product.rec_name))
|
||||
product=product.rec_name if product else ''))
|
||||
return amount
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user