diff --git a/setup/shopfloor_location_content_transfer_print_label/odoo/addons/shopfloor_location_content_transfer_print_label b/setup/shopfloor_location_content_transfer_print_label/odoo/addons/shopfloor_location_content_transfer_print_label new file mode 120000 index 00000000000..50922f131af --- /dev/null +++ b/setup/shopfloor_location_content_transfer_print_label/odoo/addons/shopfloor_location_content_transfer_print_label @@ -0,0 +1 @@ +../../../../shopfloor_location_content_transfer_print_label \ No newline at end of file diff --git a/setup/shopfloor_location_content_transfer_print_label/setup.py b/setup/shopfloor_location_content_transfer_print_label/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/shopfloor_location_content_transfer_print_label/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/shopfloor_location_content_transfer_print_label_mobile/odoo/addons/shopfloor_location_content_transfer_print_label_mobile b/setup/shopfloor_location_content_transfer_print_label_mobile/odoo/addons/shopfloor_location_content_transfer_print_label_mobile new file mode 120000 index 00000000000..4e2346c8f9c --- /dev/null +++ b/setup/shopfloor_location_content_transfer_print_label_mobile/odoo/addons/shopfloor_location_content_transfer_print_label_mobile @@ -0,0 +1 @@ +../../../../shopfloor_location_content_transfer_print_label_mobile \ No newline at end of file diff --git a/setup/shopfloor_location_content_transfer_print_label_mobile/setup.py b/setup/shopfloor_location_content_transfer_print_label_mobile/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/shopfloor_location_content_transfer_print_label_mobile/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/shopfloor_location_content_transfer_print_label/README.rst b/shopfloor_location_content_transfer_print_label/README.rst new file mode 100644 index 00000000000..4c657c1dd18 --- /dev/null +++ b/shopfloor_location_content_transfer_print_label/README.rst @@ -0,0 +1,77 @@ +=============================================== +Shopfloor Location Content Transfer Print Label +=============================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:a5fa0d496ce469797801e67c911295a24882d85dc8c740733c0d5afcc3ce38be + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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_location_content_transfer_print_label + :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_location_content_transfer_print_label + :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 print labels during 'location_content_transfer' +flow. + +**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 +------------ + +- Nicolas Delbovier nicolas.delbovier@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. + +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_location_content_transfer_print_label/__init__.py b/shopfloor_location_content_transfer_print_label/__init__.py new file mode 100644 index 00000000000..dbc960ed1b7 --- /dev/null +++ b/shopfloor_location_content_transfer_print_label/__init__.py @@ -0,0 +1,2 @@ +from . import components +from . import services diff --git a/shopfloor_location_content_transfer_print_label/__manifest__.py b/shopfloor_location_content_transfer_print_label/__manifest__.py new file mode 100644 index 00000000000..9b506cfa97a --- /dev/null +++ b/shopfloor_location_content_transfer_print_label/__manifest__.py @@ -0,0 +1,14 @@ +# Copyright 2025 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Shopfloor Location Content Transfer Print Label", + "summary": """Allows to print labels during 'location_content_transfer' flow""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/wms", + "depends": ["shopfloor", "shopfloor_printing_base"], + "data": [], + "demo": [], +} diff --git a/shopfloor_location_content_transfer_print_label/components/__init__.py b/shopfloor_location_content_transfer_print_label/components/__init__.py new file mode 100644 index 00000000000..672ecddfd01 --- /dev/null +++ b/shopfloor_location_content_transfer_print_label/components/__init__.py @@ -0,0 +1 @@ +from . import printing diff --git a/shopfloor_location_content_transfer_print_label/components/printing.py b/shopfloor_location_content_transfer_print_label/components/printing.py new file mode 100644 index 00000000000..f761b8a0a6a --- /dev/null +++ b/shopfloor_location_content_transfer_print_label/components/printing.py @@ -0,0 +1,10 @@ +# Copyright 2025 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo.addons.component.core import Component + + +class ShopFloorPrintingAction(Component): + _name = "shopfloor.location.content.transfer.printing.action" + _inherit = "shopfloor.printing.action" + _collection = "shopfloor.printing" + _usage = "location_content_transfer" diff --git a/shopfloor_location_content_transfer_print_label/readme/CONTRIBUTORS.md b/shopfloor_location_content_transfer_print_label/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..0a1eb36880b --- /dev/null +++ b/shopfloor_location_content_transfer_print_label/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Nicolas Delbovier \ No newline at end of file diff --git a/shopfloor_location_content_transfer_print_label/readme/DESCRIPTION.md b/shopfloor_location_content_transfer_print_label/readme/DESCRIPTION.md new file mode 100644 index 00000000000..7f237749903 --- /dev/null +++ b/shopfloor_location_content_transfer_print_label/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module allows to print labels during 'location_content_transfer' flow. \ No newline at end of file diff --git a/shopfloor_location_content_transfer_print_label/services/__init__.py b/shopfloor_location_content_transfer_print_label/services/__init__.py new file mode 100644 index 00000000000..50a98bfb911 --- /dev/null +++ b/shopfloor_location_content_transfer_print_label/services/__init__.py @@ -0,0 +1 @@ +from . import location_content_transfer diff --git a/shopfloor_location_content_transfer_print_label/services/location_content_transfer.py b/shopfloor_location_content_transfer_print_label/services/location_content_transfer.py new file mode 100644 index 00000000000..c764bb77901 --- /dev/null +++ b/shopfloor_location_content_transfer_print_label/services/location_content_transfer.py @@ -0,0 +1,56 @@ +# Copyright 2025 ACSONE SA/NV (https://acsone.eu) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) +from odoo.addons.base_rest.components.service import to_int +from odoo.addons.component.core import Component + + +class LocationContentTransfer(Component): + _inherit = "shopfloor.location.content.transfer" + + def print_labels( + self, + move_line_ids, + quantity, + ) -> dict: + """ + Print labels using the printing component. + The report is defined on menu level. + """ + move_lines = self.env["stock.move.line"].browse(move_line_ids) + picking = move_lines.picking_id + + printing = self._printing_for("location_content_transfer") + result = printing.print(record_ids=move_lines.ids, quantity=quantity) + if result: + message = self.msg_store.print_job_sent() + else: + message = self.msg_store.print_error() + return self._response_for_scan_destination_all(picking, message=message) + + +class ShopfloorLocationContentTransferValidator(Component): + _inherit = "shopfloor.location.content.transfer.validator" + + def print_labels(self) -> dict: + return { + "move_line_ids": { + "type": "list", + "required": True, + "schema": { + "coerce": to_int, + "type": "integer", + }, + }, + "quantity": { + "coerce": to_int, + "required": True, + "type": "integer", + }, + } + + +class ShopfloorLocationContentTransferValidatorResponse(Component): + _inherit = "shopfloor.location.content.transfer.validator.response" + + def print_labels(self) -> dict: + return self._response_schema(next_states={"scan_destination_all"}) diff --git a/shopfloor_location_content_transfer_print_label/static/description/icon.png b/shopfloor_location_content_transfer_print_label/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/shopfloor_location_content_transfer_print_label/static/description/icon.png differ diff --git a/shopfloor_location_content_transfer_print_label/static/description/index.html b/shopfloor_location_content_transfer_print_label/static/description/index.html new file mode 100644 index 00000000000..b9c022da046 --- /dev/null +++ b/shopfloor_location_content_transfer_print_label/static/description/index.html @@ -0,0 +1,424 @@ + + + + + +Shopfloor Location Content Transfer Print Label + + + +
+

