From 4692e33d24fda47631fb6c39432882fef72ae28b Mon Sep 17 00:00:00 2001 From: Nicolas Pierre Date: Tue, 8 Jun 2021 15:44:18 +0000 Subject: [PATCH] [FIX] mrp: send additional components to backorder Following https://github.com/odoo/odoo/pull/64911, components that are added in the simplified view of an MO are not transferred to the backorder, which is not aligned with the behavior of the tablet view. Enterprise PR: https://github.com/odoo/enterprise/pull/18897 closes odoo/odoo#71925 Task: 2566749 Related: odoo/enterprise#18897 Signed-off-by: Arnold Moyaux --- addons/mrp/models/mrp_production.py | 4 ++-- addons/mrp/models/stock_move.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index ee7402a6451..52d011fff05 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -975,7 +975,7 @@ class MrpProduction(models.Model): if production.state in ('done', 'cancel'): continue additional_moves = production.move_raw_ids.filtered( - lambda move: move.state == 'draft' and move.additional + lambda move: move.state == 'draft' ) additional_moves.write({ 'group_id': production.procurement_group_id.id, @@ -983,7 +983,7 @@ class MrpProduction(models.Model): additional_moves._adjust_procure_method() moves_to_confirm |= additional_moves additional_byproducts = production.move_finished_ids.filtered( - lambda move: move.state == 'draft' and move.additional + lambda move: move.state == 'draft' ) moves_to_confirm |= additional_byproducts diff --git a/addons/mrp/models/stock_move.py b/addons/mrp/models/stock_move.py index 55dd6289275..8f4d7234a5c 100644 --- a/addons/mrp/models/stock_move.py +++ b/addons/mrp/models/stock_move.py @@ -190,8 +190,8 @@ class StockMove(models.Model): defaults['state'] = 'draft' else: defaults['state'] = 'done' + defaults['additional'] = True defaults['product_uom_qty'] = 0.0 - defaults['additional'] = True return defaults def write(self, vals):