Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,28 @@
<form string="Stock Release Channel Deliver Check">
<field name="release_channel_id" invisible="1" />
<p>
There are some preparations that have not been completed.
If you choose to proceed, these preparations will be unreleased.<br
/>
Are you sure you want to proceed with the delivery?
There are some preparations that have not been completed.<br />
If you choose to proceed, these preparations will be unreleased and won't be delivered or delivered partially.<br
/><br />
<b>Are you sure you want to proceed with the delivery?</b>
</p>
<field name="allowed_to_unrelease_picking_ids" nolabel="1">
<tree edit="false">
<field name="name" />
<field name="origin" />
<field name="partner_id" />
<field
name="state"
optional="show"
widget="badge"
decoration-danger="state=='cancel'"
decoration-info="state== 'assigned'"
decoration-muted="state == 'draft'"
decoration-success="state == 'done'"
decoration-warning="state not in ('draft','cancel','done','assigned')"
/>
</tree>
</field>
<footer>
<button
string="Cancel the deliver"
Expand Down
Loading