Shopfloor Location Content Transfer Print Label

+ + +

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

+

This module allows to print labels during ‘location_content_transfer’ +flow.

+

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.

+

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_location_content_transfer_print_label/tests/__init__.py b/shopfloor_location_content_transfer_print_label/tests/__init__.py new file mode 100644 index 00000000000..741f825d1f7 --- /dev/null +++ b/shopfloor_location_content_transfer_print_label/tests/__init__.py @@ -0,0 +1 @@ +from . import test_print_labels diff --git a/shopfloor_location_content_transfer_print_label/tests/test_print_labels.py b/shopfloor_location_content_transfer_print_label/tests/test_print_labels.py new file mode 100644 index 00000000000..a8b0d252a0f --- /dev/null +++ b/shopfloor_location_content_transfer_print_label/tests/test_print_labels.py @@ -0,0 +1,55 @@ +# Copyright 2025 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + + +from unittest import mock + +from odoo.addons.shopfloor.tests.test_location_content_transfer_base import ( + LocationContentTransferCommonCase, +) +from odoo.addons.shopfloor_printing_base.components.printing import ( + ShopFloorPrintingAction, +) + + +class TestSetDestinationPrinting(LocationContentTransferCommonCase): + def test_print_labels(self): + picking = self._create_picking() + self._fill_stock_for_moves(picking.move_ids) + picking.action_assign() + move_lines = picking.move_line_ids + + with mock.patch.object(ShopFloorPrintingAction, "print") as mock_print: + mock_print.return_value = True + response = self.service.print_labels( + move_line_ids=move_lines.ids, quantity=10 + ) + + # Assert mock was called + mock_print.assert_called_once_with(record_ids=move_lines.ids, quantity=10) + + # Assert response + self.assertIn("message", response) + self.assertEqual( + response["message"], self.service.msg_store.print_job_sent() + ) + + def test_print_labels_error(self): + # Simulate move lines without picking + picking = self._create_picking() + self._fill_stock_for_moves(picking.move_ids) + picking.action_assign() + move_lines = picking.move_line_ids + + with mock.patch.object(ShopFloorPrintingAction, "print") as mock_print: + mock_print.return_value = False + response = self.service.print_labels( + move_line_ids=move_lines.ids, quantity=10 + ) + + # Assert mock was called + mock_print.assert_called_once_with(record_ids=move_lines.ids, quantity=10) + + # Assert response + self.assertIn("message", response) + self.assertEqual(response["message"], self.service.msg_store.print_error()) diff --git a/shopfloor_location_content_transfer_print_label_mobile/README.rst b/shopfloor_location_content_transfer_print_label_mobile/README.rst new file mode 100644 index 00000000000..d6e1fe266b3 --- /dev/null +++ b/shopfloor_location_content_transfer_print_label_mobile/README.rst @@ -0,0 +1,76 @@ +====================================================== +Shopfloor Location Content Transfer Print Label Mobile +====================================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:6090fce2eddccf44e2cdc9fb221ef859b5b99e946360fb070131fc5348c32229 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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_location_content_transfer_print_label_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_location_content_transfer_print_label_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| + + + +**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 +------------ + +- Nicolas Delbovier nicolas.delbovier@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. + +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_location_content_transfer_print_label_mobile/__init__.py b/shopfloor_location_content_transfer_print_label_mobile/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/shopfloor_location_content_transfer_print_label_mobile/__manifest__.py b/shopfloor_location_content_transfer_print_label_mobile/__manifest__.py new file mode 100644 index 00000000000..594077540c1 --- /dev/null +++ b/shopfloor_location_content_transfer_print_label_mobile/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2025 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Shopfloor Location Content Transfer Print Label Mobile", + "summary": """Shows a print button to print label during + location_content_transfer scenario.""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/wms", + "depends": [ + "shopfloor_mobile", + "shopfloor_location_content_transfer_print_label", + "shopfloor_mobile_printing_base", + ], + "data": ["templates/assets.xml"], + "demo": [], +} diff --git a/shopfloor_location_content_transfer_print_label_mobile/readme/CONTRIBUTORS.md b/shopfloor_location_content_transfer_print_label_mobile/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..159d31af1c4 --- /dev/null +++ b/shopfloor_location_content_transfer_print_label_mobile/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Nicolas Delbovier diff --git a/shopfloor_location_content_transfer_print_label_mobile/readme/DESCRIPTION.md b/shopfloor_location_content_transfer_print_label_mobile/readme/DESCRIPTION.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/shopfloor_location_content_transfer_print_label_mobile/static/description/icon.png b/shopfloor_location_content_transfer_print_label_mobile/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/shopfloor_location_content_transfer_print_label_mobile/static/description/icon.png differ diff --git a/shopfloor_location_content_transfer_print_label_mobile/static/description/index.html b/shopfloor_location_content_transfer_print_label_mobile/static/description/index.html new file mode 100644 index 00000000000..6042cce9446 --- /dev/null +++ b/shopfloor_location_content_transfer_print_label_mobile/static/description/index.html @@ -0,0 +1,422 @@ + + + + + +Shopfloor Location Content Transfer Print Label Mobile + + + +
+

