diff --git a/setup/stock_picking_show_linked/odoo/addons/stock_picking_show_linked b/setup/stock_picking_show_linked/odoo/addons/stock_picking_show_linked new file mode 120000 index 000000000..efcc94aad --- /dev/null +++ b/setup/stock_picking_show_linked/odoo/addons/stock_picking_show_linked @@ -0,0 +1 @@ +../../../../stock_picking_show_linked \ No newline at end of file diff --git a/setup/stock_picking_show_linked/setup.py b/setup/stock_picking_show_linked/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/stock_picking_show_linked/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_picking_show_linked/README.rst b/stock_picking_show_linked/README.rst new file mode 100644 index 000000000..7ba6e3a22 --- /dev/null +++ b/stock_picking_show_linked/README.rst @@ -0,0 +1,77 @@ +========================= +Stock Picking Show Linked +========================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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--logistics--warehouse-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-warehouse/tree/15.0/stock_picking_show_linked + :alt: OCA/stock-logistics-warehouse +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-15-0/stock-logistics-warehouse-15-0-stock_picking_show_linked + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/153/15.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module should allow a user to display, on smart buttons in a picking: + +* Destination pickings: the pickings associated to destination moves indicated in the moves in this picking + +* Origin pickings: the pickings associated to origin moves indicated in the moves in this picking + +**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 smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* ForgeFlow + +Contributors +~~~~~~~~~~~~ + +* Juany Davila + +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-logistics-warehouse `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_picking_show_linked/__init__.py b/stock_picking_show_linked/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/stock_picking_show_linked/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/stock_picking_show_linked/__manifest__.py b/stock_picking_show_linked/__manifest__.py new file mode 100644 index 000000000..bd41285a2 --- /dev/null +++ b/stock_picking_show_linked/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2022 ForgeFlow S.L. (https://www.forgeflow.com) +{ + "name": "Stock Picking Show Linked", + "summary": """ + This addon allows to easily access related pickings + (in the case of chained routes) through a button + in the parent picking view. + """, + "version": "16.0.1.0.0", + "author": "ForgeFlow, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/stock-logistics-warehouse", + "category": "Warehouse Management", + "depends": [ + "stock", + ], + "data": ["views/stock_picking.xml"], + "license": "AGPL-3", + "installable": True, +} diff --git a/stock_picking_show_linked/i18n/stock_picking_show_linked.pot b/stock_picking_show_linked/i18n/stock_picking_show_linked.pot new file mode 100644 index 000000000..e89805922 --- /dev/null +++ b/stock_picking_show_linked/i18n/stock_picking_show_linked.pot @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_show_linked +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \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_show_linked +#: model:ir.model.fields,field_description:stock_picking_show_linked.field_stock_picking__dest_picking_count +msgid "Dest Picking Count" +msgstr "" + +#. module: stock_picking_show_linked +#: model_terms:ir.ui.view,arch_db:stock_picking_show_linked.stock_picking_show_linked_form_inherit +msgid "Dest. Transfers" +msgstr "" + +#. module: stock_picking_show_linked +#: model:ir.model.fields,field_description:stock_picking_show_linked.field_stock_picking__origin_picking_count +msgid "Origin Picking Count" +msgstr "" + +#. module: stock_picking_show_linked +#: model_terms:ir.ui.view,arch_db:stock_picking_show_linked.stock_picking_show_linked_form_inherit +msgid "Origin Transfers" +msgstr "" + +#. module: stock_picking_show_linked +#: model:ir.model,name:stock_picking_show_linked.model_stock_picking +msgid "Transfer" +msgstr "" diff --git a/stock_picking_show_linked/models/__init__.py b/stock_picking_show_linked/models/__init__.py new file mode 100644 index 000000000..ae4c27227 --- /dev/null +++ b/stock_picking_show_linked/models/__init__.py @@ -0,0 +1 @@ +from . import stock_picking diff --git a/stock_picking_show_linked/models/stock_picking.py b/stock_picking_show_linked/models/stock_picking.py new file mode 100644 index 000000000..d1cb3f18e --- /dev/null +++ b/stock_picking_show_linked/models/stock_picking.py @@ -0,0 +1,47 @@ +# Copyright 2022 ForgeFlow S.L. (https://www.forgeflow.com) + +from odoo import api, fields, models + + +class StockPicking(models.Model): + _inherit = "stock.picking" + + dest_picking_count = fields.Integer(compute="_compute_picking_count") + origin_picking_count = fields.Integer(compute="_compute_picking_count") + + @api.depends("move_ids") + def _compute_picking_count(self): + for record in self: + origin_pickings = record.mapped("move_ids.move_orig_ids.picking_id") + dest_pickings = record.mapped("move_ids.move_dest_ids.picking_id") + record.origin_picking_count = len(origin_pickings) + record.dest_picking_count = len(dest_pickings) + + def _get_action_link(self, pickings): + result = self.env["ir.actions.actions"]._for_xml_id( + "stock.action_picking_tree_all" + ) + # choose the view_mode accordingly + if not pickings or len(pickings) > 1: + result["domain"] = "[('id','in',%s)]" % pickings + elif len(pickings) == 1: + res = self.env.ref("stock.view_picking_form", False) + form_view = [(res and res.id or False, "form")] + if "views" in result: + result["views"] = form_view + [ + (state, view) for state, view in result["views"] if view != "form" + ] + else: + result["views"] = form_view + result["res_id"] = pickings[0] + return result + + def action_stock_picking_origin(self): + pick_ids = self.mapped("move_ids.move_orig_ids.picking_id") + result = self._get_action_link(pick_ids.ids) + return result + + def action_stock_picking_destination(self): + pick_ids = self.mapped("move_ids.move_dest_ids.picking_id") + result = self._get_action_link(pick_ids.ids) + return result diff --git a/stock_picking_show_linked/readme/CONTRIBUTORS.rst b/stock_picking_show_linked/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..960dd0adb --- /dev/null +++ b/stock_picking_show_linked/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Juany Davila diff --git a/stock_picking_show_linked/readme/DESCRIPTION.rst b/stock_picking_show_linked/readme/DESCRIPTION.rst new file mode 100644 index 000000000..5b1e6deb5 --- /dev/null +++ b/stock_picking_show_linked/readme/DESCRIPTION.rst @@ -0,0 +1,5 @@ +This module should allow a user to display, on smart buttons in a picking: + +* Destination pickings: the pickings associated to destination moves indicated in the moves in this picking + +* Origin pickings: the pickings associated to origin moves indicated in the moves in this picking diff --git a/stock_picking_show_linked/static/description/icon.png b/stock_picking_show_linked/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/stock_picking_show_linked/static/description/icon.png differ diff --git a/stock_picking_show_linked/static/description/index.html b/stock_picking_show_linked/static/description/index.html new file mode 100644 index 000000000..e5750a9e7 --- /dev/null +++ b/stock_picking_show_linked/static/description/index.html @@ -0,0 +1,423 @@ + + + + + + +Stock Picking Show Linked + + + +
+

Stock Picking Show Linked

+ + +

Beta License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runbot

+

This module should allow a user to display, on smart buttons in a picking:

+
    +
  • Destination pickings: the pickings associated to destination moves indicated in the moves in this picking
  • +
  • Origin pickings: the pickings associated to origin moves indicated in the moves in this picking
  • +
+

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 smashing it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • ForgeFlow
  • +
+
+ +
+

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-logistics-warehouse project on GitHub.

+

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

+
+
+
+ + diff --git a/stock_picking_show_linked/views/stock_picking.xml b/stock_picking_show_linked/views/stock_picking.xml new file mode 100644 index 000000000..1c26ec347 --- /dev/null +++ b/stock_picking_show_linked/views/stock_picking.xml @@ -0,0 +1,40 @@ + + + + stock_picking_show_linked.form + stock.picking + + +
+ + + + +
+
+
+