-
-
Notifications
You must be signed in to change notification settings - Fork 649
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] stock_picking_putaway_recompute
- Loading branch information
1 parent
afec509
commit e42d350
Showing
21 changed files
with
1,018 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
setup/stock_picking_putaway_recompute/odoo/addons/stock_picking_putaway_recompute
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 @@ | ||
../../../../stock_picking_putaway_recompute |
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,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
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,117 @@ | ||
=============================== | ||
Stock Picking Putaway Recompute | ||
=============================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:d732c5716c0c78265f37cdfbb2f846a45031a2dcb2792e8e3aca65a9df5c9ca3 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github | ||
:target: https://github.com/OCA/stock-logistics-workflow/tree/16.0/stock_picking_putaway_recompute | ||
:alt: OCA/stock-logistics-workflow | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-stock_picking_putaway_recompute | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-workflow&target_branch=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module will allow to recompute the destination locations from | ||
putaway rules on the picking operations side. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Use Cases / Context | ||
=================== | ||
|
||
As stock operations are computed at a certain moment of time, | ||
configuration can change and the computed destination locations for | ||
those operations (that are not done yet) are incoherent from those | ||
configurations changes. | ||
|
||
So, the aim of this module is to provide a way to recompute the | ||
destination locations without having to unreserve the picking (that | ||
unlock products for being reserved for another picking). | ||
|
||
Configuration | ||
============= | ||
|
||
- Enable Stock locations in Inventory > Configuration > Settings | ||
- In order to be able to recompute the putaways, you need to enable it | ||
on the picking type level. | ||
|
||
Usage | ||
===== | ||
|
||
- In a picking where the recompute operation is enabled (see | ||
Configuration), the recompute is available on picking level and on | ||
the detailed operations if enabled. | ||
- If a putaway rule has been changed after product reservation, click | ||
on the button 'Recompute putaways'. This will recompute the | ||
destination locations on all detailed operations that have no done | ||
quantity yet. | ||
- Moreover, the action is available on picking level and on detailed | ||
operation one too. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_picking_putaway_recompute%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
------- | ||
|
||
* ACSONE SA/NV | ||
|
||
Contributors | ||
------------ | ||
|
||
- Denis Roussel [email protected] | ||
|
||
Maintainers | ||
----------- | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
.. |maintainer-rousseldenis| image:: https://github.com/rousseldenis.png?size=40px | ||
:target: https://github.com/rousseldenis | ||
:alt: rousseldenis | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-rousseldenis| | ||
|
||
This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/16.0/stock_picking_putaway_recompute>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
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 @@ | ||
from . import models |
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,20 @@ | ||
# Copyright 2024 ACSONE SA/NV | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Stock Picking Putaway Recompute", | ||
"summary": """ | ||
This module allows to recompute the picking operations putaways if | ||
configurations have changed""", | ||
"version": "16.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "ACSONE SA/NV,Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/stock-logistics-workflow", | ||
"maintainers": ["rousseldenis"], | ||
"depends": ["stock"], | ||
"data": [ | ||
"views/stock_picking.xml", | ||
"views/stock_picking_type.xml", | ||
"views/stock_move_line.xml", | ||
], | ||
} |
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 @@ | ||
from . import stock_move_line, stock_picking, stock_picking_type |
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,48 @@ | ||
# Copyright 2024 ACSONE SA/NV | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from __future__ import annotations | ||
|
||
from typing_extensions import Self | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class StockMoveLine(models.Model): | ||
|
||
_inherit = "stock.move.line" | ||
|
||
can_recompute_putaways = fields.Boolean( | ||
compute="_compute_can_recompute_putaways", | ||
) | ||
|
||
@api.depends( | ||
"picking_type_id.allow_to_recompute_putaways", "picking_id.printed", "qty_done" | ||
) | ||
def _compute_can_recompute_putaways(self): | ||
can_recompute_lines = self._filtered_for_putaway_recompute() | ||
can_recompute_lines.can_recompute_putaways = True | ||
(self - can_recompute_lines).can_recompute_putaways = False | ||
|
||
def _filtered_for_putaway_recompute(self) -> Self: | ||
""" | ||
Recompute putaways on operations that: | ||
- have their picking type configured for that | ||
- have their picking not printed (started) | ||
- have their qty_done field != 0 | ||
""" | ||
return self.filtered( | ||
lambda line: line.picking_type_id.allow_to_recompute_putaways | ||
and not line.picking_id.printed | ||
and not line.qty_done | ||
) | ||
|
||
def _recompute_putaways(self) -> None: | ||
""" | ||
Launches the computation of putaways on operations that are | ||
allowed to. | ||
""" | ||
self._filtered_for_putaway_recompute()._apply_putaway_strategy() | ||
|
||
def action_recompute_putaways(self): | ||
self._recompute_putaways() | ||
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,38 @@ | ||
# Copyright 2024 ACSONE SA/NV | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from __future__ import annotations | ||
|
||
from typing_extensions import Self | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class StockPicking(models.Model): | ||
|
||
_inherit = "stock.picking" | ||
|
||
can_recompute_putaways = fields.Boolean( | ||
compute="_compute_can_recompute_putaways", | ||
help="Technical field in order to display the Recompute Putaways button.", | ||
) | ||
|
||
def action_recompute_putaways(self) -> dict: | ||
""" | ||
Launches the putaways recomputation on operations | ||
""" | ||
for picking in self: | ||
picking.move_line_ids._recompute_putaways() | ||
|
||
def _filtered_can_recompute_putaways(self) -> Self: | ||
""" | ||
Filter current recordset in order to get the pickings that can | ||
""" | ||
return self.filtered( | ||
lambda picking: picking.state == "assigned" and not picking.printed | ||
) | ||
|
||
@api.depends("state", "printed") | ||
def _compute_can_recompute_putaways(self): | ||
can_recompute_pickings = self._filtered_can_recompute_putaways() | ||
can_recompute_pickings.can_recompute_putaways = True | ||
(self - can_recompute_pickings).can_recompute_putaways = False |
14 changes: 14 additions & 0 deletions
14
stock_picking_putaway_recompute/models/stock_picking_type.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,14 @@ | ||
# Copyright 2024 ACSONE SA/NV | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class StockPickingType(models.Model): | ||
|
||
_inherit = "stock.picking.type" | ||
|
||
allow_to_recompute_putaways = fields.Boolean( | ||
help="Check this if you want to authorize putaways recomputations for the operations" | ||
"of this type." | ||
) |
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 @@ | ||
- Enable Stock locations in Inventory > Configuration > Settings | ||
- In order to be able to recompute the putaways, you need to enable it on | ||
the picking type level. |
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,7 @@ | ||
As stock operations are computed at a certain moment of time, configuration | ||
can change and the computed destination locations for those operations (that | ||
are not done yet) are incoherent from those configurations changes. | ||
|
||
So, the aim of this module is to provide a way to recompute the destination locations | ||
without having to unreserve the picking (that unlock products for being reserved for | ||
another picking). |
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 @@ | ||
- Denis Roussel <[email protected]> |
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,2 @@ | ||
This module will allow to recompute the destination locations from putaway rules | ||
on the picking operations side. |
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,7 @@ | ||
- In a picking where the recompute operation is enabled (see Configuration), | ||
the recompute is available on picking level and on the detailed operations if | ||
enabled. | ||
- If a putaway rule has been changed after product reservation, click on | ||
the button 'Recompute putaways'. This will recompute the destination locations | ||
on all detailed operations that have no done quantity yet. | ||
- Moreover, the action is available on picking level and on detailed operation one too. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.