[FIX] mrp: wo list view fix operation status

Before this commit
==================
Marking an operation as done rather than start and done, the status of
subsequent immediate next linked work orders is not updated properly inside
WO list view.

Steps to Reproduce
==================
- Create a bom product having more than one operations.
- Create a MO and confirm it.
- Inside WO list view select a single first operation of the recently created
  MO, and click on done, you will find that the status of subsequent operation
  (immediate next) is not updated properly.
  This happens because of the reservation state of the MO which has initial
  state as false and thus the status of work-order changes to 'waiting'.

With this commit
================
Marking operation as done the status of subsequent linked work order gets
updated properly.

closes odoo/odoo#128881

Task: 3358125
X-original-commit: 0533577264413934179cc32e0cfe26cb324dd58a
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
This commit is contained in:
Rahul Reddiar
2023-07-20 17:01:39 +02:00
parent dfdd8d7bb6
commit d9f6b6901d
+3 -1
View File
@@ -571,9 +571,9 @@ class MrpProduction(models.Model):
@api.depends('state', 'move_raw_ids.state')
def _compute_reservation_state(self):
self.reservation_state = False
for production in self:
if production.state in ('draft', 'done', 'cancel'):
production.reservation_state = False
continue
relevant_move_state = production.move_raw_ids._get_relevant_state_among_moves()
# Compute reservation state according to its component's moves.
@@ -584,6 +584,8 @@ class MrpProduction(models.Model):
production.reservation_state = 'confirmed'
elif relevant_move_state != 'draft':
production.reservation_state = relevant_move_state
else:
production.reservation_state = False
@api.depends('move_raw_ids', 'state', 'move_raw_ids.product_uom_qty')
def _compute_unreserve_visible(self):