-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sale_stock_available_to_promise_release_block: add Unblock Release wi…
…zard This new wizard allows to give more options to the user regarding the unblocking process, like the scheduled date to set on unblocked moves, and re-assign automatically a stock operation on them (so they could be grouped together in the same transfer).
- Loading branch information
Showing
16 changed files
with
678 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
from . import models | ||
from . import wizards | ||
from .hooks import post_init_hook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright 2024 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) | ||
|
||
import logging | ||
|
||
from odoo import SUPERUSER_ID, api | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
def post_init_hook(cr, registry): | ||
_logger.info("Remove original 'Unblock Release' server action...") | ||
env = api.Environment(cr, SUPERUSER_ID, {}) | ||
action = env.ref( | ||
"stock_available_to_promise_release_block.action_stock_move_unblock_release", | ||
raise_if_not_found=False, | ||
) | ||
action.unlink() |
35 changes: 35 additions & 0 deletions
35
sale_stock_available_to_promise_release_block/migrations/16.0.1.1.0/pre-migrate.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright 2024 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) | ||
import logging | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
def migrate(cr, version): | ||
if not version: | ||
return | ||
remove_unblock_release_ir_action_server(cr) | ||
|
||
|
||
def remove_unblock_release_ir_action_server(cr): | ||
# The same XML-ID will be used by a new window action to open a wizard | ||
_logger.info("Remove action 'action_sale_order_line_unblock_release'") | ||
queries = [ | ||
""" | ||
DELETE FROM ir_act_server | ||
WHERE id IN ( | ||
SELECT res_id | ||
FROM ir_model_data | ||
WHERE module='sale_stock_available_to_promise_release_block' | ||
AND name='action_sale_order_line_unblock_release' | ||
AND model='ir.actions.server' | ||
); | ||
""", | ||
""" | ||
DELETE FROM ir_model_data | ||
WHERE module='sale_stock_available_to_promise_release_block' | ||
AND name='action_sale_order_line_unblock_release'; | ||
""", | ||
] | ||
for query in queries: | ||
cr.execute(query) |
1 change: 1 addition & 0 deletions
1
sale_stock_available_to_promise_release_block/models/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from . import stock_move | ||
from . import stock_rule | ||
from . import sale_order | ||
from . import sale_order_line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
sale_stock_available_to_promise_release_block/models/stock_move.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2024 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class StockMove(models.Model): | ||
_inherit = "stock.move" | ||
|
||
unblocked_by_order_id = fields.Many2one( | ||
comodel_name="sale.order", | ||
ondelete="set null", | ||
string="Unblocked by order", | ||
readonly=True, | ||
index=True, | ||
) |
13 changes: 12 additions & 1 deletion
13
sale_stock_available_to_promise_release_block/readme/DESCRIPTION.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,12 @@ | ||
Block release of deliveries from sale orders. | ||
Block and unblock release of deliveries from sale orders. | ||
|
||
Release of deliveries can be blocked right after the sale order confirmation. | ||
|
||
When encoding a new order sharing the same delivery address, the user can | ||
list the existing blocked deliveries (backorders) and plan to unblock them | ||
when this new order is confirmed, making the existing deliveries and the new | ||
ones sharing the same scheduled dates and deadlines. | ||
|
||
As a side-effect, this will leverage the module | ||
`stock_picking_group_by_partner_by_carrier_by_date` if this one is installed, | ||
by grouping all delivery lines within the same delivery order. |
3 changes: 3 additions & 0 deletions
3
sale_stock_available_to_promise_release_block/security/ir.model.access.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_unblock_release_sale,access.unblock.release,model_unblock_release,sales_team.group_sale_salesman,1,1,1,0 | ||
access_unblock_release_stock,access.unblock.release,model_unblock_release,stock.group_stock_user,1,1,1,0 |
Oops, something went wrong.