diff --git a/CHANGELOG b/CHANGELOG
index c46dc5c410..5a6b4af6c6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,4 @@
+* Show warning when output product's list price is empty
* Remove unique product constraint on BOM
Version 6.0.0 - 2021-05-03
diff --git a/exceptions.py b/exceptions.py
new file mode 100644
index 0000000000..5d7320bf67
--- /dev/null
+++ b/exceptions.py
@@ -0,0 +1,7 @@
+# This file is part of Tryton. The COPYRIGHT file at the top level of
+# this repository contains the full copyright notices and license terms.
+from trytond.exceptions import UserWarning
+
+
+class CostWarning(UserWarning):
+ pass
diff --git a/message.xml b/message.xml
index b12c6e4511..db0502676a 100644
--- a/message.xml
+++ b/message.xml
@@ -6,5 +6,8 @@ this repository contains the full copyright notices and license terms. -->
You cannot create a recursive BOM for product "%(product)s".
+
+ The product "%(product)s" on production "%(production)s" does not have any list price defined.
+
diff --git a/production.py b/production.py
index eab0afa3fb..86cfb70f3f 100644
--- a/production.py
+++ b/production.py
@@ -8,6 +8,7 @@ from itertools import chain
from sql import Null
from sql.conditionals import Coalesce
+from trytond.i18n import gettext
from trytond.model import ModelView, ModelSQL, Workflow, fields, dualmethod
from trytond.pyson import Eval, Bool, If
from trytond.pool import Pool
@@ -17,6 +18,9 @@ from trytond.modules.company.model import employee_field, set_employee
from trytond.modules.product import price_digits, round_price
from trytond.modules.stock.shipment import ShipmentAssignMixin
+from .exceptions import CostWarning
+
+
BOM_CHANGES = ['bom', 'product', 'quantity', 'uom', 'warehouse', 'location',
'company', 'inputs', 'outputs']
@@ -536,6 +540,7 @@ class Production(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
pool = Pool()
Uom = pool.get('product.uom')
Move = pool.get('stock.move')
+ Warning = pool.get('res.user.warning')
moves = []
for production in productions:
@@ -575,6 +580,15 @@ class Production(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
for output in outputs:
product = output.product
list_price = product.list_price_used
+ if list_price is None:
+ warning_name = Warning.format(
+ 'production_missing_list_price', [product])
+ if Warning.check(warning_name):
+ raise CostWarning(warning_name,
+ gettext(
+ 'production.msg_missing_product_list_price',
+ product=product.rec_name,
+ production=production.rec_name))
product_price = (Decimal(str(output.quantity))
* Uom.compute_price(
product.default_uom, list_price, output.uom))