diff --git a/product_packaging_usability/README.rst b/product_packaging_usability/README.rst new file mode 100644 index 000000000..e2dfc1716 --- /dev/null +++ b/product_packaging_usability/README.rst @@ -0,0 +1,88 @@ +=========================== +Product Packaging Usability +=========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:d046ca5ac9966c991ce6c231eeb2fb96988d58d9713904f6bf836f78808a3b2e + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/16.0/product_packaging_usability + :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-16-0/stock-logistics-warehouse-16-0-product_packaging_usability + :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-logistics-warehouse&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +- add search view on Product Packaging model +- add button in product view to switch to packaging + + +.. figure:: https://raw.githubusercontent.com/OCA/stock-logistics-warehouse/16.0/product_packaging_usability/static/description/im1.png + + +.. figure:: https://raw.githubusercontent.com/OCA/stock-logistics-warehouse/16.0/product_packaging_usability/static/description/im2.png + + +.. figure:: https://raw.githubusercontent.com/OCA/stock-logistics-warehouse/16.0/product_packaging_usability/static/description/im3.png + +**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 +~~~~~~~ + +* Akretion + +Contributors +~~~~~~~~~~~~ + +* Akretion: + + * David BEAL + +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/product_packaging_usability/__init__.py b/product_packaging_usability/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/product_packaging_usability/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/product_packaging_usability/__manifest__.py b/product_packaging_usability/__manifest__.py new file mode 100644 index 000000000..1a6978e50 --- /dev/null +++ b/product_packaging_usability/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright Akretion +# License ALGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). + +{ + "name": "Product Packaging Usability", + "summary": "Add sugar to Product Packaging", + "version": "16.0.1.0.0", + "author": "Akretion, Odoo Community Association (OCA)", + "maintainer": ["bealdav"], + "website": "https://github.com/OCA/stock-logistics-warehouse", + "category": "Stock", + "depends": ["product"], + "data": ["views/product_packaging.xml"], + "installable": True, + "license": "AGPL-3", +} diff --git a/product_packaging_usability/models/__init__.py b/product_packaging_usability/models/__init__.py new file mode 100644 index 000000000..2c4d9a88a --- /dev/null +++ b/product_packaging_usability/models/__init__.py @@ -0,0 +1 @@ +from . import product_packaging diff --git a/product_packaging_usability/models/product_packaging.py b/product_packaging_usability/models/product_packaging.py new file mode 100644 index 000000000..9651773bf --- /dev/null +++ b/product_packaging_usability/models/product_packaging.py @@ -0,0 +1,19 @@ +# Copyright Akretion (http://www.akretion.com/) + +from odoo import models + + +class ProductPackaging(models.Model): + _inherit = "product.packaging" + + def ui_goto_packaging_view(self): + self.ensure_one() + action = self.env["ir.actions.act_window"]._for_xml_id( + "product.action_packaging_view" + ) + action["context"] = { + "search_default_product_id": self.product_id.id, + } + variants = self.product_id.product_tmpl_id.product_variant_ids + action["domain"] = f"[('product_id', 'in', {variants.ids})]" + return action diff --git a/product_packaging_usability/readme/CONTRIBUTORS.rst b/product_packaging_usability/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..c950dd9f3 --- /dev/null +++ b/product_packaging_usability/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Akretion: + + * David BEAL diff --git a/product_packaging_usability/readme/DESCRIPTION.rst b/product_packaging_usability/readme/DESCRIPTION.rst new file mode 100644 index 000000000..2e13d3e6c --- /dev/null +++ b/product_packaging_usability/readme/DESCRIPTION.rst @@ -0,0 +1,11 @@ +- add search view on Product Packaging model +- add button in product view to switch to packaging + + +.. figure:: ../static/description/im1.png + + +.. figure:: ../static/description/im2.png + + +.. figure:: ../static/description/im3.png diff --git a/product_packaging_usability/static/description/icon.png b/product_packaging_usability/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/product_packaging_usability/static/description/icon.png differ diff --git a/product_packaging_usability/static/description/im1.png b/product_packaging_usability/static/description/im1.png new file mode 100644 index 000000000..2b79ef252 Binary files /dev/null and b/product_packaging_usability/static/description/im1.png differ diff --git a/product_packaging_usability/static/description/im2.png b/product_packaging_usability/static/description/im2.png new file mode 100644 index 000000000..1f2ddd084 Binary files /dev/null and b/product_packaging_usability/static/description/im2.png differ diff --git a/product_packaging_usability/static/description/im3.png b/product_packaging_usability/static/description/im3.png new file mode 100644 index 000000000..ea1c49a6a Binary files /dev/null and b/product_packaging_usability/static/description/im3.png differ diff --git a/product_packaging_usability/static/description/index.html b/product_packaging_usability/static/description/index.html new file mode 100644 index 000000000..d95ca19e2 --- /dev/null +++ b/product_packaging_usability/static/description/index.html @@ -0,0 +1,438 @@ + + + + + + +Product Packaging Usability + + + +
+

Product Packaging Usability

+ + +

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

+
    +
  • add search view on Product Packaging model
  • +
  • add button in product view to switch to packaging
  • +
+
+https://raw.githubusercontent.com/OCA/stock-logistics-warehouse/16.0/product_packaging_usability/static/description/im1.png +
+
+https://raw.githubusercontent.com/OCA/stock-logistics-warehouse/16.0/product_packaging_usability/static/description/im2.png +
+
+https://raw.githubusercontent.com/OCA/stock-logistics-warehouse/16.0/product_packaging_usability/static/description/im3.png +
+

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

+
    +
  • Akretion
  • +
+
+
+

Contributors

+
    +
  • Akretion:
  • +
+
+ +
+
+
+

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/product_packaging_usability/tests/__init__.py b/product_packaging_usability/tests/__init__.py new file mode 100644 index 000000000..d9b96c4fa --- /dev/null +++ b/product_packaging_usability/tests/__init__.py @@ -0,0 +1 @@ +from . import test_module diff --git a/product_packaging_usability/tests/test_module.py b/product_packaging_usability/tests/test_module.py new file mode 100644 index 000000000..062d43cf4 --- /dev/null +++ b/product_packaging_usability/tests/test_module.py @@ -0,0 +1,20 @@ +from odoo.tests.common import TransactionCase + + +class Test(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + + def test_action(self): + product = self.env.ref("product.product_product_6") + packaging = self.env["product.packaging"].create( + {"name": "any", "product_id": product.id, "qty": 10} + ) + action = packaging.ui_goto_packaging_view() + self.assertIn( + "search_default_product_id", + action["context"], + "Missing key 'search_default_product_id'", + ) diff --git a/product_packaging_usability/views/product_packaging.xml b/product_packaging_usability/views/product_packaging.xml new file mode 100644 index 000000000..6c9255701 --- /dev/null +++ b/product_packaging_usability/views/product_packaging.xml @@ -0,0 +1,42 @@ + + + + + product.packaging + + + + + + + + + + + + + + product.packaging + + + +