[FIX] mrp: next WO lot

- Set the products tracked by lot
- Set 1 route with steps that allow to begin next one after a minimum
amount processed.
- Plan and begin the manufacturing process.
- Process partially step 1, but fully step 2
- Finish step 1

The error 'You can not change the finished work order.' is raised.

This is because we try to set the default final lot on a WO which is
done.

This is only used to suggest the right lot number, so we can safely skip
the step if the WO is done or canceled.

opw-2002044

closes odoo/odoo#34072

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2019-06-12 13:51:53 +00:00
parent 3c45f08825
commit 115ae7f894
+1 -1
View File
@@ -402,7 +402,7 @@ class MrpWorkorder(models.Model):
self.qty_producing = float_round(self.production_id.product_qty - self.qty_produced, precision_rounding=rounding)
self._generate_lot_ids()
if self.next_work_order_id and self.production_id.product_id.tracking != 'none':
if self.next_work_order_id and self.next_work_order_id.state not in ['done', 'cancel'] and self.production_id.product_id.tracking != 'none':
self.next_work_order_id._assign_default_final_lot_id()
if float_compare(self.qty_produced, self.production_id.product_qty, precision_rounding=rounding) >= 0: