diff --git a/setup/shopfloor_reception_backorder_reason/odoo/addons/shopfloor_reception_backorder_reason b/setup/shopfloor_reception_backorder_reason/odoo/addons/shopfloor_reception_backorder_reason new file mode 120000 index 0000000000..6573c38d88 --- /dev/null +++ b/setup/shopfloor_reception_backorder_reason/odoo/addons/shopfloor_reception_backorder_reason @@ -0,0 +1 @@ +../../../../shopfloor_reception_backorder_reason \ No newline at end of file diff --git a/setup/shopfloor_reception_backorder_reason/setup.py b/setup/shopfloor_reception_backorder_reason/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/shopfloor_reception_backorder_reason/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/shopfloor_reception_backorder_reason_mobile/odoo/addons/shopfloor_reception_backorder_reason_mobile b/setup/shopfloor_reception_backorder_reason_mobile/odoo/addons/shopfloor_reception_backorder_reason_mobile new file mode 120000 index 0000000000..46f5a980a9 --- /dev/null +++ b/setup/shopfloor_reception_backorder_reason_mobile/odoo/addons/shopfloor_reception_backorder_reason_mobile @@ -0,0 +1 @@ +../../../../shopfloor_reception_backorder_reason_mobile \ No newline at end of file diff --git a/setup/shopfloor_reception_backorder_reason_mobile/setup.py b/setup/shopfloor_reception_backorder_reason_mobile/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/shopfloor_reception_backorder_reason_mobile/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/shopfloor_reception_backorder_reason/README.rst b/shopfloor_reception_backorder_reason/README.rst new file mode 100644 index 0000000000..afba9db2ae --- /dev/null +++ b/shopfloor_reception_backorder_reason/README.rst @@ -0,0 +1,84 @@ +==================================== +Shopfloor Reception Backorder Reason +==================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:891c9573ba69156492ac5fbb376cec069446c36501b3af61225c68759a055a3f + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fwms-lightgray.png?logo=github + :target: https://github.com/OCA/wms/tree/16.0/shopfloor_reception_backorder_reason + :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_backorder_reason + :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 to manage backorder reasons on shopfloor level. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* ACSONE SA/NV + +Contributors +------------ + +- Denis Roussel denis.roussel@acsone.eu + +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 `__: + +|maintainer-rousseldenis| + +This module is part of the `OCA/wms `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/shopfloor_reception_backorder_reason/__init__.py b/shopfloor_reception_backorder_reason/__init__.py new file mode 100644 index 0000000000..8f275c2963 --- /dev/null +++ b/shopfloor_reception_backorder_reason/__init__.py @@ -0,0 +1,2 @@ +from . import services +from . import actions diff --git a/shopfloor_reception_backorder_reason/__manifest__.py b/shopfloor_reception_backorder_reason/__manifest__.py new file mode 100644 index 0000000000..71294bfb4c --- /dev/null +++ b/shopfloor_reception_backorder_reason/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright 2025 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Shopfloor Reception Backorder Reason", + "summary": """This module allows to select a backorder reason if there is one""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "maintainers": ["rousseldenis"], + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/wms", + "depends": [ + "shopfloor_reception", + "stock_picking_backorder_reason", + ], +} diff --git a/shopfloor_reception_backorder_reason/actions/__init__.py b/shopfloor_reception_backorder_reason/actions/__init__.py new file mode 100644 index 0000000000..21b410259e --- /dev/null +++ b/shopfloor_reception_backorder_reason/actions/__init__.py @@ -0,0 +1 @@ +from . import data diff --git a/shopfloor_reception_backorder_reason/actions/data.py b/shopfloor_reception_backorder_reason/actions/data.py new file mode 100644 index 0000000000..ffd1866c92 --- /dev/null +++ b/shopfloor_reception_backorder_reason/actions/data.py @@ -0,0 +1,45 @@ +# Copyright 2025 ACSONE SA/NV (https://acsone.eu) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) + + +from odoo.addons.component.core import Component +from odoo.addons.shopfloor_base.utils import ensure_model + + +class DataAction(Component): + _inherit = "shopfloor.data.action" + + @property + def _backorder_reason_parser(self, **kw): + return [ + "id", + "name", + ( + "backorder_action_to_do", + lambda rec, fname: { + "action": rec.backorder_action_to_do, + "label": "".join( + [ + field_value[1] + for field_value in rec._fields[ + "backorder_action_to_do" + ]._description_selection(rec.env) + if field_value[0] == rec.backorder_action_to_do + ] + ), + }, + ), + ] + + def _get_backorder_reason_parser(self, record, **kw): + parser = self._backorder_reason_parser + return parser + + @ensure_model("stock.backorder.reason") + def backorder_reason(self, record, **kw): + return self._jsonify( + record, self._get_backorder_reason_parser(record, **kw), **kw + ) + + def backorder_reasons(self, record, **kw): + return self.backorder_reason(record, multi=True) diff --git a/shopfloor_reception_backorder_reason/readme/CONTRIBUTORS.md b/shopfloor_reception_backorder_reason/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..4e7e684726 --- /dev/null +++ b/shopfloor_reception_backorder_reason/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Denis Roussel diff --git a/shopfloor_reception_backorder_reason/readme/DESCRIPTION.md b/shopfloor_reception_backorder_reason/readme/DESCRIPTION.md new file mode 100644 index 0000000000..04f4aba80b --- /dev/null +++ b/shopfloor_reception_backorder_reason/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module allows to manage backorder reasons on shopfloor level. diff --git a/shopfloor_reception_backorder_reason/services/__init__.py b/shopfloor_reception_backorder_reason/services/__init__.py new file mode 100644 index 0000000000..aa19bba8ce --- /dev/null +++ b/shopfloor_reception_backorder_reason/services/__init__.py @@ -0,0 +1 @@ +from . import reception diff --git a/shopfloor_reception_backorder_reason/services/reception.py b/shopfloor_reception_backorder_reason/services/reception.py new file mode 100644 index 0000000000..5c6c177739 --- /dev/null +++ b/shopfloor_reception_backorder_reason/services/reception.py @@ -0,0 +1,131 @@ +# Copyright 2025 ACSONE SA/NV (https://acsone.eu) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) + + +from odoo.fields import Command + +from odoo.addons.component.core import Component + + +class Reception(Component): + + _inherit = "shopfloor.reception" + + def _data_for_backorder_reasons(self, reasons): + return self.data.backorder_reasons(reasons) + + def _response_for_choose_backorder_reason(self, picking, message=None): + + reasons = self.env["stock.backorder.reason"].search([]) + data = { + "picking": self._data_for_stock_picking(picking, with_lines=False), + "backorder_reasons": [ + result for result in self._data_for_backorder_reasons(reasons) + ], + } + return self._response( + next_state="choose_backorder_reason", data=data, message=message + ) + + def done_action(self, picking_id, confirmation=False): + """ + Override here the `done_action` to let the user decide + about the backorder reason. + """ + picking = self.env["stock.picking"].browse(picking_id) + action = picking.with_context( + button_validate_picking_ids=picking.ids + )._pre_action_done_hook() + if ( + isinstance(action, dict) + and action.get("res_model") == "stock.backorder.reason.choice" + ): + return self._response_for_choose_backorder_reason(picking) + if isinstance(action, bool) and action and picking.state == "done": + return self._response_for_select_document( + message=self.msg_store.transfer_done_success(picking) + ) + return super().done_action(picking_id, confirmation=confirmation) + + def choose_backorder_reason(self, picking_id, reason_id): + picking = self.env["stock.picking"].browse(picking_id) + message = self._check_picking_processible(picking) + if message: + return self._response_for_select_move(picking, message=message) + # Check if reason choice is still possible + action = picking._pre_action_done_hook() + if action.get("res_model") == "stock.backorder.reason.choice": + result = ( + self.env["stock.backorder.reason.choice"] + .with_context(button_validate_picking_ids=picking.ids) + .new( + { + "picking_ids": [Command.set([picking_id])], + "choice_line_ids": [Command.create({"picking_id": picking_id})], + "reason_id": reason_id, + } + ) + .apply() + ) + if result: + return self._response_for_select_document( + message=self.msg_store.transfer_done_success(picking) + ) + if picking.state == "done": + # Backorder has been transparent cancelled with no reason choice + return self._response_for_select_document( + message=self.msg_store.transfer_done_success(picking) + ) + return super().done_action(picking_id, confirmation=None) + + +class ShopfloorReceptionValidator(Component): + + _inherit = "shopfloor.reception.validator" + + def choose_backorder_reason(self): + return { + "picking_id": {"required": True, "type": "integer"}, + "reason_id": {"required": True, "type": "integer"}, + } + + +class ShopfloorReceptionValidatorResponse(Component): + + _inherit = "shopfloor.reception.validator.response" + + # STATES + + def _states(self): + states = super()._states() + states.update({"choose_backorder_reason": self._schema_choose_backorder_reason}) + + return states + + @property + def _schema_choose_backorder_reason(self): + return { + "picking": {"type": "dict", "schema": self.schemas.picking()}, + "backorder_reasons": self.schemas._schema_list_of( + self.schemas.backorder_reason(), required=True + ), + } + + def choose_backorder_reason(self): + return self._response_schema(next_states={"confirm_done"}) + + def _done_next_states(self): + next_states = super()._done_next_states() + next_states.update({"choose_backorder_reason"}) + return next_states + + +class ShopfloorSchemaAction(Component): + _inherit = "shopfloor.schema.action" + + def backorder_reason(self): + return { + "id": {"required": True, "type": "integer"}, + "name": {"type": "string", "nullable": False, "required": True}, + "backorder_action_to_do": {"type": "dict"}, + } diff --git a/shopfloor_reception_backorder_reason/static/description/icon.png b/shopfloor_reception_backorder_reason/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/shopfloor_reception_backorder_reason/static/description/icon.png differ diff --git a/shopfloor_reception_backorder_reason/static/description/index.html b/shopfloor_reception_backorder_reason/static/description/index.html new file mode 100644 index 0000000000..41c50bdb10 --- /dev/null +++ b/shopfloor_reception_backorder_reason/static/description/index.html @@ -0,0 +1,425 @@ + + + + + +Shopfloor Reception Backorder Reason + + + +
+

Shopfloor Reception Backorder Reason

+ + +

Beta License: AGPL-3 OCA/wms Translate me on Weblate Try me on Runboat

+

This module allows to manage backorder reasons on shopfloor level.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • ACSONE SA/NV
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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.

+

Current maintainer:

+

rousseldenis

+

This module is part of the OCA/wms project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/shopfloor_reception_backorder_reason/tests/test_reception_done_backorder_reason.py b/shopfloor_reception_backorder_reason/tests/test_reception_done_backorder_reason.py new file mode 100644 index 0000000000..d74af7639b --- /dev/null +++ b/shopfloor_reception_backorder_reason/tests/test_reception_done_backorder_reason.py @@ -0,0 +1,192 @@ +# Copyright 2025 ACSONE SA/NV (https://acsone.eu) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo.addons.shopfloor_reception.tests.common import CommonCase + + +class TestReceptionBackorderReason(CommonCase): + def _data_for_backorder_reasons(self, reasons): + return self.data.backorder_reasons(reasons) + + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.reason_urgent = cls.env.ref( + "stock_picking_backorder_reason.stock_backorder_reason_urgent" + ) + cls.reason_missing = cls.env.ref( + "stock_picking_backorder_reason.stock_backorder_reason_missing" + ) + cls.reason_never = cls.env.ref( + "stock_picking_backorder_reason.stock_backorder_reason_never" + ) + + # Create a special Reception picking type (to avoid noise data) + cls.in_type = ( + cls.env["stock.picking.type"] + .sudo() + .create( + { + "name": "Receptions for Reasons", + "default_location_src_id": cls.env.ref( + "stock.stock_location_suppliers" + ).id, + "default_location_dest_id": cls.wh.lot_stock_id.id, + "sequence_code": "REC-BACK", + "backorder_reason": True, + "backorder_reason_purchase": True, + } + ) + ) + cls.reasons = cls.env["stock.backorder.reason"].search([]) + + def test_set_done_backorder_urgent(self): + self.menu.sudo().picking_type_ids = self.in_type + picking = self._create_picking(picking_type=self.in_type) + picking.move_line_ids.write({"qty_done": 5.0, "shopfloor_checkout_done": True}) + + response = self.service.dispatch( + "done_action", params={"picking_id": picking.id} + ) + # User is asked to confirm the action + self.assert_response( + response, + next_state="choose_backorder_reason", + data={ + "backorder_reasons": self._data_for_backorder_reasons(self.reasons), + "picking": self._data_for_picking(picking), + }, + message=None, + ) + response = self.service.dispatch( + "choose_backorder_reason", + params={ + "picking_id": picking.id, + "reason_id": self.reason_urgent.id, + }, + ) + picking_name = picking.name + self.assert_response( + response, + next_state="select_document", + data={"pickings": self._data_for_pickings(picking.backorder_ids)}, + message={ + "body": f"Transfer {picking_name} done", + "message_type": "success", + }, + ) + self.assertEqual(picking.state, "done") + + def test_set_done_backorder_missing(self): + self.menu.sudo().picking_type_ids = self.in_type + picking = self._create_picking(picking_type=self.in_type) + picking.partner_id.sudo().purchase_reason_backorder_strategy = "cancel" + picking.move_line_ids.write({"qty_done": 5.0, "shopfloor_checkout_done": True}) + + response = self.service.dispatch( + "done_action", params={"picking_id": picking.id} + ) + # User is asked to confirm the action + self.assert_response( + response, + next_state="choose_backorder_reason", + data={ + "backorder_reasons": self._data_for_backorder_reasons(self.reasons), + "picking": self._data_for_picking(picking), + }, + message=None, + ) + response = self.service.dispatch( + "choose_backorder_reason", + params={ + "picking_id": picking.id, + "reason_id": self.reason_missing.id, + }, + ) + picking_name = picking.name + self.assert_response( + response, + next_state="select_document", + data={"pickings": []}, + message={ + "body": f"Transfer {picking_name} done", + "message_type": "success", + }, + ) + self.assertEqual(picking.state, "done") + + def test_set_done_backorder_never(self): + self.menu.sudo().picking_type_ids = self.in_type + picking = self._create_picking(picking_type=self.in_type) + picking.partner_id.sudo().purchase_reason_backorder_strategy = "create" + picking.move_line_ids.write({"qty_done": 5.0, "shopfloor_checkout_done": True}) + + response = self.service.dispatch( + "done_action", params={"picking_id": picking.id} + ) + # User is asked to confirm the action + self.assert_response( + response, + next_state="choose_backorder_reason", + data={ + "backorder_reasons": self._data_for_backorder_reasons(self.reasons), + "picking": self._data_for_picking(picking), + }, + message=None, + ) + response = self.service.dispatch( + "choose_backorder_reason", + params={ + "picking_id": picking.id, + "reason_id": self.reason_never.id, + }, + ) + picking_name = picking.name + self.assert_response( + response, + next_state="select_document", + data={"pickings": []}, + message={ + "body": f"Transfer {picking_name} done", + "message_type": "success", + }, + ) + self.assertEqual(picking.state, "done") + + def test_set_done_backorder_transparent_cancel(self): + self.menu.sudo().picking_type_ids = self.in_type + picking = self._create_picking(picking_type=self.in_type) + self.in_type.sudo().backorder_reason_transparent_cancel = True + picking.partner_id.sudo().purchase_reason_backorder_strategy = "cancel" + picking.move_line_ids.write({"qty_done": 5.0, "shopfloor_checkout_done": True}) + + response = self.service.dispatch( + "done_action", params={"picking_id": picking.id} + ) + picking_name = picking.name + self.assert_response( + response, + next_state="select_document", + data={"pickings": []}, + message={ + "body": f"Transfer {picking_name} done", + "message_type": "success", + }, + ) + self.assertEqual(picking.state, "done") + self.assertFalse(picking.backorder_ids) + + def test_set_done_backorder_urgent_already_done(self): + self.menu.sudo().picking_type_ids = self.in_type + picking = self._create_picking(picking_type=self.in_type) + picking.move_line_ids.write({"qty_done": 5.0, "shopfloor_checkout_done": True}) + + picking._action_done() + response = self.service.dispatch( + "done_action", params={"picking_id": picking.id} + ) + self.assert_response( + response, + next_state="select_move", + data={"picking": self._data_for_picking_with_moves(picking)}, + message={"body": "Operation already processed.", "message_type": "info"}, + ) diff --git a/shopfloor_reception_backorder_reason_mobile/README.rst b/shopfloor_reception_backorder_reason_mobile/README.rst new file mode 100644 index 0000000000..0afd3abd3b --- /dev/null +++ b/shopfloor_reception_backorder_reason_mobile/README.rst @@ -0,0 +1,85 @@ +=========================================== +Shopfloor reception backorder reason mobile +=========================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:b879beedb5cce9459631565e96ed0249b6be452e4fd66b2f07c811af8649bfab + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fwms-lightgray.png?logo=github + :target: https://github.com/OCA/wms/tree/16.0/shopfloor_reception_backorder_reason_mobile + :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_backorder_reason_mobile + :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 to implement client behaviour for backorder +reason flows in shopfloor reception scenario. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* ACSONE SA/NV + +Contributors +~~~~~~~~~~~~ + +- Denis Roussel + +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 `__: + +|maintainer-rousseldenis| + +This module is part of the `OCA/wms `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/shopfloor_reception_backorder_reason_mobile/__init__.py b/shopfloor_reception_backorder_reason_mobile/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/shopfloor_reception_backorder_reason_mobile/__manifest__.py b/shopfloor_reception_backorder_reason_mobile/__manifest__.py new file mode 100644 index 0000000000..6bb5df3007 --- /dev/null +++ b/shopfloor_reception_backorder_reason_mobile/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2025 Camptocamp SA (https://acsone.eu) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +{ + "name": "Shopfloor reception backorder reason mobile", + "summary": "Scenario for backorder reasons during receptions", + "version": "16.0.1.0.0", + "depends": ["shopfloor_reception_mobile", "shopfloor_reception_backorder_reason"], + "author": "ACSONE SA/NV, Odoo Community Association (OCA)", + "maintainers": ["rousseldenis"], + "website": "https://github.com/OCA/wms", + "category": "Warehouse Management", + "license": "AGPL-3", + "installable": True, + "data": ["templates/assets.xml"], +} diff --git a/shopfloor_reception_backorder_reason_mobile/readme/CONTRIBUTORS.rst b/shopfloor_reception_backorder_reason_mobile/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..4e7e684726 --- /dev/null +++ b/shopfloor_reception_backorder_reason_mobile/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +- Denis Roussel diff --git a/shopfloor_reception_backorder_reason_mobile/readme/DESCRIPTION.rst b/shopfloor_reception_backorder_reason_mobile/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..a9ba691472 --- /dev/null +++ b/shopfloor_reception_backorder_reason_mobile/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module allows to implement client behaviour for backorder +reason flows in shopfloor reception scenario. diff --git a/shopfloor_reception_backorder_reason_mobile/static/description/icon.png b/shopfloor_reception_backorder_reason_mobile/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/shopfloor_reception_backorder_reason_mobile/static/description/icon.png differ diff --git a/shopfloor_reception_backorder_reason_mobile/static/description/index.html b/shopfloor_reception_backorder_reason_mobile/static/description/index.html new file mode 100644 index 0000000000..f1839ded53 --- /dev/null +++ b/shopfloor_reception_backorder_reason_mobile/static/description/index.html @@ -0,0 +1,426 @@ + + + + + +Shopfloor reception backorder reason mobile + + + +
+

Shopfloor reception backorder reason mobile

+ + +

Beta License: AGPL-3 OCA/wms Translate me on Weblate Try me on Runboat

+

This module allows to implement client behaviour for backorder +reason flows in shopfloor reception scenario.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • ACSONE SA/NV
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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.

+

Current maintainer:

+

rousseldenis

+

This module is part of the OCA/wms project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/shopfloor_reception_backorder_reason_mobile/static/src/scenario/reception.js b/shopfloor_reception_backorder_reason_mobile/static/src/scenario/reception.js new file mode 100644 index 0000000000..d0802ed50c --- /dev/null +++ b/shopfloor_reception_backorder_reason_mobile/static/src/scenario/reception.js @@ -0,0 +1,80 @@ +/** + * Copyright 2025 ACSONE SA/NV (https://acsone.eu) + * License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + */ + +import {process_registry} from "/shopfloor_mobile_base/static/wms/src/services/process_registry.js"; + +const ReceptionScenario = process_registry.get("reception"); +// const _get_states = ReceptionScenario.component.methods._get_states; +const data_result_method = ReceptionScenario.component.data; + +// Get the original template of the reception scenario +let template = ReceptionScenario.component.template; +ReceptionScenario.component.template = template.replace( + "", + ` +
+ +
+ + + + + +
+
+ +` +); + +ReceptionScenario.component.methods.backorder_reason_fields = function () { + return [ + { + path: "backorder_action_to_do.label", + label: "Action", + }, + ]; +}; + +ReceptionScenario.component.methods.manual_select_options_for_choose_backorder_reason = + function () { + return { + list_item_options: { + key_title: "name", + loud_title: true, + fields: this.backorder_reason_fields(), + }, + }; + }; + +let data = function () { + // we must bin the original method to this to put it into + // the object context + let result = data_result_method.bind(this)(); + + result.states.choose_backorder_reason = { + display_info: { + title: "Choose Backorder Reason", + }, + events: { + go_back: "on_back", + }, + on_select: (selected) => { + this.wait_call( + this.odoo.call("choose_backorder_reason", { + picking_id: this.state.data.picking.id, + reason_id: selected.id, + }) + ); + }, + }; + return result; +}; + +ReceptionScenario.component.data = data; diff --git a/shopfloor_reception_backorder_reason_mobile/templates/assets.xml b/shopfloor_reception_backorder_reason_mobile/templates/assets.xml new file mode 100644 index 0000000000..824340a295 --- /dev/null +++ b/shopfloor_reception_backorder_reason_mobile/templates/assets.xml @@ -0,0 +1,27 @@ + + + + + + diff --git a/test-requirements.txt b/test-requirements.txt index 689482e20d..fd43cf7add 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,2 +1,4 @@ vcrpy-unittest odoo_test_helper + +odoo-addon-stock-picking-backorder-reason @ git+https://github.com/OCA/stock-logistics-workflow@refs/pull/1199/head#subdirectory=setup/stock_picking_backorder_reason