From b2b088787d62d2819bec02cf827b88cc49144f19 Mon Sep 17 00:00:00 2001 From: Akim Juillerat Date: Thu, 17 Jul 2025 18:49:00 +0200 Subject: [PATCH 01/14] [FIX] st_available_to_promise_release: Fix location dest on cancel picking When creating the return picking for moved goods on unrelease operations, we are forcing 'Stock' (ie the default location of return picking type) as a destination location, through context of return picking wizard. However, this context key was only used on the preparation of the return move values, whereas the return picking had its destination location set to the source location of the picking being returned. Hence, when the partner was set on the return picking (through purchase_stock override), it was triggering recomputation of the destination location on the stock move, overwriting the forced destination location from the return picking type. By using the location value provided through context to create the return wizard when preparing the return picking values, we ensure any recomputation will not overwrite said value on the stock move. --- .../wizards/__init__.py | 1 + .../wizards/stock_return_picking.py | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 stock_available_to_promise_release/wizards/stock_return_picking.py diff --git a/stock_available_to_promise_release/wizards/__init__.py b/stock_available_to_promise_release/wizards/__init__.py index 05b94ca5df0..c922c27b280 100644 --- a/stock_available_to_promise_release/wizards/__init__.py +++ b/stock_available_to_promise_release/wizards/__init__.py @@ -1,2 +1,3 @@ from . import stock_release from . import stock_unrelease +from . import stock_return_picking diff --git a/stock_available_to_promise_release/wizards/stock_return_picking.py b/stock_available_to_promise_release/wizards/stock_return_picking.py new file mode 100644 index 00000000000..8908df5b53a --- /dev/null +++ b/stock_available_to_promise_release/wizards/stock_return_picking.py @@ -0,0 +1,25 @@ +# Copyright 2025 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) +from odoo import models + + +class StockReturnPicking(models.TransientModel): + _inherit = "stock.return.picking" + + def _prepare_move_default_values(self, return_line, new_picking): + vals = super()._prepare_move_default_values(return_line, new_picking) + # Update the destination location if provided in context + # (used for unrelease return logic). + unrelease_return_type_loc_dest_id = self.env.context.get("return_loc_dest_id") + if unrelease_return_type_loc_dest_id: + vals["location_dest_id"] = unrelease_return_type_loc_dest_id + return vals + + def _prepare_picking_default_values(self): + res = super()._prepare_picking_default_values() + # Update the destination location if provided in context + # (used for unrelease return logic). + unrelease_return_type_loc_dest_id = self.env.context.get("return_loc_dest_id") + if unrelease_return_type_loc_dest_id: + res["location_dest_id"] = unrelease_return_type_loc_dest_id + return res From d94c68482f334dab237822e3e51dabd98b629189 Mon Sep 17 00:00:00 2001 From: twalter-c2c Date: Mon, 18 Aug 2025 11:01:38 +0200 Subject: [PATCH 02/14] [IMP]stock_available_to_promise_release: rename Un Release to Unrelease --- .../views/stock_picking_views.xml | 2 +- .../wizards/stock_unrelease.py | 2 +- .../wizards/stock_unrelease_views.xml | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/stock_available_to_promise_release/views/stock_picking_views.xml b/stock_available_to_promise_release/views/stock_picking_views.xml index fc0decf357a..bb44d3b754c 100644 --- a/stock_available_to_promise_release/views/stock_picking_views.xml +++ b/stock_available_to_promise_release/views/stock_picking_views.xml @@ -46,7 +46,7 @@