From 40da141611732e7c3d776a9d9b5a5cb9b455c282 Mon Sep 17 00:00:00 2001 From: Jacques-Etienne Baudoux Date: Fri, 1 Sep 2023 19:30:01 +0200 Subject: [PATCH 01/10] [FIX] stock_available_to_promise_release Do not assign done or canceled moves --- stock_available_to_promise_release/models/stock_move.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stock_available_to_promise_release/models/stock_move.py b/stock_available_to_promise_release/models/stock_move.py index 7cc514c538..e832cc7745 100644 --- a/stock_available_to_promise_release/models/stock_move.py +++ b/stock_available_to_promise_release/models/stock_move.py @@ -486,8 +486,11 @@ def _after_release_update_chain(self): def _after_release_assign_moves(self): move_ids = [] for origin_moves in self._get_chained_moves_iterator("move_orig_ids"): - move_ids += origin_moves.ids - self.env["stock.move"].browse(move_ids)._action_assign() + move_ids += origin_moves.filtered( + lambda m: m.state not in ("cancel", "done") + ).ids + moves = self.browse(move_ids) + moves._action_assign() def _release_split(self, remaining_qty): """Split move and put remaining_qty to a backorder move.""" From f6c141c411aa804dbbdcd13d291059731f05cc7b Mon Sep 17 00:00:00 2001 From: Jacques-Etienne Baudoux Date: Fri, 1 Sep 2023 19:30:52 +0200 Subject: [PATCH 02/10] [FIX] stock_dynamic_routing: merge moves Merge reclassified moves after release --- .../models/stock_move.py | 7 ++-- .../__init__.py | 1 + .../__manifest__.py | 3 +- .../models/__init__.py | 1 + .../models/stock_move.py | 36 +++++++++++++++++++ .../readme/CONTRIBUTORS.rst | 1 + 6 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 stock_available_to_promise_release_dynamic_routing/models/__init__.py create mode 100644 stock_available_to_promise_release_dynamic_routing/models/stock_move.py diff --git a/stock_available_to_promise_release/models/stock_move.py b/stock_available_to_promise_release/models/stock_move.py index e832cc7745..65fe8953f2 100644 --- a/stock_available_to_promise_release/models/stock_move.py +++ b/stock_available_to_promise_release/models/stock_move.py @@ -462,10 +462,10 @@ def _run_stock_rule(self): ) self.env["procurement.group"].run_defer(procurement_requests) - released_moves._after_release_assign_moves() - released_moves._after_release_update_chain() + assigned_moves = released_moves._after_release_assign_moves() + assigned_moves._after_release_update_chain() - return released_moves + return assigned_moves def _before_release(self): """Hook that aims to be overridden.""" @@ -491,6 +491,7 @@ def _after_release_assign_moves(self): ).ids moves = self.browse(move_ids) moves._action_assign() + return moves def _release_split(self, remaining_qty): """Split move and put remaining_qty to a backorder move.""" diff --git a/stock_available_to_promise_release_dynamic_routing/__init__.py b/stock_available_to_promise_release_dynamic_routing/__init__.py index e69de29bb2..0650744f6b 100644 --- a/stock_available_to_promise_release_dynamic_routing/__init__.py +++ b/stock_available_to_promise_release_dynamic_routing/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/stock_available_to_promise_release_dynamic_routing/__manifest__.py b/stock_available_to_promise_release_dynamic_routing/__manifest__.py index 3b4ea353c8..93a72f1657 100644 --- a/stock_available_to_promise_release_dynamic_routing/__manifest__.py +++ b/stock_available_to_promise_release_dynamic_routing/__manifest__.py @@ -3,7 +3,8 @@ { "name": "Available to Promise Release - Dynamic Routing", "summary": "Glue between moves release and dynamic routing", - "author": "Camptocamp, Odoo Community Association (OCA)", + "author": "Camptocamp,BCIM,Odoo Community Association (OCA)", + "maintainers": ["jbaudoux"], "website": "https://github.com/OCA/wms", "category": "Warehouse Management", "version": "14.0.1.0.0", diff --git a/stock_available_to_promise_release_dynamic_routing/models/__init__.py b/stock_available_to_promise_release_dynamic_routing/models/__init__.py new file mode 100644 index 0000000000..6bda2d2428 --- /dev/null +++ b/stock_available_to_promise_release_dynamic_routing/models/__init__.py @@ -0,0 +1 @@ +from . import stock_move diff --git a/stock_available_to_promise_release_dynamic_routing/models/stock_move.py b/stock_available_to_promise_release_dynamic_routing/models/stock_move.py new file mode 100644 index 0000000000..f34887d52d --- /dev/null +++ b/stock_available_to_promise_release_dynamic_routing/models/stock_move.py @@ -0,0 +1,36 @@ +# Copyright 2023 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) + +from itertools import groupby + +from odoo import models + + +class StockMove(models.Model): + _inherit = "stock.move" + + def _after_release_assign_moves(self): + # Trigger the dynamic routing + moves = super()._after_release_assign_moves() + # Check if moves can be merged. We do this after the call to + # _action_assign in super as this could delete some records in self + sorted_moves_by_rule = sorted(moves, key=lambda m: m.picking_id.id) + moves_to_rereserve_ids = [] + new_moves = self.browse() + for _picking_id, move_list in groupby( + sorted_moves_by_rule, key=lambda m: m.picking_id.id + ): + moves = self.browse(m.id for m in move_list) + merged_moves = moves._merge_moves() + new_moves |= merged_moves + if moves != merged_moves: + for move in merged_moves: + if not move.quantity_done: + moves_to_rereserve_ids.append(move.id) + if moves_to_rereserve_ids: + moves_to_rereserve = self.browse(moves_to_rereserve_ids) + moves_to_rereserve._do_unreserve() + moves_to_rereserve.with_context( + exclude_apply_dynamic_routing=True + )._action_assign() + return new_moves diff --git a/stock_available_to_promise_release_dynamic_routing/readme/CONTRIBUTORS.rst b/stock_available_to_promise_release_dynamic_routing/readme/CONTRIBUTORS.rst index 9d9e83e703..ca56f7d4c6 100644 --- a/stock_available_to_promise_release_dynamic_routing/readme/CONTRIBUTORS.rst +++ b/stock_available_to_promise_release_dynamic_routing/readme/CONTRIBUTORS.rst @@ -1,3 +1,4 @@ +* Jacques-Etienne Baudoux (BCIM) * Guewen Baconnier * `Trobz `_: * Dung Tran From b07ff5f7307aa51b6ac886b052e86d7d984af87d Mon Sep 17 00:00:00 2001 From: Mmequignon Date: Mon, 11 Sep 2023 15:14:10 +0200 Subject: [PATCH 03/10] stock_available_to_promise_release: Fix move unreleasing --- .../models/stock_move.py | 5 ++ .../tests/__init__.py | 1 + .../tests/test_unrelease_merged_moves.py | 54 +++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 stock_available_to_promise_release/tests/test_unrelease_merged_moves.py diff --git a/stock_available_to_promise_release/models/stock_move.py b/stock_available_to_promise_release/models/stock_move.py index 65fe8953f2..d91232268d 100644 --- a/stock_available_to_promise_release/models/stock_move.py +++ b/stock_available_to_promise_release/models/stock_move.py @@ -579,6 +579,8 @@ def _split_origins(self, origins): """ self.ensure_one() qty = self.product_qty + # Unreserve goods before the split + origins._do_unreserve() rounding = self.product_uom.rounding new_origin_moves = self.env["stock.move"] while float_compare(qty, 0, precision_rounding=rounding) > 0 and origins: @@ -591,6 +593,9 @@ def _split_origins(self, origins): new_origin_moves |= self.create(new_move_vals) break origins -= origin + # And then do the reservation again + origins._action_assign() + new_origin_moves._action_assign() return new_origin_moves def _search_picking_for_assignation_domain(self): diff --git a/stock_available_to_promise_release/tests/__init__.py b/stock_available_to_promise_release/tests/__init__.py index b29b6d9eb4..1eee41662b 100644 --- a/stock_available_to_promise_release/tests/__init__.py +++ b/stock_available_to_promise_release/tests/__init__.py @@ -2,3 +2,4 @@ from . import test_unrelease from . import test_unrelease_2steps from . import test_unrelease_3steps +from . import test_unrelease_merged_moves diff --git a/stock_available_to_promise_release/tests/test_unrelease_merged_moves.py b/stock_available_to_promise_release/tests/test_unrelease_merged_moves.py new file mode 100644 index 0000000000..199363835d --- /dev/null +++ b/stock_available_to_promise_release/tests/test_unrelease_merged_moves.py @@ -0,0 +1,54 @@ +# Copyright 2023 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from datetime import datetime + +from .common import PromiseReleaseCommonCase + + +class TestAvailableToPromiseRelease(PromiseReleaseCommonCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + delivery_pick_rule = cls.wh.delivery_route_id.rule_ids.filtered( + lambda r: r.location_src_id == cls.loc_stock + ) + delivery_pick_rule.group_propagation_option = "fixed" + cls.pc1 = cls._create_picking_chain( + cls.wh, [(cls.product1, 2)], date=datetime(2019, 9, 2, 16, 0) + ) + cls.shipping1 = cls._out_picking(cls.pc1) + cls.pc2 = cls._create_picking_chain( + cls.wh, [(cls.product1, 3)], date=datetime(2019, 9, 2, 16, 0) + ) + cls.shipping2 = cls._out_picking(cls.pc2) + cls._update_qty_in_location(cls.loc_bin1, cls.product1, 15.0) + cls.wh.delivery_route_id.write( + { + "available_to_promise_defer_pull": True, + } + ) + shippings = cls.shipping1 | cls.shipping2 + shippings.release_available_to_promise() + cls.picking1 = cls._prev_picking(cls.shipping1) + cls.picking1.action_assign() + cls.picking2 = cls._prev_picking(cls.shipping2) + cls.picking2.action_assign() + + @classmethod + def _out_picking(cls, pickings): + return pickings.filtered(lambda r: r.picking_type_code == "outgoing") + + @classmethod + def _prev_picking(cls, picking): + return picking.move_lines.move_orig_ids.picking_id + + def test_unrelease_merged_move(self): + self.assertEqual(self.picking1, self.picking2) + moves = self.picking1.move_lines.filtered(lambda m: m.state == "assigned") + self.assertEqual(sum(moves.mapped("product_uom_qty")), 5.0) + self.shipping2.unrelease() + move = self.picking1.move_lines.filtered(lambda m: m.state == "assigned") + line = move.move_line_ids + self.assertEqual(move.product_uom_qty, 2.0) + self.assertEqual(line.product_uom_qty, 2.0) From 442e192a7a274730c7f849a2375be7d5ea99da2b Mon Sep 17 00:00:00 2001 From: oca-ci Date: Mon, 13 Nov 2023 10:08:33 +0000 Subject: [PATCH 04/10] [UPD] Update stock_available_to_promise_release_dynamic_routing.pot --- ...ble_to_promise_release_dynamic_routing.pot | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/stock_available_to_promise_release_dynamic_routing/i18n/stock_available_to_promise_release_dynamic_routing.pot b/stock_available_to_promise_release_dynamic_routing/i18n/stock_available_to_promise_release_dynamic_routing.pot index 4d8b20f912..512fa7d3f3 100644 --- a/stock_available_to_promise_release_dynamic_routing/i18n/stock_available_to_promise_release_dynamic_routing.pot +++ b/stock_available_to_promise_release_dynamic_routing/i18n/stock_available_to_promise_release_dynamic_routing.pot @@ -1,5 +1,6 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: +# * stock_available_to_promise_release_dynamic_routing # msgid "" msgstr "" @@ -11,3 +12,23 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" + +#. module: stock_available_to_promise_release_dynamic_routing +#: model:ir.model.fields,field_description:stock_available_to_promise_release_dynamic_routing.field_stock_move__display_name +msgid "Display Name" +msgstr "" + +#. module: stock_available_to_promise_release_dynamic_routing +#: model:ir.model.fields,field_description:stock_available_to_promise_release_dynamic_routing.field_stock_move__id +msgid "ID" +msgstr "" + +#. module: stock_available_to_promise_release_dynamic_routing +#: model:ir.model.fields,field_description:stock_available_to_promise_release_dynamic_routing.field_stock_move____last_update +msgid "Last Modified on" +msgstr "" + +#. module: stock_available_to_promise_release_dynamic_routing +#: model:ir.model,name:stock_available_to_promise_release_dynamic_routing.model_stock_move +msgid "Stock Move" +msgstr "" From 8b785817a31a9e7cfbde604cfac811dce228b3cb Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 13 Nov 2023 10:29:08 +0000 Subject: [PATCH 05/10] [BOT] post-merge updates --- README.md | 4 ++-- stock_available_to_promise_release/README.rst | 2 +- stock_available_to_promise_release/__manifest__.py | 2 +- .../static/description/index.html | 2 +- .../README.rst | 12 +++++++++++- .../__manifest__.py | 2 +- .../static/description/index.html | 6 +++++- 7 files changed, 22 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 2e5275bafc..f9abc0eef7 100644 --- a/README.md +++ b/README.md @@ -61,8 +61,8 @@ addon | version | maintainers | summary [shopfloor_workstation](shopfloor_workstation/) | 14.0.1.3.1 | | Manage warehouse workstation with barcode scanners [shopfloor_workstation_label_printer](shopfloor_workstation_label_printer/) | 14.0.1.1.0 | | Adds a label printer configuration to the user and shopfloor workstation. [shopfloor_workstation_mobile](shopfloor_workstation_mobile/) | 14.0.1.0.1 | | Shopfloor mobile app integration for workstation -[stock_available_to_promise_release](stock_available_to_promise_release/) | 14.0.2.2.0 | | Release Operations based on available to promise -[stock_available_to_promise_release_dynamic_routing](stock_available_to_promise_release_dynamic_routing/) | 14.0.1.0.0 | | Glue between moves release and dynamic routing +[stock_available_to_promise_release](stock_available_to_promise_release/) | 14.0.2.3.0 | | Release Operations based on available to promise +[stock_available_to_promise_release_dynamic_routing](stock_available_to_promise_release_dynamic_routing/) | 14.0.1.1.0 | [![jbaudoux](https://github.com/jbaudoux.png?size=30px)](https://github.com/jbaudoux) | Glue between moves release and dynamic routing [stock_checkout_sync](stock_checkout_sync/) | 14.0.1.1.0 | | Sync location for Checkout operations [stock_dynamic_routing](stock_dynamic_routing/) | 14.0.1.1.1 | [![jbaudoux](https://github.com/jbaudoux.png?size=30px)](https://github.com/jbaudoux) | Dynamic routing of stock moves [stock_dynamic_routing_checkout_sync](stock_dynamic_routing_checkout_sync/) | 14.0.1.0.0 | | Glue module for tests when dynamic routing and checkout sync are used diff --git a/stock_available_to_promise_release/README.rst b/stock_available_to_promise_release/README.rst index 7bdf0a70c0..024402629b 100644 --- a/stock_available_to_promise_release/README.rst +++ b/stock_available_to_promise_release/README.rst @@ -7,7 +7,7 @@ Stock Available to Promise Release !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:fce8e84ad2954ae45e70c0d921e9a4e689378b265045b0477e2ab31264ce96b4 + !! source digest: sha256:2309ceaa3005c7fdf6d7a5d4d199d02942de918334d3586cedb8968f9c2593de !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/stock_available_to_promise_release/__manifest__.py b/stock_available_to_promise_release/__manifest__.py index b733203956..8234f684cf 100644 --- a/stock_available_to_promise_release/__manifest__.py +++ b/stock_available_to_promise_release/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Stock Available to Promise Release", - "version": "14.0.2.2.0", + "version": "14.0.2.3.0", "summary": "Release Operations based on available to promise", "author": "Camptocamp, BCIM, Odoo Community Association (OCA)", "website": "https://github.com/OCA/wms", diff --git a/stock_available_to_promise_release/static/description/index.html b/stock_available_to_promise_release/static/description/index.html index c52f46d938..da79b3d4e0 100644 --- a/stock_available_to_promise_release/static/description/index.html +++ b/stock_available_to_promise_release/static/description/index.html @@ -367,7 +367,7 @@

Stock Available to Promise Release

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:fce8e84ad2954ae45e70c0d921e9a4e689378b265045b0477e2ab31264ce96b4 +!! source digest: sha256:2309ceaa3005c7fdf6d7a5d4d199d02942de918334d3586cedb8968f9c2593de !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

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

Currently the reservation is performed by adding reserved quantities on quants, diff --git a/stock_available_to_promise_release_dynamic_routing/README.rst b/stock_available_to_promise_release_dynamic_routing/README.rst index d3849db6b5..9dd5bc8f03 100644 --- a/stock_available_to_promise_release_dynamic_routing/README.rst +++ b/stock_available_to_promise_release_dynamic_routing/README.rst @@ -7,7 +7,7 @@ Available to Promise Release - Dynamic Routing !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:6acf3b31d72d9fb1a24f1bf47f79e5bafc6ec4e41f7590ad28e35096ae1e85aa + !! source digest: sha256:aead33fabdb3ae0f3970ffc2be1cfc29fccd1926d059460081fff13eccac24d7 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png @@ -61,10 +61,12 @@ Authors ~~~~~~~ * Camptocamp +* BCIM Contributors ~~~~~~~~~~~~ +* Jacques-Etienne Baudoux (BCIM) * Guewen Baconnier * `Trobz `_: * Dung Tran @@ -88,6 +90,14 @@ 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-jbaudoux| image:: https://github.com/jbaudoux.png?size=40px + :target: https://github.com/jbaudoux + :alt: jbaudoux + +Current `maintainer `__: + +|maintainer-jbaudoux| + 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/stock_available_to_promise_release_dynamic_routing/__manifest__.py b/stock_available_to_promise_release_dynamic_routing/__manifest__.py index 93a72f1657..d19afb3eea 100644 --- a/stock_available_to_promise_release_dynamic_routing/__manifest__.py +++ b/stock_available_to_promise_release_dynamic_routing/__manifest__.py @@ -7,7 +7,7 @@ "maintainers": ["jbaudoux"], "website": "https://github.com/OCA/wms", "category": "Warehouse Management", - "version": "14.0.1.0.0", + "version": "14.0.1.1.0", "license": "AGPL-3", "depends": ["stock_available_to_promise_release", "stock_dynamic_routing"], "demo": [], diff --git a/stock_available_to_promise_release_dynamic_routing/static/description/index.html b/stock_available_to_promise_release_dynamic_routing/static/description/index.html index 7d58a51a1c..a7d0629c31 100644 --- a/stock_available_to_promise_release_dynamic_routing/static/description/index.html +++ b/stock_available_to_promise_release_dynamic_routing/static/description/index.html @@ -367,7 +367,7 @@

Available to Promise Release - Dynamic Routing

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:6acf3b31d72d9fb1a24f1bf47f79e5bafc6ec4e41f7590ad28e35096ae1e85aa +!! source digest: sha256:aead33fabdb3ae0f3970ffc2be1cfc29fccd1926d059460081fff13eccac24d7 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

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

Glue module between stock_available_to_promise_release and @@ -407,11 +407,13 @@

Credits

Authors

  • Camptocamp
  • +
  • BCIM

Contributors

From 3995b200a22eb2169a11778db798b37f11fb064e Mon Sep 17 00:00:00 2001 From: Weblate Date: Mon, 13 Nov 2023 10:29:19 +0000 Subject: [PATCH 06/10] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: wms-14.0/wms-14.0-stock_available_to_promise_release_dynamic_routing Translate-URL: https://translation.odoo-community.org/projects/wms-14-0/wms-14-0-stock_available_to_promise_release_dynamic_routing/ --- .../i18n/es_AR.po | 19 +++++++++++++++++++ .../i18n/it.po | 19 +++++++++++++++++++ .../i18n/pt_BR.po | 19 +++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/stock_available_to_promise_release_dynamic_routing/i18n/es_AR.po b/stock_available_to_promise_release_dynamic_routing/i18n/es_AR.po index e69de29bb2..2aa1ab18ce 100644 --- a/stock_available_to_promise_release_dynamic_routing/i18n/es_AR.po +++ b/stock_available_to_promise_release_dynamic_routing/i18n/es_AR.po @@ -0,0 +1,19 @@ +#. module: stock_available_to_promise_release_dynamic_routing +#: model:ir.model.fields,field_description:stock_available_to_promise_release_dynamic_routing.field_stock_move__display_name +msgid "Display Name" +msgstr "" + +#. module: stock_available_to_promise_release_dynamic_routing +#: model:ir.model.fields,field_description:stock_available_to_promise_release_dynamic_routing.field_stock_move__id +msgid "ID" +msgstr "" + +#. module: stock_available_to_promise_release_dynamic_routing +#: model:ir.model.fields,field_description:stock_available_to_promise_release_dynamic_routing.field_stock_move____last_update +msgid "Last Modified on" +msgstr "" + +#. module: stock_available_to_promise_release_dynamic_routing +#: model:ir.model,name:stock_available_to_promise_release_dynamic_routing.model_stock_move +msgid "Stock Move" +msgstr "" diff --git a/stock_available_to_promise_release_dynamic_routing/i18n/it.po b/stock_available_to_promise_release_dynamic_routing/i18n/it.po index e69de29bb2..2aa1ab18ce 100644 --- a/stock_available_to_promise_release_dynamic_routing/i18n/it.po +++ b/stock_available_to_promise_release_dynamic_routing/i18n/it.po @@ -0,0 +1,19 @@ +#. module: stock_available_to_promise_release_dynamic_routing +#: model:ir.model.fields,field_description:stock_available_to_promise_release_dynamic_routing.field_stock_move__display_name +msgid "Display Name" +msgstr "" + +#. module: stock_available_to_promise_release_dynamic_routing +#: model:ir.model.fields,field_description:stock_available_to_promise_release_dynamic_routing.field_stock_move__id +msgid "ID" +msgstr "" + +#. module: stock_available_to_promise_release_dynamic_routing +#: model:ir.model.fields,field_description:stock_available_to_promise_release_dynamic_routing.field_stock_move____last_update +msgid "Last Modified on" +msgstr "" + +#. module: stock_available_to_promise_release_dynamic_routing +#: model:ir.model,name:stock_available_to_promise_release_dynamic_routing.model_stock_move +msgid "Stock Move" +msgstr "" diff --git a/stock_available_to_promise_release_dynamic_routing/i18n/pt_BR.po b/stock_available_to_promise_release_dynamic_routing/i18n/pt_BR.po index e69de29bb2..2aa1ab18ce 100644 --- a/stock_available_to_promise_release_dynamic_routing/i18n/pt_BR.po +++ b/stock_available_to_promise_release_dynamic_routing/i18n/pt_BR.po @@ -0,0 +1,19 @@ +#. module: stock_available_to_promise_release_dynamic_routing +#: model:ir.model.fields,field_description:stock_available_to_promise_release_dynamic_routing.field_stock_move__display_name +msgid "Display Name" +msgstr "" + +#. module: stock_available_to_promise_release_dynamic_routing +#: model:ir.model.fields,field_description:stock_available_to_promise_release_dynamic_routing.field_stock_move__id +msgid "ID" +msgstr "" + +#. module: stock_available_to_promise_release_dynamic_routing +#: model:ir.model.fields,field_description:stock_available_to_promise_release_dynamic_routing.field_stock_move____last_update +msgid "Last Modified on" +msgstr "" + +#. module: stock_available_to_promise_release_dynamic_routing +#: model:ir.model,name:stock_available_to_promise_release_dynamic_routing.model_stock_move +msgid "Stock Move" +msgstr "" From 0d0507f63ba610260090e97cf5e6899185b4b617 Mon Sep 17 00:00:00 2001 From: mymage Date: Mon, 13 Nov 2023 12:20:25 +0000 Subject: [PATCH 07/10] Translated using Weblate (Italian) Currently translated at 100.0% (4 of 4 strings) Translation: wms-14.0/wms-14.0-stock_available_to_promise_release_dynamic_routing Translate-URL: https://translation.odoo-community.org/projects/wms-14-0/wms-14-0-stock_available_to_promise_release_dynamic_routing/it/ --- .../i18n/it.po | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/stock_available_to_promise_release_dynamic_routing/i18n/it.po b/stock_available_to_promise_release_dynamic_routing/i18n/it.po index 2aa1ab18ce..4280258e3b 100644 --- a/stock_available_to_promise_release_dynamic_routing/i18n/it.po +++ b/stock_available_to_promise_release_dynamic_routing/i18n/it.po @@ -1,19 +1,35 @@ +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-11-13 14:37+0000\n" +"PO-Revision-Date: 2023-11-13 14:37+0000\n" +"Last-Translator: mymage \n" +"Language-Team: LANGUAGE \n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: ENCODING\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + #. module: stock_available_to_promise_release_dynamic_routing #: model:ir.model.fields,field_description:stock_available_to_promise_release_dynamic_routing.field_stock_move__display_name msgid "Display Name" -msgstr "" +msgstr "Nome visualizzato" #. module: stock_available_to_promise_release_dynamic_routing #: model:ir.model.fields,field_description:stock_available_to_promise_release_dynamic_routing.field_stock_move__id msgid "ID" -msgstr "" +msgstr "ID" #. module: stock_available_to_promise_release_dynamic_routing #: model:ir.model.fields,field_description:stock_available_to_promise_release_dynamic_routing.field_stock_move____last_update msgid "Last Modified on" -msgstr "" +msgstr "Ultima modifica il" #. module: stock_available_to_promise_release_dynamic_routing #: model:ir.model,name:stock_available_to_promise_release_dynamic_routing.model_stock_move msgid "Stock Move" -msgstr "" +msgstr "Movimento di magazzino" From dc1db3b11cb55f907c96609a30a13b80a8021dc9 Mon Sep 17 00:00:00 2001 From: JuMiSanAr Date: Tue, 24 Oct 2023 10:28:21 +0200 Subject: [PATCH 08/10] shopfloor: add option to order the picking list by priority --- shopfloor/actions/data.py | 4 +++- shopfloor/actions/schema.py | 1 + shopfloor/models/shopfloor_menu.py | 21 +++++++++++++++++++ shopfloor/services/checkout.py | 10 +++++++-- shopfloor/tests/test_checkout_base.py | 4 ++-- shopfloor/tests/test_checkout_select.py | 27 +++++++++++++++++++++++++ shopfloor/views/shopfloor_menu.xml | 12 ++++++++++- 7 files changed, 73 insertions(+), 6 deletions(-) diff --git a/shopfloor/actions/data.py b/shopfloor/actions/data.py index aaefbc06dc..19a4a151d4 100644 --- a/shopfloor/actions/data.py +++ b/shopfloor/actions/data.py @@ -48,6 +48,8 @@ def _get_picking_parser(self, record, **kw): # Thus, we make it optional. if "with_progress" in kw: parser.append("progress") + if kw.get("with_priority"): + parser.append("priority") return parser @ensure_model("stock.picking") @@ -55,7 +57,7 @@ def picking(self, record, **kw): return self._jsonify(record, self._get_picking_parser(record, **kw), **kw) def pickings(self, record, **kw): - return self.picking(record, multi=True) + return self.picking(record, multi=True, **kw) @property def _picking_parser(self, **kw): diff --git a/shopfloor/actions/schema.py b/shopfloor/actions/schema.py index bfa0fdba4e..e474fe35de 100644 --- a/shopfloor/actions/schema.py +++ b/shopfloor/actions/schema.py @@ -27,6 +27,7 @@ def picking(self): "scheduled_date": {"type": "string", "nullable": False, "required": True}, "progress": {"type": "float", "nullable": True}, "location_dest": self._schema_dict_of(self.location(), required=False), + "priority": {"type": "string", "nullable": True, "required": False}, } def move_line(self, with_packaging=False, with_picking=False): diff --git a/shopfloor/models/shopfloor_menu.py b/shopfloor/models/shopfloor_menu.py index 7521a67db4..6067bb0a5c 100644 --- a/shopfloor/models/shopfloor_menu.py +++ b/shopfloor/models/shopfloor_menu.py @@ -53,6 +53,12 @@ to scan a destination package. """ +ALLOW_ORDER_PICKINGS_BY_PRIORITY_HELP = """ +When listing all transfers in the scenario, display the priority number +(corresponding to the stars in each transfer in Odoo) +and order them by priority as well. +""" + class ShopfloorMenu(models.Model): _inherit = "shopfloor.menu" @@ -226,6 +232,14 @@ class ShopfloorMenu(models.Model): allow_alternative_destination_package_is_possible = fields.Boolean( compute="_compute_allow_alternative_destination_package_is_possible" ) + order_pickings_by_priority = fields.Boolean( + string="Order transfers by priority", + default=False, + help=ALLOW_ORDER_PICKINGS_BY_PRIORITY_HELP, + ) + order_pickings_by_priority_is_possible = fields.Boolean( + compute="_compute_order_pickings_by_priority_is_possible" + ) @api.onchange("unload_package_at_destination") def _onchange_unload_package_at_destination(self): @@ -455,3 +469,10 @@ def _compute_allow_alternative_destination_package_is_possible(self): menu.allow_alternative_destination_package_is_possible = ( menu.scenario_id.has_option("allow_alternative_destination_package") ) + + @api.depends("scenario_id") + def _compute_order_pickings_by_priority_is_possible(self): + for menu in self: + menu.order_pickings_by_priority_is_possible = menu.scenario_id.has_option( + "order_pickings_by_priority" + ) diff --git a/shopfloor/services/checkout.py b/shopfloor/services/checkout.py index 01b8b6c81b..f8bd61d2bb 100644 --- a/shopfloor/services/checkout.py +++ b/shopfloor/services/checkout.py @@ -91,7 +91,10 @@ def _response_for_manual_selection(self, message=None): self._domain_for_list_stock_picking(), order=self._order_for_list_stock_picking(), ) - data = {"pickings": self.data.pickings(pickings)} + order_by_priority = self.work.menu.order_pickings_by_priority + data = { + "pickings": self.data.pickings(pickings, with_priority=order_by_priority) + } return self._response(next_state="manual_selection", data=data, message=message) def _response_for_select_package(self, picking, lines, message=None): @@ -360,7 +363,10 @@ def _domain_for_list_stock_picking(self): ] def _order_for_list_stock_picking(self): - return "scheduled_date asc, id asc" + base_order = "scheduled_date asc, id asc" + if self.work.menu.order_pickings_by_priority: + return "priority desc, " + base_order + return base_order def list_stock_picking(self): """List stock.picking records available diff --git a/shopfloor/tests/test_checkout_base.py b/shopfloor/tests/test_checkout_base.py index 120e1e71af..e4fef0bfe0 100644 --- a/shopfloor/tests/test_checkout_base.py +++ b/shopfloor/tests/test_checkout_base.py @@ -34,8 +34,8 @@ def _stock_locations_data(self, locations, **kw): return self.service._data_for_locations(locations, **kw) # we test the methods that structure data in test_actions_data.py - def _picking_summary_data(self, picking): - return self.data.picking(picking) + def _picking_summary_data(self, picking, **kw): + return self.data.picking(picking, **kw) def _move_line_data(self, move_line): return self.data.move_line(move_line) diff --git a/shopfloor/tests/test_checkout_select.py b/shopfloor/tests/test_checkout_select.py index 13f4322256..61c831f841 100644 --- a/shopfloor/tests/test_checkout_select.py +++ b/shopfloor/tests/test_checkout_select.py @@ -24,6 +24,33 @@ def test_list_stock_picking(self): self.assert_response(response, next_state="manual_selection", data=expected) + def test_list_stock_picking_order_by_priority(self): + self.menu.sudo().order_pickings_by_priority = True + # Pickings should be ordered by priority, + # and they should also return their priority number to the frontend. + picking1 = self._create_picking() + picking1.priority = "0" + picking2 = self._create_picking() + picking2.priority = "1" + picking3 = self._create_picking() + picking3.priority = "1" + picking4 = self._create_picking() + picking4.priority = "0" + to_assign = picking1 | picking2 | picking3 | picking4 + self._fill_stock_for_moves(to_assign.move_lines, in_package=True) + to_assign.action_assign() + response = self.service.dispatch("list_stock_picking", params={}) + expected = { + "pickings": [ + self._picking_summary_data(picking2, with_priority=True), + self._picking_summary_data(picking3, with_priority=True), + self._picking_summary_data(picking1, with_priority=True), + self._picking_summary_data(picking4, with_priority=True), + ] + } + + self.assert_response(response, next_state="manual_selection", data=expected) + class CheckoutSelectCase(CheckoutCommonCase): @classmethod diff --git a/shopfloor/views/shopfloor_menu.xml b/shopfloor/views/shopfloor_menu.xml index 868dc85c6c..b4f342fae7 100644 --- a/shopfloor/views/shopfloor_menu.xml +++ b/shopfloor/views/shopfloor_menu.xml @@ -167,7 +167,17 @@ invisible="1" /> - + + + + + From 3fd78879f865a832edeefdcb5742215459842a6e Mon Sep 17 00:00:00 2001 From: JuMiSanAr Date: Tue, 24 Oct 2023 10:28:39 +0200 Subject: [PATCH 09/10] shopfloor_mobile: display picking priority in checkout --- shopfloor_mobile/static/wms/src/scenario/checkout.js | 1 + 1 file changed, 1 insertion(+) diff --git a/shopfloor_mobile/static/wms/src/scenario/checkout.js b/shopfloor_mobile/static/wms/src/scenario/checkout.js index d88c2fa524..b1f7d7da50 100644 --- a/shopfloor_mobile/static/wms/src/scenario/checkout.js +++ b/shopfloor_mobile/static/wms/src/scenario/checkout.js @@ -293,6 +293,7 @@ const Checkout = { {path: "origin"}, {path: "carrier.name", label: "Carrier"}, {path: "move_line_count", label: "Lines"}, + {path: "priority", label: "Priority"}, ], }, }; From 0fcc5c4b07b0a692c71fdedb49dde5e64fe51c53 Mon Sep 17 00:00:00 2001 From: JuMiSanAr Date: Tue, 24 Oct 2023 10:27:53 +0200 Subject: [PATCH 10/10] shopfloor: fix missing invisible key in shopfloor_menu.xml --- shopfloor/views/shopfloor_menu.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/shopfloor/views/shopfloor_menu.xml b/shopfloor/views/shopfloor_menu.xml index b4f342fae7..4dadf7bd08 100644 --- a/shopfloor/views/shopfloor_menu.xml +++ b/shopfloor/views/shopfloor_menu.xml @@ -112,6 +112,7 @@ name="scan_location_or_pack_first" attrs="{'invisible': [('scan_location_or_pack_first_is_possible', '=', False)]}" > +