From 2a59fdb0141fe01f1fe177b793d08f5cc52de1b6 Mon Sep 17 00:00:00 2001 From: William Henrotin Date: Mon, 27 Jul 2020 14:32:35 +0000 Subject: [PATCH] [FIX] mrp: bypass _plan_workorder in case of no workorder The _plan_workorder function is callable for the production order list view. Calling it on production without workorder make no sense and can even crash. This commit bypass it in those case Task : 2278147 --- addons/mrp/models/mrp_production.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index 5afd01bd5cc..c35b03869cf 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -1113,6 +1113,8 @@ class MrpProduction(models.Model): """ self.ensure_one() + if not self.workorder_ids: + return # Schedule all work orders (new ones and those already created) qty_to_produce = max(self.product_qty - self.qty_produced, 0) qty_to_produce = self.product_uom_id._compute_quantity(qty_to_produce, self.product_id.uom_id)