From 34fae8f7a7521e5057acb742833cd40283053644 Mon Sep 17 00:00:00 2001 From: Denis Roussel Date: Mon, 25 Aug 2025 15:40:23 +0200 Subject: [PATCH 1/2] [IMP] shopfloor_reception: Add the ability to not use packages flows --- .../data/shopfloor_scenario_data.xml | 1 + shopfloor_reception/models/shopfloor_menu.py | 22 +++++++++++++++ shopfloor_reception/services/reception.py | 19 +++++++++---- .../tests/test_set_quantity.py | 27 +++++++++++++++++++ shopfloor_reception/views/shopfloor_menu.xml | 10 +++++++ 5 files changed, 74 insertions(+), 5 deletions(-) diff --git a/shopfloor_reception/data/shopfloor_scenario_data.xml b/shopfloor_reception/data/shopfloor_scenario_data.xml index fd86065f8e0..3a3d7038659 100644 --- a/shopfloor_reception/data/shopfloor_scenario_data.xml +++ b/shopfloor_reception/data/shopfloor_scenario_data.xml @@ -8,6 +8,7 @@ reception { + "allow_dont_use_packs_in_reception": false, "auto_post_line": true, "allow_return": true, "scan_location_or_pack_first": true, diff --git a/shopfloor_reception/models/shopfloor_menu.py b/shopfloor_reception/models/shopfloor_menu.py index c863b1b5cca..a3cd07f87c9 100644 --- a/shopfloor_reception/models/shopfloor_menu.py +++ b/shopfloor_reception/models/shopfloor_menu.py @@ -11,6 +11,14 @@ class ShopfloorMenu(models.Model): _inherit = "shopfloor.menu" + dont_use_packs_in_reception = fields.Boolean( + compute="_compute_dont_use_packs_in_reception", + store=True, + readonly=False, + ) + dont_use_packs_in_reception_is_possible = fields.Boolean( + compute="_compute_dont_use_packs_in_reception_is_possible", + ) filter_today_scheduled_pickings_is_possible = fields.Boolean( compute="_compute_filter_today_scheduled_pickings_is_possible" ) @@ -19,6 +27,20 @@ class ShopfloorMenu(models.Model): help=FILTER_TODAY_SCHEDULED_PICKINGS_HELP, ) + @api.depends("scenario_id") + def _compute_dont_use_packs_in_reception_is_possible(self): + for menu in self: + menu.dont_use_packs_in_reception_is_possible = bool( + menu.scenario_id.has_option("allow_dont_use_packs_in_reception") + ) + + @api.depends("dont_use_packs_in_reception_is_possible") + def _compute_dont_use_packs_in_reception(self): + for menu in self: + menu.dont_use_packs_in_reception = ( + menu.dont_use_packs_in_reception_is_possible + ) + @api.depends("scenario_id") def _compute_filter_today_scheduled_pickings_is_possible(self): for menu in self: diff --git a/shopfloor_reception/services/reception.py b/shopfloor_reception/services/reception.py index 156f600c677..78718de6b90 100644 --- a/shopfloor_reception/services/reception.py +++ b/shopfloor_reception/services/reception.py @@ -817,13 +817,17 @@ def _before_state__set_quantity(self, picking, line, message=None): def _response_for_set_quantity( self, picking, line, message=None, asking_confirmation=None ): + data = { + "selected_move_line": self._data_for_move_lines(line), + "picking": self.data.picking(picking), + "confirmation_required": asking_confirmation, + } + dont_use_packs = self.work.menu.dont_use_packs_in_reception + if dont_use_packs: + data.update({"dont_use_packs": True}) response = self._response( next_state="set_quantity", - data={ - "selected_move_line": self._data_for_move_lines(line), - "picking": self.data.picking(picking), - "confirmation_required": asking_confirmation, - }, + data=data, message=message, ) return self._align_display_product_uom_qty(line, response) @@ -1720,6 +1724,11 @@ def _schema_set_quantity(self): "nullable": True, "required": False, }, + "dont_use_packs": { + "type": "boolean", + "nullable": True, + "required": False, + }, } @property diff --git a/shopfloor_reception/tests/test_set_quantity.py b/shopfloor_reception/tests/test_set_quantity.py index 8cd13962002..da4bc9fdc5f 100644 --- a/shopfloor_reception/tests/test_set_quantity.py +++ b/shopfloor_reception/tests/test_set_quantity.py @@ -132,6 +132,33 @@ def test_scan_product(self): ) self.assertEqual(selected_move_line.qty_done, 4.0) + def test_scan_product_dont_use_packs(self): + self.service.work.menu.sudo().dont_use_packs_in_reception = True + picking = self._create_picking() + selected_move_line = picking.move_line_ids.filtered( + lambda l: l.product_id == self.product_a + ) + selected_move_line.shopfloor_user_id = self.env.uid + response = self.service.dispatch( + "set_quantity", + params={ + "picking_id": picking.id, + "selected_line_id": selected_move_line.id, + "barcode": self.product_a.barcode, + }, + ) + data = self.data.picking(picking) + self.assert_response( + response, + next_state="set_quantity", + data={ + "picking": data, + "selected_move_line": self.data.move_lines(selected_move_line), + "confirmation_required": None, + "dont_use_packs": True, + }, + ) + def test_scan_packaging(self): picking = self._create_picking() selected_move_line = picking.move_line_ids.filtered( diff --git a/shopfloor_reception/views/shopfloor_menu.xml b/shopfloor_reception/views/shopfloor_menu.xml index 10f73482c0b..6b83c6a86e9 100644 --- a/shopfloor_reception/views/shopfloor_menu.xml +++ b/shopfloor_reception/views/shopfloor_menu.xml @@ -7,6 +7,16 @@ + + + + Date: Mon, 25 Aug 2025 15:42:51 +0200 Subject: [PATCH 2/2] [IMP] shopfloor_reception_mobile: Allows to not use packages when setting quantity --- shopfloor_reception_mobile/README.rst | 6 +---- .../static/description/index.html | 24 +++++++------------ .../static/src/scenario/reception.js | 15 +++++++++--- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/shopfloor_reception_mobile/README.rst b/shopfloor_reception_mobile/README.rst index 5642e14bc56..8455e60b3af 100644 --- a/shopfloor_reception_mobile/README.rst +++ b/shopfloor_reception_mobile/README.rst @@ -1,7 +1,3 @@ -.. image:: https://odoo-community.org/readme-banner-image - :target: https://odoo-community.org/get-involved?utm_source=readme - :alt: Odoo Community Association - ========================== Shopfloor reception mobile ========================== @@ -17,7 +13,7 @@ Shopfloor reception mobile .. |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 +.. |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 diff --git a/shopfloor_reception_mobile/static/description/index.html b/shopfloor_reception_mobile/static/description/index.html index 4ad84f2d3b4..6fbf5c30d57 100644 --- a/shopfloor_reception_mobile/static/description/index.html +++ b/shopfloor_reception_mobile/static/description/index.html @@ -3,7 +3,7 @@ -README.rst +Shopfloor reception mobile -
+
+

Shopfloor reception mobile

- - -Odoo Community Association - -
-

Shopfloor reception mobile

-

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

+

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

Frontend for the reception scenario in shopfloor. Allows to receive products and create the proper packs for each logistic unit.

Table of contents

@@ -390,7 +385,7 @@

Shopfloor reception mobile

-

Bug Tracker

+

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 @@ -398,15 +393,15 @@

Bug Tracker

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

-

Credits

+

Credits

-

Authors

+

Authors

  • Camptocamp
-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -429,6 +424,5 @@

Maintainers

-
diff --git a/shopfloor_reception_mobile/static/src/scenario/reception.js b/shopfloor_reception_mobile/static/src/scenario/reception.js index dcf4dd86a4c..a9366cdb432 100644 --- a/shopfloor_reception_mobile/static/src/scenario/reception.js +++ b/shopfloor_reception_mobile/static/src/scenario/reception.js @@ -134,21 +134,26 @@ const Reception = { />
- + Existing pack - + New pack - + Process without pack + + + Process + +
@@ -213,6 +218,10 @@ const Reception = { `, computed: { + use_packs: function () { + var dont_use_packs = _.result(this.state, "data.dont_use_packs", false); + return !dont_use_packs; + }, visible_pickings: function () { return !_.isEmpty(this.filtered_pickings) ? this.filtered_pickings