Shopfloor Location Content Transfer Print Label Mobile

+ + +

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

+

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.

+

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_location_content_transfer_print_label_mobile/static/src/scenario/location_content_transfer.js b/shopfloor_location_content_transfer_print_label_mobile/static/src/scenario/location_content_transfer.js new file mode 100644 index 00000000000..e1309cd4366 --- /dev/null +++ b/shopfloor_location_content_transfer_print_label_mobile/static/src/scenario/location_content_transfer.js @@ -0,0 +1,45 @@ +/** + * 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 location_content_transfer_scenario = process_registry.get( + "location_content_transfer" +); + +// Inject the new state template into already exiting one +const template = location_content_transfer_scenario.component.template; +const pos = template.indexOf(""); +const new_template = + template.substring(0, pos) + + ` + + +` + + template.substring(pos); + +// Create a new component extending the location_content_transfer scenario +const LocationContentTransfer = process_registry.extend("location_content_transfer", { + template: new_template, + + methods: { + ...location_content_transfer_scenario.component.methods, + + print_labels: function (quantity) { + this.wait_call( + this.odoo.call("print_labels", { + move_line_ids: this.state.data.move_lines.map((x) => x.id), + quantity: quantity, + }) + ); + }, + }, +}); + +process_registry.replace("location_content_transfer", LocationContentTransfer); + +export default LocationContentTransfer; diff --git a/shopfloor_location_content_transfer_print_label_mobile/templates/assets.xml b/shopfloor_location_content_transfer_print_label_mobile/templates/assets.xml new file mode 100644 index 00000000000..a8c6b9e395a --- /dev/null +++ b/shopfloor_location_content_transfer_print_label_mobile/templates/assets.xml @@ -0,0 +1,22 @@ + + + + + diff --git a/test-requirements.txt b/test-requirements.txt index 689482e20df..46ed9100633 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,2 +1,5 @@ vcrpy-unittest odoo_test_helper +odoo-addon-shopfloor-base @ git+https://github.com/OCA/wms@refs/pull/1085/head#subdirectory=setup/shopfloor_base +odoo-addon-shopfloor-printing-base @ git+https://github.com/OCA/wms@refs/pull/1085/head#subdirectory=setup/shopfloor_printing_base +odoo-addon-shopfloor-mobile-printing-base @ git+https://github.com/OCA/wms@refs/pull/1085/head#subdirectory=setup/shopfloor_mobile_printing_base