[FIX] mrp: create backorder with no components

Consuming all the components for only a part of the finished product
will ask the manufacturing user to create a backorder. Confirm it will
fail as there are no component left to consume to produce the
remaining quantity of finished product. This commit only confirm
backorders that still have some quantities to consume.

Task : 2278147

X-original-commit: 51c9281d715e27143955c7b9b51f60b22e672f52
This commit is contained in:
William Henrotin
2020-07-03 11:22:15 +00:00
parent 497ae99201
commit d57fce2035
+2 -1
View File
@@ -1376,7 +1376,8 @@ class MrpProduction(models.Model):
workorder.duration_expected = workorder.duration_expected * ratio
for workorder in backorder_mo.workorder_ids:
workorder.duration_expected = workorder.duration_expected * (1 - ratio)
backorders.action_confirm()
# Confirm only productions with remaining components
backorders.filtered(lambda mo: mo.move_raw_ids).action_confirm()
# Remove the serial move line without reserved quantity. Post inventory will assigned all the non done moves
# So those move lines are duplicated.