diff --git a/partner_industry_parent/README.rst b/partner_industry_parent/README.rst new file mode 100644 index 00000000000..efc700073ce --- /dev/null +++ b/partner_industry_parent/README.rst @@ -0,0 +1,80 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +======================= +Partner Industry Parent +======================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:78f1e79d3ece881953ffb85a939f3c1526f011827e3e4cf2f91041495aa289a0 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/license-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%2Fpartner--contact-lightgray.png?logo=github + :target: https://github.com/OCA/partner-contact/tree/19.0/partner_industry_parent + :alt: OCA/partner-contact +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/partner-contact-19-0/partner-contact-19-0-partner_industry_parent + :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/partner-contact&target_branch=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module add a parent relation to the partner industry + +**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 +------- + +* ACSONE SA/NV + +Contributors +------------ + +- Souheil Bejaoui + +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/partner-contact `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/partner_industry_parent/__init__.py b/partner_industry_parent/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/partner_industry_parent/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/partner_industry_parent/__manifest__.py b/partner_industry_parent/__manifest__.py new file mode 100644 index 00000000000..864c6a56137 --- /dev/null +++ b/partner_industry_parent/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2019 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Partner Industry Parent", + "summary": """ + This module add a parent relation to the partner industry""", + "version": "19.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/partner-contact", + "depends": ["base"], + "data": ["views/res_partner_industry.xml"], + "demo": [], +} diff --git a/partner_industry_parent/i18n/it.po b/partner_industry_parent/i18n/it.po new file mode 100644 index 00000000000..2b153824774 --- /dev/null +++ b/partner_industry_parent/i18n/it.po @@ -0,0 +1,42 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_industry_parent +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2025-11-24 12:43+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 5.10.4\n" + +#. module: partner_industry_parent +#: model:ir.model.fields,field_description:partner_industry_parent.field_res_partner_industry__child_ids +msgid "Children" +msgstr "Figli" + +#. module: partner_industry_parent +#: model:ir.model.fields,field_description:partner_industry_parent.field_res_partner_industry__complete_name +msgid "Complete Name" +msgstr "Nome completo" + +#. module: partner_industry_parent +#: model:ir.model,name:partner_industry_parent.model_res_partner_industry +msgid "Industry" +msgstr "Settore" + +#. module: partner_industry_parent +#: model:ir.model.fields,field_description:partner_industry_parent.field_res_partner_industry__parent_id +msgid "Parent" +msgstr "Padre" + +#. module: partner_industry_parent +#: model:ir.model.fields,field_description:partner_industry_parent.field_res_partner_industry__parent_path +msgid "Parent Path" +msgstr "Percorso padre" diff --git a/partner_industry_parent/i18n/partner_industry_parent.pot b/partner_industry_parent/i18n/partner_industry_parent.pot new file mode 100644 index 00000000000..dfd0870c155 --- /dev/null +++ b/partner_industry_parent/i18n/partner_industry_parent.pot @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_industry_parent +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 19.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: partner_industry_parent +#: model:ir.model.fields,field_description:partner_industry_parent.field_res_partner_industry__child_ids +msgid "Children" +msgstr "" + +#. module: partner_industry_parent +#: model:ir.model.fields,field_description:partner_industry_parent.field_res_partner_industry__complete_name +msgid "Complete Name" +msgstr "" + +#. module: partner_industry_parent +#: model:ir.model,name:partner_industry_parent.model_res_partner_industry +msgid "Industry" +msgstr "" + +#. module: partner_industry_parent +#: model:ir.model.fields,field_description:partner_industry_parent.field_res_partner_industry__parent_id +msgid "Parent" +msgstr "" + +#. module: partner_industry_parent +#: model:ir.model.fields,field_description:partner_industry_parent.field_res_partner_industry__parent_path +msgid "Parent Path" +msgstr "" diff --git a/partner_industry_parent/models/__init__.py b/partner_industry_parent/models/__init__.py new file mode 100644 index 00000000000..9b124581f41 --- /dev/null +++ b/partner_industry_parent/models/__init__.py @@ -0,0 +1 @@ +from . import res_partner_industry diff --git a/partner_industry_parent/models/res_partner_industry.py b/partner_industry_parent/models/res_partner_industry.py new file mode 100644 index 00000000000..3e39806ecdf --- /dev/null +++ b/partner_industry_parent/models/res_partner_industry.py @@ -0,0 +1,33 @@ +# Copyright 2019 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class ResPartnerIndustry(models.Model): + _inherit = "res.partner.industry" + _parent_name = "parent_id" + _parent_store = True + _rec_name = "complete_name" + _order = "complete_name" + + complete_name = fields.Char( + compute="_compute_complete_name", store=True, recursive=True + ) + parent_path = fields.Char(index=True) + parent_id = fields.Many2one(comodel_name="res.partner.industry") + child_ids = fields.One2many( + comodel_name="res.partner.industry", + inverse_name="parent_id", + string="Children Industry", + ) + + @api.depends("name", "parent_id.complete_name") + def _compute_complete_name(self): + for industry in self: + if industry.parent_id: + industry.complete_name = ( + f"{industry.parent_id.complete_name} / {industry.name}" + ) + else: + industry.complete_name = industry.name diff --git a/partner_industry_parent/pyproject.toml b/partner_industry_parent/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/partner_industry_parent/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/partner_industry_parent/readme/CONTRIBUTORS.md b/partner_industry_parent/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..fc5fcbefea9 --- /dev/null +++ b/partner_industry_parent/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Souheil Bejaoui \<\> diff --git a/partner_industry_parent/readme/DESCRIPTION.md b/partner_industry_parent/readme/DESCRIPTION.md new file mode 100644 index 00000000000..66e0d01b5d2 --- /dev/null +++ b/partner_industry_parent/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module add a parent relation to the partner industry diff --git a/partner_industry_parent/static/description/icon.png b/partner_industry_parent/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/partner_industry_parent/static/description/icon.png differ diff --git a/partner_industry_parent/static/description/index.html b/partner_industry_parent/static/description/index.html new file mode 100644 index 00000000000..bd45176a62d --- /dev/null +++ b/partner_industry_parent/static/description/index.html @@ -0,0 +1,429 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Partner Industry Parent

