From 03aede0a2c269551334ef49f2c0b7ff5a24bd2fb Mon Sep 17 00:00:00 2001 From: "Tiffany Chang (tic)" Date: Fri, 18 Jun 2021 07:35:48 +0000 Subject: [PATCH] [FIX] mrp: allow validation when no components Conflicting fixes for unusual cases of MO validation when no components assigned and when components assigned all with 0 consumed made it so we cannot validate an MO with no components despite there being a confirmation popup that makes it seem like you can. This fix makes it so we can validate a MO when no components are assigned (ideally we would allow validating both cases, but fix for 0 consumed is much more difficult + an extremely unlikely use case). closes odoo/odoo#72343 Task: 2422698 Signed-off-by: Arnold Moyaux --- addons/mrp/models/mrp_production.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index 6b57ed397c0..e0ebfb51b2e 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -1528,7 +1528,7 @@ class MrpProduction(models.Model): for production in self: if float_is_zero(production.qty_producing, precision_rounding=production.product_uom_id.rounding): raise UserError(_('The quantity to produce must be positive!')) - if not any(production.move_raw_ids.mapped('quantity_done')): + if production.move_raw_ids and not any(production.move_raw_ids.mapped('quantity_done')): raise UserError(_("You must indicate a non-zero amount consumed for at least one of your components")) consumption_issues = self._get_consumption_issues()