From 124d83c33ecfad11236d676a48983b17720248e6 Mon Sep 17 00:00:00 2001 From: Denis Roussel Date: Mon, 26 Aug 2024 09:32:22 +0200 Subject: [PATCH 1/4] [IMP] stock_release_channel_shipment_advice_deliver: Allows to display pickings in confirm wizard In order to let user aware of remaining pickings when delivering, display them in the delivering wizard --- ...ck_release_channel_deliver_check_wizard.py | 21 ++++++++++++++- ...k_release_channel_deliver_check_wizard.xml | 27 ++++++++++++++++--- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/stock_release_channel_shipment_advice_deliver/wizards/stock_release_channel_deliver_check_wizard.py b/stock_release_channel_shipment_advice_deliver/wizards/stock_release_channel_deliver_check_wizard.py index 6879e718bb8..6fbc46fc6e8 100644 --- a/stock_release_channel_shipment_advice_deliver/wizards/stock_release_channel_deliver_check_wizard.py +++ b/stock_release_channel_shipment_advice_deliver/wizards/stock_release_channel_deliver_check_wizard.py @@ -1,7 +1,7 @@ # Copyright 2023 ACSONE SA/NV # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import fields, models +from odoo import api, fields, models class StockReleaseChannelDeliverCheckWizard(models.TransientModel): @@ -10,6 +10,25 @@ class StockReleaseChannelDeliverCheckWizard(models.TransientModel): _description = "stock release channel deliver check wizard" release_channel_id = fields.Many2one("stock.release.channel") + allowed_to_unrelease_picking_ids = fields.One2many( + comodel_name="stock.picking", + compute="_compute_allowed_to_unrelease_picking_ids", + string="Current pickings that will be unreleased", + ) + + @api.depends("release_channel_id") + def _compute_allowed_to_unrelease_picking_ids(self) -> None: + """ + Compute the pickings that are allowed to be unreleased. + This can show the user the possible ones that could be delivered. + """ + for wizard in self: + moves_to_unrelease = ( + wizard.release_channel_id._shipping_moves_to_unrelease() + ) + wizard.allowed_to_unrelease_picking_ids = moves_to_unrelease.filtered( + "unrelease_allowed" + ).picking_id def action_deliver(self): self.ensure_one() diff --git a/stock_release_channel_shipment_advice_deliver/wizards/stock_release_channel_deliver_check_wizard.xml b/stock_release_channel_shipment_advice_deliver/wizards/stock_release_channel_deliver_check_wizard.xml index 563206dd5d5..bd79c71aab8 100644 --- a/stock_release_channel_shipment_advice_deliver/wizards/stock_release_channel_deliver_check_wizard.xml +++ b/stock_release_channel_shipment_advice_deliver/wizards/stock_release_channel_deliver_check_wizard.xml @@ -12,11 +12,30 @@

- There are some preparations that have not been completed. - If you choose to proceed, these preparations will be unreleased.
- Are you sure you want to proceed with the delivery? + There are some preparations that have not been completed.
+ If you choose to proceed, these preparations will be unreleased and won't be delivered.

+ Are you sure you want to proceed with the delivery?

+ + + + + + + + + +