[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
This commit is contained in:
William Henrotin
2020-08-10 09:40:24 +00:00
parent 963ad5eada
commit 2a59fdb014
+2
View File
@@ -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)