From 6e20ea5f12c9019a9d598f4e779256d9f2225a60 Mon Sep 17 00:00:00 2001 From: "Pieter Claeys (clpi)" Date: Fri, 29 Sep 2023 10:14:01 +0200 Subject: [PATCH] [IMP] mrp: pre_mark_as_done validate serials and workorders When marking an MO as done in the shop floor, the pre_mark_done method is used to determine if there are any issues before putting the MO in the 5 second validation queue. However, there were two cases that were not yet caught here: 1. Pending quality checks on a workorder 2. Duplicate serial number on the final product This commit adresses both of these cases. closes odoo/odoo#137535 Task: 3456827 (nr 28) Related: odoo/enterprise#48379 Signed-off-by: Steve Van Essche --- addons/mrp/models/mrp_production.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index a9d780c5d30..0ea0f82a2b2 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -1929,8 +1929,6 @@ class MrpProduction(models.Model): self.workorder_ids._action_confirm() def button_mark_done(self): - self._button_mark_done_sanity_checks() - res = self.pre_button_mark_done() if res is not True: return res @@ -2012,6 +2010,7 @@ class MrpProduction(models.Model): return action def pre_button_mark_done(self): + self._button_mark_done_sanity_checks() for production in self: if float_is_zero(production.qty_producing, precision_rounding=production.product_uom_id.rounding): production._set_quantities()