[FIX] mrp: post partial production with workorders

The commit 75460e697a was introduced in
v12, when the workorder stored their consume data on stock.move.lines.
Their was an issue when posting intermediary inventory on productions
using workorder. As those 'dummy' stock.move.lines did not have their lot
field filled, an error at line validation was raised.

In v13, the workorders use workorder lines. The lots and quantity are
transfered on real stock move lines only at the end of the production.
Posting intermediary inventory did not failed anymore in case of partial
production

Task : 54665

X-original-commit: a41239b378a1cae394d18f43e991ec8bceeac826
This commit is contained in:
William Henrotin
2019-12-04 10:26:24 +00:00
parent b3d143761e
commit 21834430a1
-1
View File
@@ -375,7 +375,6 @@ class MrpProduction(models.Model):
order.post_visible = order.is_locked and any((x.quantity_done > 0 and x.state not in ['done', 'cancel']) for x in order.move_raw_ids | order.move_finished_ids)
else:
order.post_visible = order.is_locked and any((x.quantity_done > 0 and x.state not in ['done', 'cancel']) for x in order.move_finished_ids)
order.post_visible &= all(wo.state in ['done', 'cancel'] for wo in order.workorder_ids) or all(m.product_id.tracking == 'none' for m in order.move_raw_ids)
@api.depends('workorder_ids.state', 'move_finished_ids', 'move_finished_ids.quantity_done', 'is_locked')
def _get_produced_qty(self):