+ +

Beta License: AGPL-3 OCA/partner-contact Translate me on Weblate Try me on Runboat

+

This module add a parent relation to the partner industry

+

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

+
    +
  • 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.

+

This module is part of the OCA/partner-contact project on GitHub.

+

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

+
+
+
+
+ + diff --git a/partner_industry_parent/tests/__init__.py b/partner_industry_parent/tests/__init__.py new file mode 100644 index 00000000000..f035285fe9c --- /dev/null +++ b/partner_industry_parent/tests/__init__.py @@ -0,0 +1 @@ +from . import test_res_partner_industry diff --git a/partner_industry_parent/tests/test_res_partner_industry.py b/partner_industry_parent/tests/test_res_partner_industry.py new file mode 100644 index 00000000000..47f497311e7 --- /dev/null +++ b/partner_industry_parent/tests/test_res_partner_industry.py @@ -0,0 +1,30 @@ +# Copyright 2019 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase + + +class TestResPartnerIndustry(TransactionCase): + def setUp(self): + super().setUp() + self.industry_1 = self.env.ref("base.res_partner_industry_O") + self.industry_2 = self.env.ref("base.res_partner_industry_P") + self.industry_3 = self.env.ref("base.res_partner_industry_Q") + + def test_res_partner_industry_complete_name(self): + industry = self.env["res.partner.industry"].create( + { + "name": "Manufacturing", + } + ) + self.assertEqual(industry.complete_name, "Manufacturing") + self.assertEqual(self.industry_1.complete_name, "Public Administration") + self.industry_1.parent_id = self.industry_2 + self.assertEqual( + self.industry_1.complete_name, "Education / Public Administration" + ) + self.industry_2.parent_id = self.industry_3 + self.assertEqual( + self.industry_1.complete_name, + "Health/Social / Education / Public Administration", + ) diff --git a/partner_industry_parent/views/res_partner_industry.xml b/partner_industry_parent/views/res_partner_industry.xml new file mode 100644 index 00000000000..c227e926271 --- /dev/null +++ b/partner_industry_parent/views/res_partner_industry.xml @@ -0,0 +1,24 @@ + + + + + + Industry (in partner_industry_parent) + res.partner.industry + + + + + + + + + + + + + +