[FIX] mrp: wo list view fix multiple workorders done

Before this commit
==================
Marking multiple work-orders as done was not functioning as expected.
Only the first work-order status was being marked as done, and not all of them.

Steps to Produce
================
- Create a bom product having multiple work-orders.
- Create a MO and confirm it.
- Inside WO list view select multiple work orders of the recently created MO,
  and click on "done". You will notice that even though multiple work-orders
  were selected, only the first work-order status is changed to "done".

With this commit
================
On selecting multiple work-orders and triggering "done" will work as expected,
and the status of all selected work-orders will be marked as "done".

Task: 3374990
X-original-commit: 486aab5ee8ae1cd8792bc9bbb4aae1797c38fe5f
Part-of: odoo/odoo#130663
This commit is contained in:
Rahul Reddiar
2023-08-17 18:42:35 +02:00
parent ec89c3e960
commit 36acef2ce0
+1 -1
View File
@@ -883,10 +883,10 @@ class MrpWorkorder(models.Model):
for wo in self:
if wo.working_state == 'blocked':
raise UserError(_('Some workorders require another workorder to be completed first'))
wo.button_finish()
if wo.duration == 0.0:
wo.duration = wo.duration_expected
wo.duration_percent = 100
wo.state = 'done'
def action_mass_start(self):
for wo in self: