diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index c89cea5fe00..a5232143ea7 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -1246,6 +1246,11 @@ class MrpProduction(models.Model): parent_moves = self.procurement_group_id.stock_move_ids.move_dest_ids return (dest_moves | parent_moves).group_id.mrp_production_ids.filtered(lambda p: p.origin != self.origin) - self + def set_qty_producing(self): + # This method is used to call `_set_lot_producing` when the onchange doesn't apply. + self.ensure_one() + self._set_qty_producing() + def _set_lot_producing(self): self.ensure_one() self.lot_producing_id = self.env['stock.lot'].create(self._prepare_stock_lot_values()) @@ -1882,7 +1887,7 @@ class MrpProduction(models.Model): def button_mark_done(self): self._button_mark_done_sanity_checks() - res = self._pre_button_mark_done() + res = self.pre_button_mark_done() if res is not True: return res @@ -1963,7 +1968,7 @@ class MrpProduction(models.Model): }) return action - def _pre_button_mark_done(self): + def pre_button_mark_done(self): for production in self: if float_is_zero(production.qty_producing, precision_rounding=production.product_uom_id.rounding): production._set_quantities() diff --git a/addons/mrp_product_expiry/models/mrp_production.py b/addons/mrp_product_expiry/models/mrp_production.py index 21522a84f60..76a954ca30a 100644 --- a/addons/mrp_product_expiry/models/mrp_production.py +++ b/addons/mrp_product_expiry/models/mrp_production.py @@ -7,11 +7,11 @@ from odoo import models, _ class MrpWorkorder(models.Model): _inherit = 'mrp.production' - def _pre_button_mark_done(self): + def pre_button_mark_done(self): confirm_expired_lots = self._check_expired_lots() if confirm_expired_lots: return confirm_expired_lots - return super()._pre_button_mark_done() + return super().pre_button_mark_done() def _check_expired_lots(self): # We use the 'skip_expired' context key to avoid to make the check when diff --git a/addons/mrp_subcontracting/models/mrp_production.py b/addons/mrp_subcontracting/models/mrp_production.py index a9ab62ef40c..8fc7a28d55a 100644 --- a/addons/mrp_subcontracting/models/mrp_production.py +++ b/addons/mrp_subcontracting/models/mrp_production.py @@ -92,10 +92,10 @@ class MrpProduction(models.Model): return action return {'type': 'ir.actions.act_window_close'} - def _pre_button_mark_done(self): + def pre_button_mark_done(self): if self._get_subcontract_move(): return True - return super()._pre_button_mark_done() + return super().pre_button_mark_done() def _update_finished_move(self): """ After producing, set the move line on the subcontract picking. """