[FIX] mrp: Kit Operations on parent MO without operations

Usecase to reproduce:
- BOM PROD 1 -> No operation -> KIT COMP 1
- BOM KIT COMP 1 -> at lease one operation

Create a MO and confirm it -> Traceback.

It happens because workorders_by_bom[production.bom_id] will try to
find the bom related to production order. However they don't exist but
it will create the entry [BOM PROD 1] = mrp.workorder()

The [0] will be call on each values of the list afterward and raise
the traceback

opw-2477269

closes odoo/odoo#69651

X-original-commit: edabb86a306c4dda088b39f163de5668b5d90392
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
This commit is contained in:
hur@odoo.com
2021-04-22 09:43:04 +00:00
committed by Arnold Moyaux
parent 459d4e27a8
commit 4959fdd2bb
+2
View File
@@ -451,6 +451,8 @@ class MrpWorkorder(models.Model):
})
for workorders in workorders_by_bom.values():
if not workorders:
continue
if workorders[0].state == 'pending':
workorders[0].state = 'ready'
for workorder in workorders: