From 134769717dc426083044dd00b50696117f1ef50b Mon Sep 17 00:00:00 2001 From: JordiMForgeFlow Date: Thu, 18 Jan 2024 17:00:31 +0100 Subject: [PATCH] [FIX] mrp_subcontracting_skip_no_negative: consider move with multiple productions [BOT] post-merge updates --- .../README.rst | 2 +- .../__manifest__.py | 2 +- .../models/stock_move.py | 20 ++++++++++++++----- .../static/description/index.html | 3 +-- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/mrp_subcontracting_skip_no_negative/README.rst b/mrp_subcontracting_skip_no_negative/README.rst index 9ddbe6b0f..527110e6e 100644 --- a/mrp_subcontracting_skip_no_negative/README.rst +++ b/mrp_subcontracting_skip_no_negative/README.rst @@ -7,7 +7,7 @@ MRP Subcontracting Skip No Negative !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:e15e615a77ae456ed0e85a3b2adef82fdc0c372a5ebb670787075700698b09a1 + !! source digest: sha256:be1748f4d86ee601f04fee6c3ecec9db99e0aff2f2628d99f01406f1a1e20cf5 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/mrp_subcontracting_skip_no_negative/__manifest__.py b/mrp_subcontracting_skip_no_negative/__manifest__.py index 2053ab7b5..3d624be50 100644 --- a/mrp_subcontracting_skip_no_negative/__manifest__.py +++ b/mrp_subcontracting_skip_no_negative/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) { "name": "MRP Subcontracting Skip No Negative", - "version": "16.0.1.0.0", + "version": "16.0.1.0.1", "license": "AGPL-3", "author": "Quartile Limited, Odoo Community Association (OCA)", "website": "https://github.com/OCA/manufacture", diff --git a/mrp_subcontracting_skip_no_negative/models/stock_move.py b/mrp_subcontracting_skip_no_negative/models/stock_move.py index 9a08a15c5..35a108879 100644 --- a/mrp_subcontracting_skip_no_negative/models/stock_move.py +++ b/mrp_subcontracting_skip_no_negative/models/stock_move.py @@ -14,11 +14,21 @@ class StockMove(models.Model): # For rather unlikely occassions where linked production is not in the right # state. for move in moves_with_no_check: - production_move = self.search([("move_dest_ids", "=", move.id)]) - production = production_move.production_id - if production.reservation_state != "assigned": - production.action_assign() - if production.reservation_state == "assigned": + production_moves = self.search( + [ + ("move_dest_ids", "=", move.id), + ("state", "not in", ("done", "cancel")), + ] + ) + productions = production_moves.production_id + unassigned_productions = productions.filtered( + lambda p: p.reservation_state != "assigned" + ) + unassigned_productions.action_assign() + if all( + state == "assigned" + for state in unassigned_productions.mapped("reservation_state") + ): continue moves_with_no_check -= move res = super(StockMove, self - moves_with_no_check)._action_done( diff --git a/mrp_subcontracting_skip_no_negative/static/description/index.html b/mrp_subcontracting_skip_no_negative/static/description/index.html index b88a79f5b..cde0c7112 100644 --- a/mrp_subcontracting_skip_no_negative/static/description/index.html +++ b/mrp_subcontracting_skip_no_negative/static/description/index.html @@ -1,4 +1,3 @@ - @@ -367,7 +366,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:e15e615a77ae456ed0e85a3b2adef82fdc0c372a5ebb670787075700698b09a1 +!! source digest: sha256:be1748f4d86ee601f04fee6c3ecec9db99e0aff2f2628d99f01406f1a1e20cf5 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/manufacture Translate me on Weblate Try me on Runboat

This module skips the negative quantity check, provided by stock_no_negative, for