diff --git a/product_category_type/README.rst b/product_category_type/README.rst new file mode 100644 index 00000000000..4525837d168 --- /dev/null +++ b/product_category_type/README.rst @@ -0,0 +1,104 @@ +===================== +Product Category Type +===================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:c00a45ebcba2d1b0c250b5924ff6d7936bf326e6ad624c152c3a129f7cc72f50 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/17.0/product_category_type + :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-17-0/product-attribute-17-0-product_category_type + :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=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Add 'Type' field on Product Categories to distinguish between parent and +final categories. + +figure:: ../static/description/product_category_tree.png + +- Categories (type view) can contain only categories. +- Categories (type normal) can contain only products. + +It is so impossible to select a category (type view) in the product +template form view. + +figure:: ../static/description/product_template_form.png + +Note +---- + +This module restores a feature that was present in Odoo Community +Edition until the V10 revision. + +Ref: +https://github.com/odoo/odoo/blob/10.0/addons/product/models/product.py#L24 + +**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 +------- + +* GRAP + +Contributors +------------ + +- Sylvain LE GAL (https://www.twitter.com/legalsylvain) + +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-legalsylvain| image:: https://github.com/legalsylvain.png?size=40px + :target: https://github.com/legalsylvain + :alt: legalsylvain + +Current `maintainer `__: + +|maintainer-legalsylvain| + +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_category_type/__init__.py b/product_category_type/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/product_category_type/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/product_category_type/__manifest__.py b/product_category_type/__manifest__.py new file mode 100644 index 00000000000..9b0e7646b30 --- /dev/null +++ b/product_category_type/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright 2021 Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Product Category Type", + "summary": """ + Add Type field on Product Categories + to distinguish between parent and final categories""", + "version": "17.0.1.0.0", + "license": "AGPL-3", + "author": "GRAP,Odoo Community Association (OCA)", + "maintainers": ["legalsylvain"], + "website": "https://github.com/OCA/product-attribute", + "depends": [ + "product", + ], + "data": [ + "views/product_category.xml", + ], + "demo": [ + "demo/product_category.xml", + ], +} diff --git a/product_category_type/demo/product_category.xml b/product_category_type/demo/product_category.xml new file mode 100644 index 00000000000..12308ee673f --- /dev/null +++ b/product_category_type/demo/product_category.xml @@ -0,0 +1,23 @@ + + + + + + Demo Parent Category (Type View) + view + + + + Demo Category 1 (Type Normal) + normal + + + + + Demo Category 2 (Type Normal) + normal + + + + diff --git a/product_category_type/i18n/de.po b/product_category_type/i18n/de.po new file mode 100644 index 00000000000..384f3ca946c --- /dev/null +++ b/product_category_type/i18n/de.po @@ -0,0 +1,74 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_category_type +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-05-11 13:05+0000\n" +"Last-Translator: Maria Sparenberg \n" +"Language-Team: none\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: product_category_type +#: model:ir.model.fields,help:product_category_type.field_product_category__type +msgid "" +"A category of the view type is a virtual category that can be used as the " +"parent of another category to create a hierarchical structure." +msgstr "" +"Eine Kategorie mit Typ \"Ansicht\" ist eine virtuelle Kategorie, die als " +"übergeordnete Kategorie verwendet werden kann, um eine Hierarchie zu " +"erstellen." + +#. module: product_category_type +#: model:ir.model.fields,field_description:product_category_type.field_product_category__type +msgid "Category Type" +msgstr "Kategorie-Typ" + +#. module: product_category_type +#: model:ir.model.fields.selection,name:product_category_type.selection__product_category__type__normal +msgid "Normal" +msgstr "Normal" + +#. module: product_category_type +#: model:ir.model.fields,field_description:product_category_type.field_product_category__parent_id +msgid "Parent Category" +msgstr "Übergeordnete Kategorie" + +#. module: product_category_type +#: model:ir.model,name:product_category_type.model_product_template +msgid "Product" +msgstr "" + +#. module: product_category_type +#: model:ir.model,name:product_category_type.model_product_category +#: model:ir.model.fields,field_description:product_category_type.field_product_product__categ_id +#: model:ir.model.fields,field_description:product_category_type.field_product_template__categ_id +msgid "Product Category" +msgstr "Produktkategorie" + +#. module: product_category_type +#: model:ir.model.fields.selection,name:product_category_type.selection__product_category__type__view +msgid "View" +msgstr "Ansicht" + +#~ msgid "Display Name" +#~ msgstr "Anzeigename" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Zuletzt geändert am" + +#~ msgid "Product Template" +#~ msgstr "Produktvorlage" + +#~ msgid "Select category for the current product" +#~ msgstr "Kategorie für das aktuelle Produkt auswählen" diff --git a/product_category_type/i18n/es.po b/product_category_type/i18n/es.po new file mode 100644 index 00000000000..5fc50fb8bcc --- /dev/null +++ b/product_category_type/i18n/es.po @@ -0,0 +1,58 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_category_type +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-08-29 08:31+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: product_category_type +#: model:ir.model.fields,help:product_category_type.field_product_category__type +msgid "" +"A category of the view type is a virtual category that can be used as the " +"parent of another category to create a hierarchical structure." +msgstr "" +"Una categoría del tipo vista es una categoría virtual que puede utilizarse " +"como padre de otra categoría para crear una estructura jerárquica." + +#. module: product_category_type +#: model:ir.model.fields,field_description:product_category_type.field_product_category__type +msgid "Category Type" +msgstr "Tipo de Categoría" + +#. module: product_category_type +#: model:ir.model.fields.selection,name:product_category_type.selection__product_category__type__normal +msgid "Normal" +msgstr "Normal" + +#. module: product_category_type +#: model:ir.model.fields,field_description:product_category_type.field_product_category__parent_id +msgid "Parent Category" +msgstr "Categoría Parental" + +#. module: product_category_type +#: model:ir.model,name:product_category_type.model_product_template +msgid "Product" +msgstr "Producto" + +#. module: product_category_type +#: model:ir.model,name:product_category_type.model_product_category +#: model:ir.model.fields,field_description:product_category_type.field_product_product__categ_id +#: model:ir.model.fields,field_description:product_category_type.field_product_template__categ_id +msgid "Product Category" +msgstr "Categoría de Producto" + +#. module: product_category_type +#: model:ir.model.fields.selection,name:product_category_type.selection__product_category__type__view +msgid "View" +msgstr "Ver" diff --git a/product_category_type/i18n/fr.po b/product_category_type/i18n/fr.po new file mode 100644 index 00000000000..e0e34f96167 --- /dev/null +++ b/product_category_type/i18n/fr.po @@ -0,0 +1,58 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_category_type +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-02-24 16:47+0000\n" +"PO-Revision-Date: 2023-02-24 16:47+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: product_category_type +#: model:ir.model.fields,help:product_category_type.field_product_category__type +msgid "" +"A category of the view type is a virtual category that can be used as the " +"parent of another category to create a hierarchical structure." +msgstr "" +"Une catégorie de type vue est une catégorie virtuelle qui est utilisée " +"comme parent d'une autre catégorie, pour créer une structure hiérarchique." + +#. module: product_category_type +#: model:ir.model.fields,field_description:product_category_type.field_product_category__type +msgid "Category Type" +msgstr "Type de catégorie" + +#. module: product_category_type +#: model:ir.model.fields.selection,name:product_category_type.selection__product_category__type__normal +msgid "Normal" +msgstr "" + +#. module: product_category_type +#: model:ir.model.fields,field_description:product_category_type.field_product_category__parent_id +msgid "Parent Category" +msgstr "Catégorie mère" + +#. module: product_category_type +#: model:ir.model,name:product_category_type.model_product_template +msgid "Product" +msgstr "Produit" + +#. module: product_category_type +#: model:ir.model,name:product_category_type.model_product_category +#: model:ir.model.fields,field_description:product_category_type.field_product_product__categ_id +#: model:ir.model.fields,field_description:product_category_type.field_product_template__categ_id +msgid "Product Category" +msgstr "Catégorie de produit" + +#. module: product_category_type +#: model:ir.model.fields.selection,name:product_category_type.selection__product_category__type__view +msgid "View" +msgstr "Vue" diff --git a/product_category_type/i18n/it.po b/product_category_type/i18n/it.po new file mode 100644 index 00000000000..0358d5a9921 --- /dev/null +++ b/product_category_type/i18n/it.po @@ -0,0 +1,58 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_category_type +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-02-16 17:45+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: product_category_type +#: model:ir.model.fields,help:product_category_type.field_product_category__type +msgid "" +"A category of the view type is a virtual category that can be used as the " +"parent of another category to create a hierarchical structure." +msgstr "" +"Una categoria del tipo vista è una categoria virtuale che può essere " +"utilizzata come categoria padre per creare una struttura gerarchica." + +#. module: product_category_type +#: model:ir.model.fields,field_description:product_category_type.field_product_category__type +msgid "Category Type" +msgstr "Tipo categoria" + +#. module: product_category_type +#: model:ir.model.fields.selection,name:product_category_type.selection__product_category__type__normal +msgid "Normal" +msgstr "Normale" + +#. module: product_category_type +#: model:ir.model.fields,field_description:product_category_type.field_product_category__parent_id +msgid "Parent Category" +msgstr "Categoria padre" + +#. module: product_category_type +#: model:ir.model,name:product_category_type.model_product_template +msgid "Product" +msgstr "Prodotto" + +#. module: product_category_type +#: model:ir.model,name:product_category_type.model_product_category +#: model:ir.model.fields,field_description:product_category_type.field_product_product__categ_id +#: model:ir.model.fields,field_description:product_category_type.field_product_template__categ_id +msgid "Product Category" +msgstr "Categoria prodotto" + +#. module: product_category_type +#: model:ir.model.fields.selection,name:product_category_type.selection__product_category__type__view +msgid "View" +msgstr "Vista" diff --git a/product_category_type/i18n/product_category_type.pot b/product_category_type/i18n/product_category_type.pot new file mode 100644 index 00000000000..02c0cc7757a --- /dev/null +++ b/product_category_type/i18n/product_category_type.pot @@ -0,0 +1,53 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_category_type +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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: product_category_type +#: model:ir.model.fields,help:product_category_type.field_product_category__type +msgid "" +"A category of the view type is a virtual category that can be used as the " +"parent of another category to create a hierarchical structure." +msgstr "" + +#. module: product_category_type +#: model:ir.model.fields,field_description:product_category_type.field_product_category__type +msgid "Category Type" +msgstr "" + +#. module: product_category_type +#: model:ir.model.fields.selection,name:product_category_type.selection__product_category__type__normal +msgid "Normal" +msgstr "" + +#. module: product_category_type +#: model:ir.model.fields,field_description:product_category_type.field_product_category__parent_id +msgid "Parent Category" +msgstr "" + +#. module: product_category_type +#: model:ir.model,name:product_category_type.model_product_template +msgid "Product" +msgstr "" + +#. module: product_category_type +#: model:ir.model,name:product_category_type.model_product_category +#: model:ir.model.fields,field_description:product_category_type.field_product_product__categ_id +#: model:ir.model.fields,field_description:product_category_type.field_product_template__categ_id +msgid "Product Category" +msgstr "" + +#. module: product_category_type +#: model:ir.model.fields.selection,name:product_category_type.selection__product_category__type__view +msgid "View" +msgstr "" diff --git a/product_category_type/models/__init__.py b/product_category_type/models/__init__.py new file mode 100644 index 00000000000..f154bb52867 --- /dev/null +++ b/product_category_type/models/__init__.py @@ -0,0 +1,2 @@ +from . import product_category +from . import product_template diff --git a/product_category_type/models/product_category.py b/product_category_type/models/product_category.py new file mode 100644 index 00000000000..44c3d0b2aca --- /dev/null +++ b/product_category_type/models/product_category.py @@ -0,0 +1,19 @@ +# Copyright 2021 Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ProductCategory(models.Model): + _inherit = "product.category" + + parent_id = fields.Many2one(domain="[('type', '=', 'view')]") + + type = fields.Selection( + selection=[("view", "View"), ("normal", "Normal")], + string="Category Type", + default="normal", + help="A category of the view type is a virtual category" + " that can be used as the parent of another category" + " to create a hierarchical structure.", + ) diff --git a/product_category_type/models/product_template.py b/product_category_type/models/product_template.py new file mode 100644 index 00000000000..4e671ef3b06 --- /dev/null +++ b/product_category_type/models/product_template.py @@ -0,0 +1,10 @@ +# Copyright 2021 Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + categ_id = fields.Many2one(domain="[('type', '=', 'normal')]") diff --git a/product_category_type/pyproject.toml b/product_category_type/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/product_category_type/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/product_category_type/readme/CONTRIBUTORS.md b/product_category_type/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..4a6b63400c1 --- /dev/null +++ b/product_category_type/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Sylvain LE GAL () diff --git a/product_category_type/readme/DESCRIPTION.md b/product_category_type/readme/DESCRIPTION.md new file mode 100644 index 00000000000..a98efe5a213 --- /dev/null +++ b/product_category_type/readme/DESCRIPTION.md @@ -0,0 +1,20 @@ +Add 'Type' field on Product Categories to distinguish between parent and +final categories. + +figure:: ../static/description/product_category_tree.png + +- Categories (type view) can contain only categories. +- Categories (type normal) can contain only products. + +It is so impossible to select a category (type view) in the product +template form view. + +figure:: ../static/description/product_template_form.png + +## Note + +This module restores a feature that was present in Odoo Community +Edition until the V10 revision. + +Ref: + diff --git a/product_category_type/static/description/icon.png b/product_category_type/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/product_category_type/static/description/icon.png differ diff --git a/product_category_type/static/description/index.html b/product_category_type/static/description/index.html new file mode 100644 index 00000000000..90077ddc959 --- /dev/null +++ b/product_category_type/static/description/index.html @@ -0,0 +1,436 @@ + + + + + +Product Category Type + + + +
+

