[FIX] mrp_subcontracting_skip_no_negative: consider move with multiple productions

[BOT] post-merge updates
This commit is contained in:
JordiMForgeFlow
2024-01-18 17:00:31 +01:00
committed by Víctor Martínez
parent 6c364fb355
commit 134769717d
4 changed files with 18 additions and 9 deletions

View File

@@ -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

View File

@@ -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",

View File

@@ -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(

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
@@ -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
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/manufacture/tree/16.0/mrp_subcontracting_skip_no_negative"><img alt="OCA/manufacture" src="https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/manufacture-16-0/manufacture-16-0-mrp_subcontracting_skip_no_negative"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/manufacture&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module skips the negative quantity check, provided by stock_no_negative, for