Add hasattr to get product or template revision in issue12216.diff

#162161
This commit is contained in:
Raimon Esteve 2023-09-07 15:28:51 +02:00
parent db6b153cfa
commit 6c7fefb56e
1 changed files with 1 additions and 1 deletions

View File

@ -49,7 +49,7 @@ index e4da113ef3..96a9fac580 100644
+ try:
+ amount = simple_eval(decistmt(self.cost_price), **context)
+ except (InvalidExpression, SyntaxError) as exception:
+ product = self.product or self.template
+ product = hasattr(self, 'product') and self.product or self.template
+ raise ProductCostPriceError(
+ gettext('stock.msg_invalid_cost_price',
+ cost_price=self.cost_price,