From 86109a7d6c660c61d636f94cc3b5b494253406a6 Mon Sep 17 00:00:00 2001 From: sebalix Date: Fri, 18 May 2018 18:02:21 +0200 Subject: [PATCH] [FIX] mrp_production_hierarchy: Fix method '_generate_moves()' --- mrp_production_hierarchy/models/mrp_production.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mrp_production_hierarchy/models/mrp_production.py b/mrp_production_hierarchy/models/mrp_production.py index cee1450eb..652b9a2f3 100644 --- a/mrp_production_hierarchy/models/mrp_production.py +++ b/mrp_production_hierarchy/models/mrp_production.py @@ -28,12 +28,14 @@ class MrpProduction(models.Model): It will be used by the 'procurement_order.make_mo()' overload to set the parent relation between production orders. """ - # Set the initial root production order ID - if not self.env.context.get('root_mrp_production_id'): - self = self.with_context(root_mrp_production_id=self.id) - # Set the parent production order ID - self = self.with_context(parent_mrp_production_id=self.id) - return super(MrpProduction, self)._generate_moves() + for prod in self: + # Set the initial root production order ID + if not prod.env.context.get('root_mrp_production_id'): + prod = prod.with_context(root_mrp_production_id=self.id) + # Set the parent production order ID + prod = prod.with_context(parent_mrp_production_id=self.id) + super(MrpProduction, prod)._generate_moves() + return True @api.multi def open_production_tree(self):