diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index 4d5bb5a3f8c..cd399d60f67 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -549,7 +549,7 @@ class MrpProduction(models.Model): #order.action_assign() consume_move_lines = moves_to_do.mapped('active_move_line_ids') for moveline in moves_to_finish.mapped('active_move_line_ids'): - if moveline.move_id.has_tracking != 'none': + if moveline.product_id == order.product_id and moveline.move_id.has_tracking != 'none': if any([not ml.lot_produced_id for ml in consume_move_lines]): raise UserError(_('You can not consume without telling for which lot you consumed it')) # Link all movelines in the consumed with same lot_produced_id false or the correct lot_produced_id diff --git a/addons/mrp/models/mrp_workorder.py b/addons/mrp/models/mrp_workorder.py index 91677d071db..b182b1df071 100644 --- a/addons/mrp/models/mrp_workorder.py +++ b/addons/mrp/models/mrp_workorder.py @@ -355,6 +355,12 @@ class MrpWorkorder(models.Model): }) else: production_move.quantity_done += self.qty_producing + + if not self.next_work_order_id: + for by_product_move in self.production_id.move_finished_ids.filtered(lambda x: (x.product_id.id != self.production_id.product_id.id) and (x.state not in ('done', 'cancel'))): + if by_product_move.has_tracking == 'none': + by_product_move.quantity_done += self.qty_producing * by_product_move.unit_factor + # Update workorder quantity produced self.qty_produced += self.qty_producing