From 2162027b5e39e5b80220bb3aa27f3419a0e898e8 Mon Sep 17 00:00:00 2001 From: David Beal Date: Thu, 18 Apr 2024 11:13:52 +0200 Subject: [PATCH] ADD product_code_mixin --- product_code_mixin/README.rst | 87 ++++ product_code_mixin/__init__.py | 1 + product_code_mixin/__manifest__.py | 14 + product_code_mixin/models/__init__.py | 1 + product_code_mixin/models/product.py | 11 + product_code_mixin/readme/CONTRIBUTORS.rst | 3 + product_code_mixin/readme/DESCRIPTION.rst | 10 + .../static/description/index.html | 432 ++++++++++++++++++ .../odoo/addons/product_code_mixin | 1 + setup/product_code_mixin/setup.py | 6 + 10 files changed, 566 insertions(+) create mode 100644 product_code_mixin/README.rst create mode 100644 product_code_mixin/__init__.py create mode 100644 product_code_mixin/__manifest__.py create mode 100644 product_code_mixin/models/__init__.py create mode 100644 product_code_mixin/models/product.py create mode 100644 product_code_mixin/readme/CONTRIBUTORS.rst create mode 100644 product_code_mixin/readme/DESCRIPTION.rst create mode 100644 product_code_mixin/static/description/index.html create mode 120000 setup/product_code_mixin/odoo/addons/product_code_mixin create mode 100644 setup/product_code_mixin/setup.py diff --git a/product_code_mixin/README.rst b/product_code_mixin/README.rst new file mode 100644 index 000000000000..df4fdd9f83a2 --- /dev/null +++ b/product_code_mixin/README.rst @@ -0,0 +1,87 @@ +================== +Product Code Mixin +================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:37815c7fccf469ee26e8f7a20207cf4d10f0a5136bafe179a52ec76597df8696 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/16.0/product_code_mixin + :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-16-0/product-attribute-16-0-product_code_mixin + :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=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module define a mixin to have a product code available in any model which inherit of this mixin. + +This method can be useful for exported data when you don't want deal with [ ] + +Typically you may inherit it with: + +- sale.order.line +- purchase.order.line +- account.move.line +- stock.move + +**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/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_code_mixin/__init__.py b/product_code_mixin/__init__.py new file mode 100644 index 000000000000..0650744f6bc6 --- /dev/null +++ b/product_code_mixin/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/product_code_mixin/__manifest__.py b/product_code_mixin/__manifest__.py new file mode 100644 index 000000000000..7c2aac892b48 --- /dev/null +++ b/product_code_mixin/__manifest__.py @@ -0,0 +1,14 @@ +# Copyright 2024 Akretion - David BEAL +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + "name": "Product Code Mixin", + "version": "16.0.1.0.0", + "category": "Product", + "summary": "Make product code available for any inherited model", + "author": "Akretion, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/product-attribute", + "license": "AGPL-3", + "depends": ["product"], + "data": [], +} diff --git a/product_code_mixin/models/__init__.py b/product_code_mixin/models/__init__.py new file mode 100644 index 000000000000..9649db77a159 --- /dev/null +++ b/product_code_mixin/models/__init__.py @@ -0,0 +1 @@ +from . import product diff --git a/product_code_mixin/models/product.py b/product_code_mixin/models/product.py new file mode 100644 index 000000000000..cc95d1f2fd2c --- /dev/null +++ b/product_code_mixin/models/product.py @@ -0,0 +1,11 @@ +# Copyright 2024 Akretion - David BEAL + +from odoo import fields, models + + +class ProductCodeMixin(models.Model): + _inherit = "product.code.mixin" + + product_code = fields.Char( + related="product_id.default_code", help="Product reference" + ) diff --git a/product_code_mixin/readme/CONTRIBUTORS.rst b/product_code_mixin/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..aeed3c0e8dd8 --- /dev/null +++ b/product_code_mixin/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `Akretion `_: + + * David BEAL diff --git a/product_code_mixin/readme/DESCRIPTION.rst b/product_code_mixin/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..cc7be0978c6c --- /dev/null +++ b/product_code_mixin/readme/DESCRIPTION.rst @@ -0,0 +1,10 @@ +This module define a mixin to have a product code available in any model which inherit of this mixin. + +This method can be useful for exported data when you don't want deal with [ ] + +Typically you may inherit it with: + +- sale.order.line +- purchase.order.line +- account.move.line +- stock.move diff --git a/product_code_mixin/static/description/index.html b/product_code_mixin/static/description/index.html new file mode 100644 index 000000000000..570ce7e443b5 --- /dev/null +++ b/product_code_mixin/static/description/index.html @@ -0,0 +1,432 @@ + + + + + + +Product Code Mixin + + + +
+

Product Code Mixin

+ + +

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

+

This module define a mixin to have a product code available in any model which inherit of this mixin.

+

This method can be useful for exported data when you don’t want deal with [ ]

+

Typically you may inherit it with:

+
    +
  • sale.order.line
  • +
  • purchase.order.line
  • +
  • account.move.line
  • +
  • stock.move
  • +
+

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

+ +
+
+

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/product-attribute project on GitHub.

+

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

+
+
+
+ + diff --git a/setup/product_code_mixin/odoo/addons/product_code_mixin b/setup/product_code_mixin/odoo/addons/product_code_mixin new file mode 120000 index 000000000000..6a85d6e10313 --- /dev/null +++ b/setup/product_code_mixin/odoo/addons/product_code_mixin @@ -0,0 +1 @@ +../../../../product_code_mixin \ No newline at end of file diff --git a/setup/product_code_mixin/setup.py b/setup/product_code_mixin/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/product_code_mixin/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)