32 lines
1.4 KiB
Diff
32 lines
1.4 KiB
Diff
diff --git a/trytond/trytond/modules/stock/product.py b/trytond/trytond/modules/stock/product.py
|
|
index bbe41a5..169f46e 100644
|
|
--- a/trytond/trytond/modules/stock/product.py
|
|
+++ b/trytond/trytond/modules/stock/product.py
|
|
@@ -16,6 +16,7 @@ from trytond.pyson import PYSONEncoder, Eval, Or
|
|
from trytond.transaction import Transaction
|
|
from trytond.pool import Pool, PoolMeta
|
|
from trytond.tools import grouped_slice
|
|
+from trytond.exceptions import UserError
|
|
|
|
from trytond.modules.product import TemplateFunction
|
|
from .move import StockMixin
|
|
@@ -126,11 +127,14 @@ class Product(StockMixin, object):
|
|
with Transaction().set_context(context):
|
|
for product in cls.browse(products):
|
|
# The date could be before the product creation
|
|
- if not isinstance(product.cost_price, Decimal):
|
|
+ try:
|
|
+ if not isinstance(product.cost_price, Decimal):
|
|
+ cost_values[product.id] = None
|
|
+ else:
|
|
+ cost_values[product.id] = (Decimal(str(product.quantity))
|
|
+ * product.cost_price)
|
|
+ except UserError:
|
|
cost_values[product.id] = None
|
|
- else:
|
|
- cost_values[product.id] = (Decimal(str(product.quantity))
|
|
- * product.cost_price)
|
|
return cost_values
|
|
|
|
@classmethod
|