-
-
Notifications
You must be signed in to change notification settings - Fork 210
[16.0][ADD] shopfloor_reception_putinpack_restriction: allow to restrict the use of packages in reception #1163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
OCA-git-bot
merged 3 commits into
OCA:16.0
from
acsone:16.0-add-shopfloor_reception_putinpack_restriction
May 8, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
d2fa788
[REF] shopfloor_reception: add `_set_quantity__by_new_package` so tha…
nicolas-delbovier-acsone 3a8b2ae
[ADD] shopfloor_reception_putinpack_restriction: allow to restrict th…
nicolas-delbovier-acsone 453bf13
[IMP] shopfloor_reception_mobile: hide process buttons depending on p…
nicolas-delbovier-acsone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
...oor_reception_putinpack_restriction/odoo/addons/shopfloor_reception_putinpack_restriction
This file contains hidden or 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 @@ | ||
| ../../../../shopfloor_reception_putinpack_restriction |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,105 @@ | ||
| .. image:: https://odoo-community.org/readme-banner-image | ||
| :target: https://odoo-community.org/get-involved?utm_source=readme | ||
| :alt: Odoo Community Association | ||
|
|
||
| ========================================= | ||
| Shopfloor Reception Putinpack Restriction | ||
| ========================================= | ||
|
|
||
| .. | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! This file is generated by oca-gen-addon-readme !! | ||
| !! changes will be overwritten. !! | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! source digest: sha256:71a2246186c7fd5828b67a511f45c844b51bd1124ca43605ea0531e073a117db | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
|
||
| .. |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/license-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%2Fwms-lightgray.png?logo=github | ||
| :target: https://github.com/OCA/wms/tree/16.0/shopfloor_reception_putinpack_restriction | ||
| :alt: OCA/wms | ||
| .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
| :target: https://translation.odoo-community.org/projects/wms-16-0/wms-16-0-shopfloor_reception_putinpack_restriction | ||
| :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/wms&target_branch=16.0 | ||
| :alt: Try me on Runboat | ||
|
|
||
| |badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
|
||
| This module allows administrators to simplify the shopfloor user | ||
| interface by hiding package-related actions during the reception | ||
| scenario. | ||
|
|
||
| **Table of contents** | ||
|
|
||
| .. contents:: | ||
| :local: | ||
|
|
||
| Use Cases / Context | ||
| =================== | ||
|
|
||
| It is specifically designed for warehouses that want to control if goods | ||
| are put in a pack or cannot be put in a pack, here at the end of the | ||
| reception. This prevents warehouse operators from freely choosing by | ||
| hiding forbidden buttons. | ||
|
|
||
| Configuration | ||
| ============= | ||
|
|
||
| You can configure on the picking type if you want to use packages or | ||
| not. | ||
|
|
||
| Bug Tracker | ||
| =========== | ||
|
|
||
| Bugs are tracked on `GitHub Issues <https://github.com/OCA/wms/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/wms/issues/new?body=module:%20shopfloor_reception_putinpack_restriction%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 | ||
| * BCIM | ||
|
|
||
| Contributors | ||
| ------------ | ||
|
|
||
| - Nicolas Delbovier nicolas.delbovier@acsone.eu (https://www.acsone.eu/) | ||
| - Jacques-Etienne Baudoux (BCIM) je@bcim.be | ||
|
|
||
| Other credits | ||
| ------------- | ||
|
|
||
| The development of this module has been financially supported by: | ||
|
|
||
| - Alcyon Belux | ||
|
|
||
| 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. | ||
|
|
||
| This module is part of the `OCA/wms <https://github.com/OCA/wms/tree/16.0/shopfloor_reception_putinpack_restriction>`_ project on GitHub. | ||
|
|
||
| You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains hidden or 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 @@ | ||
| from . import services | ||
| from . import actions |
This file contains hidden or 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,17 @@ | ||
| # Copyright 2026 ACSONE SA/NV | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| { | ||
| "name": "Shopfloor Reception Putinpack Restriction", | ||
| "summary": """Restrict the use of packages in shopfloor reception""", | ||
| "version": "16.0.1.0.0", | ||
| "license": "AGPL-3", | ||
| "author": "ACSONE SA/NV,BCIM,Odoo Community Association (OCA)", | ||
| "website": "https://github.com/OCA/wms", | ||
| "depends": [ | ||
| "shopfloor_reception", | ||
| "stock_picking_putinpack_restriction", | ||
| ], | ||
| "data": [], | ||
| "demo": [], | ||
| } |
This file contains hidden or 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 message |
31 changes: 31 additions & 0 deletions
31
shopfloor_reception_putinpack_restriction/actions/message.py
This file contains hidden or 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,31 @@ | ||
| # Copyright 2026 ACSONE SA/NV (https://www.acsone.eu) | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
| import logging | ||
|
|
||
| from odoo import _ | ||
|
|
||
| from odoo.addons.component.core import Component | ||
|
|
||
| _logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| class MessageAction(Component): | ||
| _inherit = "shopfloor.message.action" | ||
|
|
||
| def package_not_allowed_for_operation(self, picking): | ||
| return { | ||
| "message_type": "error", | ||
| "body": _( | ||
| "The operation '%(picking_type)s' does not allow the use of package.", | ||
| picking_type=picking.picking_type_id.display_name, | ||
| ), | ||
| } | ||
|
|
||
| def package_required_for_operation(self, picking): | ||
| return { | ||
| "message_type": "error", | ||
| "body": _( | ||
| "The operation '%(picking_type)s' requires a package.", | ||
| picking_type=picking.picking_type_id.display_name, | ||
| ), | ||
| } |
This file contains hidden or 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 @@ | ||
| You can configure on the picking type if you want to use packages or not. |
This file contains hidden or 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 @@ | ||
| It is specifically designed for warehouses that want to control if goods are put in a pack or cannot be put in a pack, here at the end of the reception. This prevents warehouse operators from freely choosing by hiding forbidden buttons. |
2 changes: 2 additions & 0 deletions
2
shopfloor_reception_putinpack_restriction/readme/CONTRIBUTORS.md
This file contains hidden or 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 @@ | ||
| - Nicolas Delbovier <nicolas.delbovier@acsone.eu> (https://www.acsone.eu/) | ||
| - Jacques-Etienne Baudoux (BCIM) <je@bcim.be> |
This file contains hidden or 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 @@ | ||
| The development of this module has been financially supported by: | ||
|
|
||
| - Alcyon Belux |
1 change: 1 addition & 0 deletions
1
shopfloor_reception_putinpack_restriction/readme/DESCRIPTION.md
This file contains hidden or 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 @@ | ||
| This module allows administrators to simplify the shopfloor user interface by hiding package-related actions during the reception scenario. |
This file contains hidden or 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 reception |
125 changes: 125 additions & 0 deletions
125
shopfloor_reception_putinpack_restriction/services/reception.py
This file contains hidden or 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,125 @@ | ||
| # Copyright 2026 ACSONE SA/NV | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) | ||
|
|
||
|
|
||
| from datetime import timezone | ||
|
|
||
| from odoo.addons.component.core import Component | ||
|
|
||
| UTC = timezone.utc | ||
|
|
||
|
|
||
| class Reception(Component): | ||
| _inherit = "shopfloor.reception" | ||
|
|
||
| def _check_picking_putinpack_restriction(self, picking, with_pack: bool): | ||
| if picking.put_in_pack_restriction == "no_package" and with_pack: | ||
| return self.msg_store.package_not_allowed_for_operation(picking) | ||
| if picking.put_in_pack_restriction == "with_package" and not with_pack: | ||
| return self.msg_store.package_required_for_operation(picking) | ||
|
|
||
| def process_with_existing_pack(self, picking_id, selected_line_id, quantity): | ||
| picking = self.env["stock.picking"].browse(picking_id) | ||
| selected_line = self.env["stock.move.line"].browse(selected_line_id) | ||
|
|
||
| if message := self._check_picking_putinpack_restriction( | ||
| picking, with_pack=True | ||
| ): | ||
| return self._response_for_set_quantity( | ||
| picking, selected_line, message=message | ||
| ) | ||
| res = super().process_with_existing_pack(picking_id, selected_line_id, quantity) | ||
|
|
||
| return res | ||
|
|
||
| def process_with_new_pack(self, picking_id, selected_line_id, quantity): | ||
| picking = self.env["stock.picking"].browse(picking_id) | ||
| selected_line = self.env["stock.move.line"].browse(selected_line_id) | ||
|
|
||
| if message := self._check_picking_putinpack_restriction( | ||
| picking, with_pack=True | ||
| ): | ||
| return self._response_for_set_quantity( | ||
| picking, selected_line, message=message | ||
| ) | ||
| res = super().process_with_new_pack(picking_id, selected_line_id, quantity) | ||
|
|
||
| return res | ||
|
|
||
| def process_without_pack(self, picking_id, selected_line_id, quantity): | ||
| picking = self.env["stock.picking"].browse(picking_id) | ||
| selected_line = self.env["stock.move.line"].browse(selected_line_id) | ||
|
|
||
| if message := self._check_picking_putinpack_restriction( | ||
| picking, with_pack=False | ||
| ): | ||
| return self._response_for_set_quantity( | ||
| picking, selected_line, message=message | ||
| ) | ||
| res = super().process_without_pack(picking_id, selected_line_id, quantity) | ||
|
|
||
| return res | ||
|
|
||
| def _set_quantity__by_package(self, picking, selected_line, package): | ||
| if message := self._check_picking_putinpack_restriction( | ||
| picking, with_pack=True | ||
| ): | ||
| return self._response_for_set_quantity( | ||
| picking, selected_line, message=message | ||
| ) | ||
| return super()._set_quantity__by_package(picking, selected_line, package) | ||
|
|
||
| def _set_quantity__by_new_package( | ||
| self, picking, selected_line, barcode: str, confirmation: str | ||
| ): | ||
| if message := self._check_picking_putinpack_restriction( | ||
| picking, with_pack=True | ||
| ): | ||
| return self._response_for_set_quantity( | ||
| picking, selected_line, message=message | ||
| ) | ||
| return super()._set_quantity__by_new_package( | ||
| picking, selected_line, barcode, confirmation | ||
| ) | ||
|
|
||
| def _response_for_set_quantity( | ||
| self, picking, line, message=None, asking_confirmation=None | ||
| ): | ||
| pip_restriction = picking.put_in_pack_restriction | ||
|
|
||
| if pip_restriction == "no_package" and asking_confirmation: | ||
| return self._response_for_set_quantity( | ||
| picking, | ||
| line, | ||
| message=self.msg_store.package_not_allowed_for_operation(picking), | ||
| ) | ||
|
|
||
| res = super()._response_for_set_quantity( | ||
| picking, line, message, asking_confirmation | ||
| ) | ||
| if pip_restriction: | ||
| res["data"]["set_quantity"]["put_in_pack_restriction"] = pip_restriction | ||
| return res | ||
|
|
||
|
|
||
| class ShopfloorReceptionValidatorResponse(Component): | ||
| _inherit = "shopfloor.reception.validator.response" | ||
|
|
||
| @property | ||
| def _schema_set_quantity(self): | ||
| res = super()._schema_set_quantity | ||
| picking_type_model = self.env["stock.picking.type"] | ||
| selection_put_in_pack_restriction_values = [ | ||
| x[0] for x in picking_type_model._selection_put_in_pack_restriction() | ||
| ] | ||
| res.update( | ||
| { | ||
| "put_in_pack_restriction": { | ||
| "type": "string", | ||
| "nullable": True, | ||
| "required": False, | ||
| "allowed": selection_put_in_pack_restriction_values, | ||
| }, | ||
| } | ||
| ) | ||
| return res | ||
Binary file added
BIN
+9.23 KB
shopfloor_reception_putinpack_restriction/static/description/icon.png
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.