From a9bb6694876165aaf5d9a3af0823b2b5e37b866f Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 2 Sep 2019 11:59:23 +0000 Subject: [PATCH] [FIX] mrp: Kit in manufacturing Steps to reproduce the bug: - Create a MO with a product with a normal bom B - Save the MO - Change the type of B to phantom - Try to produce the MO Bug: It was impossible to cancel or confirm the MO. It's not allowed to produce a MO with phantom bom. opw:2061958 closes odoo/odoo#36329 Signed-off-by: Simon Goffin (sig) --- addons/mrp/i18n/mrp.pot | 6 ++++++ addons/mrp/models/mrp_production.py | 2 ++ 2 files changed, 8 insertions(+) diff --git a/addons/mrp/i18n/mrp.pot b/addons/mrp/i18n/mrp.pot index a7d27c5a1d7..b4567bdfb1d 100644 --- a/addons/mrp/i18n/mrp.pot +++ b/addons/mrp/i18n/mrp.pot @@ -4133,6 +4133,12 @@ msgstr "" msgid "You cannot delete an unbuild order if the state is 'Done'." msgstr "" +#. module: mrp +#: code:addons/mrp/models/mrp_production.py:533 +#, python-format +msgid "You cannot produce a MO with a bom kit product." +msgstr "" + #. module: mrp #: code:addons/mrp/wizard/mrp_product_produce.py:82 #, python-format diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index 540dfbce5c1..693cfca5b16 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -529,6 +529,8 @@ class MrpProduction(models.Model): @api.multi def open_produce_product(self): self.ensure_one() + if self.bom_id.type == 'phantom': + raise UserError(_('You cannot produce a MO with a bom kit product.')) action = self.env.ref('mrp.act_mrp_product_produce').read()[0] return action