diff --git a/product_form_pricelist_item/README.rst b/product_form_pricelist_item/README.rst new file mode 100644 index 00000000000..24e0c4f59a4 --- /dev/null +++ b/product_form_pricelist_item/README.rst @@ -0,0 +1,91 @@ +=========================== +Product Form Pricelist Item +=========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:6f732a77aecf97ee27092798dc397c82b5b07f914c269f400b43437a4ecb1c00 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fproduct--attribute-lightgray.png?logo=github + :target: https://github.com/OCA/product-attribute/tree/18.0/product_form_pricelist_item + :alt: OCA/product-attribute +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/product-attribute-18-0/product-attribute-18-0-product_form_pricelist_item + :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/product-attribute&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to display and edit product pricelists directly on +the product form level (Odoo introduces it on 18.4). + +**Table of contents** + +.. contents:: + :local: + +Use Cases / Context +=================== + +Odoo (before 18.4) does not display or allows from product form to +access all the linked pricelist items. + +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 +------- + +* ACSONE SA/NV + +Contributors +------------ + +- Denis Roussel denis.roussel@acsone.eu + +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. + +.. |maintainer-rousseldenis| image:: https://github.com/rousseldenis.png?size=40px + :target: https://github.com/rousseldenis + :alt: rousseldenis + +Current `maintainer `__: + +|maintainer-rousseldenis| + +This module is part of the `OCA/product-attribute `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/product_form_pricelist_item/__init__.py b/product_form_pricelist_item/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/product_form_pricelist_item/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/product_form_pricelist_item/__manifest__.py b/product_form_pricelist_item/__manifest__.py new file mode 100644 index 00000000000..ae6621ba2f9 --- /dev/null +++ b/product_form_pricelist_item/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2025 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Product Form Pricelist Item", + "summary": """This module allows to display product pricelist items + on product form level""", + "version": "18.0.1.0.0", + "license": "AGPL-3", + "maintainers": ["rousseldenis"], + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/product-attribute", + "depends": ["product"], + "data": [ + "views/product_template.xml", + ], +} diff --git a/product_form_pricelist_item/models/__init__.py b/product_form_pricelist_item/models/__init__.py new file mode 100644 index 00000000000..18b37e85320 --- /dev/null +++ b/product_form_pricelist_item/models/__init__.py @@ -0,0 +1,2 @@ +from . import product_product +from . import product_template diff --git a/product_form_pricelist_item/models/product_product.py b/product_form_pricelist_item/models/product_product.py new file mode 100644 index 00000000000..4a4638638b0 --- /dev/null +++ b/product_form_pricelist_item/models/product_product.py @@ -0,0 +1,13 @@ +# Copyright 2025 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ProductProduct(models.Model): + _inherit = "product.product" + + pricelist_item_ids = fields.One2many( + comodel_name="product.pricelist.item", + inverse_name="product_id", + ) diff --git a/product_form_pricelist_item/models/product_template.py b/product_form_pricelist_item/models/product_template.py new file mode 100644 index 00000000000..3eaa4187174 --- /dev/null +++ b/product_form_pricelist_item/models/product_template.py @@ -0,0 +1,13 @@ +# Copyright 2025 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + pricelist_item_ids = fields.One2many( + comodel_name="product.pricelist.item", + inverse_name="product_tmpl_id", + ) diff --git a/product_form_pricelist_item/pyproject.toml b/product_form_pricelist_item/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/product_form_pricelist_item/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/product_form_pricelist_item/readme/CONTEXT.md b/product_form_pricelist_item/readme/CONTEXT.md new file mode 100644 index 00000000000..f1e2fabde78 --- /dev/null +++ b/product_form_pricelist_item/readme/CONTEXT.md @@ -0,0 +1 @@ +Odoo (before 18.4) does not display or allows from product form to access all the linked pricelist items. diff --git a/product_form_pricelist_item/readme/CONTRIBUTORS.md b/product_form_pricelist_item/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..4e7e6847269 --- /dev/null +++ b/product_form_pricelist_item/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Denis Roussel diff --git a/product_form_pricelist_item/readme/DESCRIPTION.md b/product_form_pricelist_item/readme/DESCRIPTION.md new file mode 100644 index 00000000000..62797991b0f --- /dev/null +++ b/product_form_pricelist_item/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module allows to display and edit product pricelists directly on the +product form level (Odoo introduces it on 18.4). diff --git a/product_form_pricelist_item/static/description/icon.png b/product_form_pricelist_item/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/product_form_pricelist_item/static/description/icon.png differ diff --git a/product_form_pricelist_item/static/description/index.html b/product_form_pricelist_item/static/description/index.html new file mode 100644 index 00000000000..815d36f2181 --- /dev/null +++ b/product_form_pricelist_item/static/description/index.html @@ -0,0 +1,432 @@ + + + + + +Product Form Pricelist Item + + + +
+

Product Form Pricelist Item

+ + +

Beta License: AGPL-3 OCA/product-attribute Translate me on Weblate Try me on Runboat

+

This module allows to display and edit product pricelists directly on +the product form level (Odoo introduces it on 18.4).

+

Table of contents

+ +
+

Use Cases / Context

+

Odoo (before 18.4) does not display or allows from product form to +access all the linked pricelist items.

+
+
+

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

+
    +
  • ACSONE SA/NV
  • +
+
+
+

Contributors

+ +
+
+

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.

+

Current maintainer:

+

rousseldenis

+

This module is part of the OCA/product-attribute project on GitHub.

+

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

+
+
+
+ + diff --git a/product_form_pricelist_item/tests/__init__.py b/product_form_pricelist_item/tests/__init__.py new file mode 100644 index 00000000000..861860fe966 --- /dev/null +++ b/product_form_pricelist_item/tests/__init__.py @@ -0,0 +1 @@ +from . import test_product_form_pricelist_item diff --git a/product_form_pricelist_item/tests/test_product_form_pricelist_item.py b/product_form_pricelist_item/tests/test_product_form_pricelist_item.py new file mode 100644 index 00000000000..4581900adc0 --- /dev/null +++ b/product_form_pricelist_item/tests/test_product_form_pricelist_item.py @@ -0,0 +1,35 @@ +# Copyright 2025 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import Command + +from odoo.addons.base.tests.common import BaseCommon + + +class TestProuctFormList(BaseCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.product = cls.env["product.product"].create( + { + "name": "Product 1", + } + ) + cls.pricelist = cls.env["product.pricelist"].create( + { + "name": "List 1", + "item_ids": [ + Command.create( + { + "product_id": cls.product.id, + "applied_on": "0_product_variant", + "compute_price": "percentage", + "percent_price": 20.0, + } + ) + ], + } + ) + + def test_product_pricelist(self): + self.product.invalidate_recordset() + self.assertEqual(self.pricelist.item_ids, self.product.pricelist_item_ids) diff --git a/product_form_pricelist_item/views/product_template.xml b/product_form_pricelist_item/views/product_template.xml new file mode 100644 index 00000000000..48a62d4245a --- /dev/null +++ b/product_form_pricelist_item/views/product_template.xml @@ -0,0 +1,249 @@ + + + + + product.template.form + product.template + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ + + + + + + + +
+ +
+
+
+
+
+
+