Add hasattr to get product or template revision in issue12216.diff
#162161
This commit is contained in:
parent
db6b153cfa
commit
6c7fefb56e
|
@ -49,7 +49,7 @@ index e4da113ef3..96a9fac580 100644
|
||||||
+ try:
|
+ try:
|
||||||
+ amount = simple_eval(decistmt(self.cost_price), **context)
|
+ amount = simple_eval(decistmt(self.cost_price), **context)
|
||||||
+ except (InvalidExpression, SyntaxError) as exception:
|
+ except (InvalidExpression, SyntaxError) as exception:
|
||||||
+ product = self.product or self.template
|
+ product = hasattr(self, 'product') and self.product or self.template
|
||||||
+ raise ProductCostPriceError(
|
+ raise ProductCostPriceError(
|
||||||
+ gettext('stock.msg_invalid_cost_price',
|
+ gettext('stock.msg_invalid_cost_price',
|
||||||
+ cost_price=self.cost_price,
|
+ cost_price=self.cost_price,
|
||||||
|
|
Loading…
Reference in New Issue