From e6bac5e8aaa40bd4ce3f914605d2d6b7cbbc793a Mon Sep 17 00:00:00 2001 From: David Date: Wed, 17 Apr 2024 15:47:31 +0200 Subject: [PATCH] [ADD] stock_picking_batch_weighing: New module TT47127 --- .../odoo/addons/stock_picking_batch_weighing | 1 + setup/stock_picking_batch_weighing/setup.py | 6 + stock_picking_batch_weighing/README.rst | 80 ++++ stock_picking_batch_weighing/__init__.py | 2 + stock_picking_batch_weighing/__manifest__.py | 16 + stock_picking_batch_weighing/i18n/es.po | 76 ++++ .../i18n/stock_picking_batch_weighing.pot | 74 +++ .../models/__init__.py | 2 + .../models/stock_move.py | 16 + .../models/stock_picking_batch.py | 34 ++ .../readme/CONTRIBUTORS.md | 3 + .../readme/DESCRIPTION.md | 1 + .../static/description/index.html | 425 ++++++++++++++++++ .../views/stock_picking_batch_views.xml | 39 ++ .../wizards/__init__.py | 1 + .../wizards/weigh_operation_selection.py | 20 + 16 files changed, 796 insertions(+) create mode 120000 setup/stock_picking_batch_weighing/odoo/addons/stock_picking_batch_weighing create mode 100644 setup/stock_picking_batch_weighing/setup.py create mode 100644 stock_picking_batch_weighing/README.rst create mode 100644 stock_picking_batch_weighing/__init__.py create mode 100644 stock_picking_batch_weighing/__manifest__.py create mode 100644 stock_picking_batch_weighing/i18n/es.po create mode 100644 stock_picking_batch_weighing/i18n/stock_picking_batch_weighing.pot create mode 100644 stock_picking_batch_weighing/models/__init__.py create mode 100644 stock_picking_batch_weighing/models/stock_move.py create mode 100644 stock_picking_batch_weighing/models/stock_picking_batch.py create mode 100644 stock_picking_batch_weighing/readme/CONTRIBUTORS.md create mode 100644 stock_picking_batch_weighing/readme/DESCRIPTION.md create mode 100644 stock_picking_batch_weighing/static/description/index.html create mode 100644 stock_picking_batch_weighing/views/stock_picking_batch_views.xml create mode 100644 stock_picking_batch_weighing/wizards/__init__.py create mode 100644 stock_picking_batch_weighing/wizards/weigh_operation_selection.py diff --git a/setup/stock_picking_batch_weighing/odoo/addons/stock_picking_batch_weighing b/setup/stock_picking_batch_weighing/odoo/addons/stock_picking_batch_weighing new file mode 120000 index 00000000..ffd41f36 --- /dev/null +++ b/setup/stock_picking_batch_weighing/odoo/addons/stock_picking_batch_weighing @@ -0,0 +1 @@ +../../../../stock_picking_batch_weighing \ No newline at end of file diff --git a/setup/stock_picking_batch_weighing/setup.py b/setup/stock_picking_batch_weighing/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/stock_picking_batch_weighing/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_picking_batch_weighing/README.rst b/stock_picking_batch_weighing/README.rst new file mode 100644 index 00000000..ab6f41f7 --- /dev/null +++ b/stock_picking_batch_weighing/README.rst @@ -0,0 +1,80 @@ +==================================== +Weighing assistant in batch pickings +==================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:4c66742998294dc1a2cda1baab1b6a2921b00c423fe8325408af433c2543a566 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fstock--weighing-lightgray.png?logo=github + :target: https://github.com/OCA/stock-weighing/tree/15.0/stock_picking_batch_weighing + :alt: OCA/stock-weighing +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-weighing-15-0/stock-weighing-15-0-stock_picking_batch_weighing + :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/stock-weighing&target_branch=15.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +We can go to the weighing operations from an action button in the batch +picking form. + +**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 +------- + +* Tecnativa + +Contributors +------------ + +- `Tecnativa `__ + + - David Vidal + - Sergio Teruel + +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/stock-weighing `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_picking_batch_weighing/__init__.py b/stock_picking_batch_weighing/__init__.py new file mode 100644 index 00000000..aee8895e --- /dev/null +++ b/stock_picking_batch_weighing/__init__.py @@ -0,0 +1,2 @@ +from . import models +from . import wizards diff --git a/stock_picking_batch_weighing/__manifest__.py b/stock_picking_batch_weighing/__manifest__.py new file mode 100644 index 00000000..ae1009e2 --- /dev/null +++ b/stock_picking_batch_weighing/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright 2024 Tecnativa - David Vidal +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +{ + "name": "Weighing assistant in batch pickings", + "summary": "Launch the weighing assistant from batch pickings", + "version": "15.0.1.0.0", + "author": "Tecnativa, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/stock-weighing", + "license": "AGPL-3", + "category": "Inventory", + "depends": [ + "stock_weighing", + "stock_picking_batch", + ], + "data": ["views/stock_picking_batch_views.xml"], +} diff --git a/stock_picking_batch_weighing/i18n/es.po b/stock_picking_batch_weighing/i18n/es.po new file mode 100644 index 00000000..d3cf9b51 --- /dev/null +++ b/stock_picking_batch_weighing/i18n/es.po @@ -0,0 +1,76 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_batch_weighing +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-07-17 09:43+0000\n" +"PO-Revision-Date: 2024-07-17 11:45+0200\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.4.4\n" + +#. module: stock_picking_batch_weighing +#: code:addons/stock_picking_batch_weighing/wizards/weigh_operation_selection.py:0 +#, python-format +msgid "Batch Pickings" +msgstr "Agrupación de albaranes" + +#. module: stock_picking_batch_weighing +#: model:ir.model,name:stock_picking_batch_weighing.model_stock_picking_batch +msgid "Batch Transfer" +msgstr "Agrupación de albaranes" + +#. module: stock_picking_batch_weighing +#: model:ir.model.fields,field_description:stock_picking_batch_weighing.field_stock_picking_batch__has_weighing_operations +msgid "Has Weighing Operations" +msgstr "Tiene operaciones de pesaje" + +#. module: stock_picking_batch_weighing +#: model:ir.model,name:stock_picking_batch_weighing.model_stock_move +msgid "Stock Move" +msgstr "Movimiento de stock" + +#. module: stock_picking_batch_weighing +#: model_terms:ir.ui.view,arch_db:stock_picking_batch_weighing.stock_picking_batch_form +msgid "Weigh" +msgstr "Pesar" + +#. module: stock_picking_batch_weighing +#: model:ir.model.fields,help:stock_picking_batch_weighing.field_stock_picking_batch__weighing_operations +msgid "Weighed products are done from weighing operations" +msgstr "Los productos pesado están realizados desde operaciones de pesaje" + +#. module: stock_picking_batch_weighing +#: model:ir.model.fields,field_description:stock_picking_batch_weighing.field_stock_picking_batch__weighing_operations +msgid "Weighing Operations" +msgstr "Operaciones de pesaje" + +#. module: stock_picking_batch_weighing +#: code:addons/stock_picking_batch_weighing/wizards/weigh_operation_selection.py:0 +#, python-format +msgid "Weighing batch pickings" +msgstr "Pesaje de agrupación de albaranes" + +#. module: stock_picking_batch_weighing +#: code:addons/stock_picking_batch_weighing/models/stock_picking_batch.py:0 +#, python-format +msgid "Weighing operations for %(name)s" +msgstr "Operaciones de pesaje para %(name)s" + +#. module: stock_picking_batch_weighing +#: model_terms:ir.ui.view,arch_db:stock_picking_batch_weighing.stock_picking_batch_kanban +msgid "Weighings" +msgstr "Pesajes" + +#. module: stock_picking_batch_weighing +#: model:ir.model,name:stock_picking_batch_weighing.model_weigh_operation_selection +msgid "weigh operation selection screen" +msgstr "pantalla de selección de operación de pesaje" diff --git a/stock_picking_batch_weighing/i18n/stock_picking_batch_weighing.pot b/stock_picking_batch_weighing/i18n/stock_picking_batch_weighing.pot new file mode 100644 index 00000000..2c635352 --- /dev/null +++ b/stock_picking_batch_weighing/i18n/stock_picking_batch_weighing.pot @@ -0,0 +1,74 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_batch_weighing +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-07-17 09:43+0000\n" +"PO-Revision-Date: 2024-07-17 09:43+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: stock_picking_batch_weighing +#: code:addons/stock_picking_batch_weighing/wizards/weigh_operation_selection.py:0 +#, python-format +msgid "Batch Pickings" +msgstr "" + +#. module: stock_picking_batch_weighing +#: model:ir.model,name:stock_picking_batch_weighing.model_stock_picking_batch +msgid "Batch Transfer" +msgstr "" + +#. module: stock_picking_batch_weighing +#: model:ir.model.fields,field_description:stock_picking_batch_weighing.field_stock_picking_batch__has_weighing_operations +msgid "Has Weighing Operations" +msgstr "" + +#. module: stock_picking_batch_weighing +#: model:ir.model,name:stock_picking_batch_weighing.model_stock_move +msgid "Stock Move" +msgstr "" + +#. module: stock_picking_batch_weighing +#: model_terms:ir.ui.view,arch_db:stock_picking_batch_weighing.stock_picking_batch_form +msgid "Weigh" +msgstr "" + +#. module: stock_picking_batch_weighing +#: model:ir.model.fields,help:stock_picking_batch_weighing.field_stock_picking_batch__weighing_operations +msgid "Weighed products are done from weighing operations" +msgstr "" + +#. module: stock_picking_batch_weighing +#: model:ir.model.fields,field_description:stock_picking_batch_weighing.field_stock_picking_batch__weighing_operations +msgid "Weighing Operations" +msgstr "" + +#. module: stock_picking_batch_weighing +#: code:addons/stock_picking_batch_weighing/wizards/weigh_operation_selection.py:0 +#, python-format +msgid "Weighing batch pickings" +msgstr "" + +#. module: stock_picking_batch_weighing +#: code:addons/stock_picking_batch_weighing/models/stock_picking_batch.py:0 +#, python-format +msgid "Weighing operations for %(name)s" +msgstr "" + +#. module: stock_picking_batch_weighing +#: model_terms:ir.ui.view,arch_db:stock_picking_batch_weighing.stock_picking_batch_kanban +msgid "Weighings" +msgstr "" + +#. module: stock_picking_batch_weighing +#: model:ir.model,name:stock_picking_batch_weighing.model_weigh_operation_selection +msgid "weigh operation selection screen" +msgstr "" diff --git a/stock_picking_batch_weighing/models/__init__.py b/stock_picking_batch_weighing/models/__init__.py new file mode 100644 index 00000000..0dc450d2 --- /dev/null +++ b/stock_picking_batch_weighing/models/__init__.py @@ -0,0 +1,2 @@ +from . import stock_picking_batch +from . import stock_move diff --git a/stock_picking_batch_weighing/models/stock_move.py b/stock_picking_batch_weighing/models/stock_move.py new file mode 100644 index 00000000..316718d8 --- /dev/null +++ b/stock_picking_batch_weighing/models/stock_move.py @@ -0,0 +1,16 @@ +# Copyright 2024 Tecnativa - David Vidal +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import api, models + + +class StockMove(models.Model): + _inherit = "stock.move" + + @api.model + def action_stock_batch_picking_weighing(self): + """Used in the start screen""" + action = self.env["ir.actions.act_window"]._for_xml_id( + "stock_picking_batch.stock_picking_batch_action" + ) + action["views"] = [[False, "kanban"], [False, "list"]] + return action diff --git a/stock_picking_batch_weighing/models/stock_picking_batch.py b/stock_picking_batch_weighing/models/stock_picking_batch.py new file mode 100644 index 00000000..21851a96 --- /dev/null +++ b/stock_picking_batch_weighing/models/stock_picking_batch.py @@ -0,0 +1,34 @@ +# Copyright 2024 Tecnativa - David Vidal +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +import ast + +from odoo import _, api, fields, models + + +class StockPickingBatch(models.Model): + _inherit = "stock.picking.batch" + + weighing_operations = fields.Boolean(related="picking_type_id.weighing_operations") + has_weighing_operations = fields.Boolean(compute="_compute_has_weighing_operations") + + @api.depends("picking_ids") + def _compute_has_weighing_operations(self): + for batch in self: + batch.has_weighing_operations = batch.picking_ids.filtered( + "has_weighing_operations" + ) + + def action_weighing_operations(self): + """Weight operations for this picking""" + action = self.env["ir.actions.actions"]._for_xml_id( + "stock_weighing.weighing_operation_action" + ) + weighings = self.move_ids.filtered("has_weight") + action["name"] = _("Weighing operations for %(name)s", name=self.name) + action["domain"] = [("id", "in", weighings.ids)] + action["context"] = dict( + self.env.context, + **ast.literal_eval(action["context"]), + group_by=["picking_id"] + ) + return action diff --git a/stock_picking_batch_weighing/readme/CONTRIBUTORS.md b/stock_picking_batch_weighing/readme/CONTRIBUTORS.md new file mode 100644 index 00000000..295408bb --- /dev/null +++ b/stock_picking_batch_weighing/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- [Tecnativa](https://www.tecnativa.com) + - David Vidal + - Sergio Teruel diff --git a/stock_picking_batch_weighing/readme/DESCRIPTION.md b/stock_picking_batch_weighing/readme/DESCRIPTION.md new file mode 100644 index 00000000..ca31cf06 --- /dev/null +++ b/stock_picking_batch_weighing/readme/DESCRIPTION.md @@ -0,0 +1 @@ +We can go to the weighing operations from an action button in the batch picking form. diff --git a/stock_picking_batch_weighing/static/description/index.html b/stock_picking_batch_weighing/static/description/index.html new file mode 100644 index 00000000..b31d5863 --- /dev/null +++ b/stock_picking_batch_weighing/static/description/index.html @@ -0,0 +1,425 @@ + + + + + +Weighing assistant in batch pickings + + + +
+