Product Category Type

+ + +

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

+

Add ‘Type’ field on Product Categories to distinguish between parent and +final categories.

+

figure:: ../static/description/product_category_tree.png

+
    +
  • Categories (type view) can contain only categories.
  • +
  • Categories (type normal) can contain only products.
  • +
+

It is so impossible to select a category (type view) in the product +template form view.

+

figure:: ../static/description/product_template_form.png

+
+

Note

+

This module restores a feature that was present in Odoo Community +Edition until the V10 revision.

+

Ref: +https://github.com/odoo/odoo/blob/10.0/addons/product/models/product.py#L24

+

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.

+
+ +
+
+

Authors

+
    +
  • GRAP
  • +
+
+
+

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:

+

legalsylvain

+

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_category_type/static/description/product_category_tree.png b/product_category_type/static/description/product_category_tree.png new file mode 100644 index 00000000000..a1d8510d646 Binary files /dev/null and b/product_category_type/static/description/product_category_tree.png differ diff --git a/product_category_type/static/description/product_template_form.png b/product_category_type/static/description/product_template_form.png new file mode 100644 index 00000000000..134e456ed89 Binary files /dev/null and b/product_category_type/static/description/product_template_form.png differ diff --git a/product_category_type/views/product_category.xml b/product_category_type/views/product_category.xml new file mode 100644 index 00000000000..1fe984a9ef7 --- /dev/null +++ b/product_category_type/views/product_category.xml @@ -0,0 +1,39 @@ + + + + + + product.category + + + + + + + + + + product.category + + + + type == 'view' + + + + + + + + + product.category + + + + + + + + +