From 4b05fb5ff17acfe73f5d5761f32d066d447c4ace Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (ACSONE)" Date: Mon, 14 Nov 2022 14:12:10 +0100 Subject: [PATCH] [MIG] stock_release_channel: Migration to 16.0 --- .../odoo/addons/stock_release_channel | 1 + setup/stock_release_channel/setup.py | 6 ++++++ stock_release_channel/README.rst | 10 +++++----- stock_release_channel/__manifest__.py | 9 ++++++++- stock_release_channel/models/stock_move.py | 3 ++- .../models/stock_release_channel.py | 17 ++++++++++------ .../static/description/index.html | 8 ++++---- .../src/js/progressbar_fractional_widget.js | 4 ++-- stock_release_channel/tests/common.py | 4 ++-- .../tests/test_channel_action.py | 8 ++++---- .../tests/test_channel_computed_fields.py | 12 +++++------ .../tests/test_channel_release_batch.py | 2 +- stock_release_channel/views/assets.xml | 20 ------------------- 13 files changed, 52 insertions(+), 52 deletions(-) create mode 120000 setup/stock_release_channel/odoo/addons/stock_release_channel create mode 100644 setup/stock_release_channel/setup.py delete mode 100644 stock_release_channel/views/assets.xml diff --git a/setup/stock_release_channel/odoo/addons/stock_release_channel b/setup/stock_release_channel/odoo/addons/stock_release_channel new file mode 120000 index 0000000000..affde1dccc --- /dev/null +++ b/setup/stock_release_channel/odoo/addons/stock_release_channel @@ -0,0 +1 @@ +../../../../stock_release_channel \ No newline at end of file diff --git a/setup/stock_release_channel/setup.py b/setup/stock_release_channel/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/stock_release_channel/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_release_channel/README.rst b/stock_release_channel/README.rst index 9fe61557a5..9bf90f008a 100644 --- a/stock_release_channel/README.rst +++ b/stock_release_channel/README.rst @@ -14,13 +14,13 @@ Stock Release Channels :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/14.0/stock_release_channel + :target: https://github.com/OCA/wms/tree/16.0/stock_release_channel :alt: OCA/wms .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/wms-14-0/wms-14-0-stock_release_channel + :target: https://translation.odoo-community.org/projects/wms-16-0/wms-16-0-stock_release_channel :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/285/14.0 + :target: https://runbot.odoo-community.org/runbot/285/16.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -70,7 +70,7 @@ 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 smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -124,6 +124,6 @@ Current `maintainer `__: |maintainer-sebalix| -This module is part of the `OCA/wms `_ project on GitHub. +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_release_channel/__manifest__.py b/stock_release_channel/__manifest__.py index d19c4f9965..4e91dfebba 100644 --- a/stock_release_channel/__manifest__.py +++ b/stock_release_channel/__manifest__.py @@ -11,12 +11,13 @@ "maintainers": ["sebalix"], "website": "https://github.com/OCA/wms", "depends": [ + "web", "sale_stock", "stock_available_to_promise_release", # OCA/wms "queue_job", # OCA/queue ], "data": [ - "views/assets.xml", + # "views/assets.xml", "views/stock_release_channel_views.xml", "views/stock_picking_views.xml", "data/stock_release_channel_data.xml", @@ -24,5 +25,11 @@ "data/ir_cron_data.xml", "security/stock_release_channel.xml", ], + "assets": { + "web.assets_backend": [ + "stock_release_channel/static/src/scss/stock_release_channel.scss", + "stock_release_channel/static/src/js/progressbar_fractional_widget.js", + ], + }, "installable": True, } diff --git a/stock_release_channel/models/stock_move.py b/stock_release_channel/models/stock_move.py index c701484ecc..d1c7a366ee 100644 --- a/stock_release_channel/models/stock_move.py +++ b/stock_release_channel/models/stock_move.py @@ -11,5 +11,6 @@ def release_available_to_promise(self): # after releasing, we re-assign a release channel, # as we may release only partially, the channel may # change - super().release_available_to_promise() + res = super().release_available_to_promise() self.picking_id.assign_release_channel() + return res diff --git a/stock_release_channel/models/stock_release_channel.py b/stock_release_channel/models/stock_release_channel.py index 07442365ba..45495abe16 100644 --- a/stock_release_channel/models/stock_release_channel.py +++ b/stock_release_channel/models/stock_release_channel.py @@ -289,8 +289,10 @@ def _query_get_chain(self, pickings): return (query, (tuple(pickings.ids),)) def _compute_picking_chain(self): - self.env["stock.move"].flush(["move_dest_ids", "move_orig_ids", "picking_id"]) - self.env["stock.picking"].flush(["state"]) + self.env["stock.move"].flush_model( + ["move_dest_ids", "move_orig_ids", "picking_id"] + ) + self.env["stock.picking"].flush_model(["state"]) for channel in self: domain = self._field_picking_domains()["count_picking_released"] domain += [("release_channel_id", "=", channel.id)] @@ -421,9 +423,12 @@ def _eval_code(self, pickings): safe_eval(expr, eval_context, mode="exec", nocopy=True) except Exception as err: raise exceptions.UserError( - _("Error when evaluating the channel's code:\n %s \n(%s)") - % (self.name, err) - ) + _( + "Error when evaluating the channel's code:\n %(name)s \n(%(error)s)", + name=self.name, + error=err, + ) + ) from err # normally "pickings" is always set as we set it in the eval context, # but let assume the worst case with someone using "del pickings" return eval_context.get("pickings", self.env["stock.picking"].browse()) @@ -537,7 +542,7 @@ def get_action_picking_form(self): action["context"] = {} if not self.last_done_picking_id: raise exceptions.UserError( - _("Channel %s has no validated transfer yet.") % (self.name,) + _("Channel %(name)s has no validated transfer yet.", name=self.name) ) action["res_id"] = self.last_done_picking_id.id return action diff --git a/stock_release_channel/static/description/index.html b/stock_release_channel/static/description/index.html index 7fdef34593..dc15ae41d9 100644 --- a/stock_release_channel/static/description/index.html +++ b/stock_release_channel/static/description/index.html @@ -3,7 +3,7 @@ - + Stock Release Channels