Weighing assistant in batch pickings

+ + +

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

+

We can go to the weighing operations from an action button in the batch +picking form.

+

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

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+
    +
  • Tecnativa
      +
    • David Vidal
    • +
    • Sergio Teruel
    • +
    +
  • +
+
+
+

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/stock-weighing project on GitHub.

+

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

+
+
+
+ + diff --git a/stock_picking_batch_weighing/views/stock_picking_batch_views.xml b/stock_picking_batch_weighing/views/stock_picking_batch_views.xml new file mode 100644 index 00000000..135ae067 --- /dev/null +++ b/stock_picking_batch_weighing/views/stock_picking_batch_views.xml @@ -0,0 +1,39 @@ + + + + stock.picking.batch + + +
+ + +
+
+
+ + stock.picking.batch + + + + + + + + + + +
diff --git a/stock_picking_batch_weighing/wizards/__init__.py b/stock_picking_batch_weighing/wizards/__init__.py new file mode 100644 index 00000000..1b5a7d15 --- /dev/null +++ b/stock_picking_batch_weighing/wizards/__init__.py @@ -0,0 +1 @@ +from . import weigh_operation_selection diff --git a/stock_picking_batch_weighing/wizards/weigh_operation_selection.py b/stock_picking_batch_weighing/wizards/weigh_operation_selection.py new file mode 100644 index 00000000..1f8d8e4e --- /dev/null +++ b/stock_picking_batch_weighing/wizards/weigh_operation_selection.py @@ -0,0 +1,20 @@ +# Copyright 2024 Tecnativa - David Vidal +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import _, api, models + + +class WeightOperationSelection(models.TransientModel): + _inherit = "weigh.operation.selection" + + @api.model + def _get_weighing_start_screen_actions(self): + actions = super()._get_weighing_start_screen_actions() + actions.append( + { + "title": _("Batch Pickings"), + "description": _("Weighing batch pickings"), + "icon": "fa-truck", + "method": "action_stock_batch_picking_weighing", + } + ) + return actions