diff --git a/crm_l10n_eu_nace/README.rst b/crm_l10n_eu_nace/README.rst new file mode 100644 index 00000000000..5a1bcefec70 --- /dev/null +++ b/crm_l10n_eu_nace/README.rst @@ -0,0 +1,89 @@ +=============================== +European NACE categories in CRM +=============================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:d6eb7a1deb931a10a56be1e16d58c7cf3100301609fd5736c1cfeecb8de72e18 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fcrm-lightgray.png?logo=github + :target: https://github.com/OCA/crm/tree/16.0/crm_l10n_eu_nace + :alt: OCA/crm +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/crm-16-0/crm-16-0-crm_l10n_eu_nace + :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/crm&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds the concept of NACE activity to the CRM main objects (lead, +opportunity), and propagates them through the workflow. + +**Table of contents** + +.. contents:: + :local: + +Installation +============ + +This module depends on ``l10n_eu_nace``, which you can download from +`OCA/community-data-files `__. + +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 +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Tecnativa `__: + + * Pedro M. Baeza + * Antonio Espinosa + * David Vidal + * Jairo Llopis + * Ernesto Tejeda + +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/crm `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/crm_l10n_eu_nace/__init__.py b/crm_l10n_eu_nace/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/crm_l10n_eu_nace/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/crm_l10n_eu_nace/__manifest__.py b/crm_l10n_eu_nace/__manifest__.py new file mode 100644 index 00000000000..ae363a54e37 --- /dev/null +++ b/crm_l10n_eu_nace/__manifest__.py @@ -0,0 +1,11 @@ +{ + "name": "European NACE categories in CRM", + "version": "16.0.1.0.0", + "category": "Customer Relationship Management", + "author": "Tecnativa, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/crm", + "depends": ["crm", "l10n_eu_nace"], + "data": ["views/crm_lead_view.xml"], + "installable": True, + "license": "AGPL-3", +} diff --git a/crm_l10n_eu_nace/i18n/crm_l10n_eu_nace.pot b/crm_l10n_eu_nace/i18n/crm_l10n_eu_nace.pot new file mode 100644 index 00000000000..52a878b206f --- /dev/null +++ b/crm_l10n_eu_nace/i18n/crm_l10n_eu_nace.pot @@ -0,0 +1,50 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_l10n_eu_nace +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.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: crm_l10n_eu_nace +#: model:ir.model.fields,field_description:crm_l10n_eu_nace.field_crm_lead__display_name +msgid "Display Name" +msgstr "" + +#. module: crm_l10n_eu_nace +#: model:ir.model.fields,field_description:crm_l10n_eu_nace.field_crm_lead__id +msgid "ID" +msgstr "" + +#. module: crm_l10n_eu_nace +#: model:ir.model.fields,field_description:crm_l10n_eu_nace.field_crm_lead____last_update +msgid "Last Modified on" +msgstr "" + +#. module: crm_l10n_eu_nace +#: model:ir.model,name:crm_l10n_eu_nace.model_crm_lead +msgid "Lead/Opportunity" +msgstr "" + +#. module: crm_l10n_eu_nace +#: model:ir.model.fields,field_description:crm_l10n_eu_nace.field_crm_lead__nace_id +msgid "Main NACE" +msgstr "" + +#. module: crm_l10n_eu_nace +#: model_terms:ir.ui.view,arch_db:crm_l10n_eu_nace.view_crm_case_leads_filter +#: model_terms:ir.ui.view,arch_db:crm_l10n_eu_nace.view_crm_case_opportunities_filter +msgid "NACE" +msgstr "" + +#. module: crm_l10n_eu_nace +#: model:ir.model.fields,field_description:crm_l10n_eu_nace.field_crm_lead__secondary_nace_ids +msgid "Secondary NACE" +msgstr "" diff --git a/crm_l10n_eu_nace/i18n/es.po b/crm_l10n_eu_nace/i18n/es.po new file mode 100644 index 00000000000..4e461c7d642 --- /dev/null +++ b/crm_l10n_eu_nace/i18n/es.po @@ -0,0 +1,63 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_activity_nace +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-19 18:30+0000\n" +"PO-Revision-Date: 2024-02-17 00:45+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: crm_l10n_eu_nace +#: model:ir.model.fields,field_description:crm_l10n_eu_nace.field_crm_lead__display_name +msgid "Display Name" +msgstr "Mostrar Nombre" + +#. module: crm_l10n_eu_nace +#: model:ir.model.fields,field_description:crm_l10n_eu_nace.field_crm_lead__id +msgid "ID" +msgstr "ID" + +#. module: crm_l10n_eu_nace +#: model:ir.model.fields,field_description:crm_l10n_eu_nace.field_crm_lead____last_update +msgid "Last Modified on" +msgstr "Última Modificación el" + +#. module: crm_l10n_eu_nace +#: model:ir.model,name:crm_l10n_eu_nace.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Iniciativa/Oportunidad" + +#. module: crm_l10n_eu_nace +#: model:ir.model.fields,field_description:crm_l10n_eu_nace.field_crm_lead__nace_id +msgid "Main NACE" +msgstr "NACE principal" + +#. module: crm_l10n_eu_nace +#: model_terms:ir.ui.view,arch_db:crm_l10n_eu_nace.view_crm_case_leads_filter +#: model_terms:ir.ui.view,arch_db:crm_l10n_eu_nace.view_crm_case_opportunities_filter +msgid "NACE" +msgstr "NACE" + +#. module: crm_l10n_eu_nace +#: model:ir.model.fields,field_description:crm_l10n_eu_nace.field_crm_lead__secondary_nace_ids +msgid "Secondary NACE" +msgstr "Secundaria NACE" + +#~ msgid "Activity" +#~ msgstr "Actividad" + +#~ msgid "Main activity" +#~ msgstr "Actividad principal" + +#~ msgid "Other activities" +#~ msgstr "Otras actividades" diff --git a/crm_l10n_eu_nace/i18n/fr.po b/crm_l10n_eu_nace/i18n/fr.po new file mode 100644 index 00000000000..92b71b5d5da --- /dev/null +++ b/crm_l10n_eu_nace/i18n/fr.po @@ -0,0 +1,53 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_l10n_eu_nace +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-09-13 12:07+0000\n" +"Last-Translator: Claude R Perrin \n" +"Language-Team: none\n" +"Language: fr\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: crm_l10n_eu_nace +#: model:ir.model.fields,field_description:crm_l10n_eu_nace.field_crm_lead__display_name +msgid "Display Name" +msgstr "Nom affiché" + +#. module: crm_l10n_eu_nace +#: model:ir.model.fields,field_description:crm_l10n_eu_nace.field_crm_lead__id +msgid "ID" +msgstr "ID" + +#. module: crm_l10n_eu_nace +#: model:ir.model.fields,field_description:crm_l10n_eu_nace.field_crm_lead____last_update +msgid "Last Modified on" +msgstr "Dernière modification le" + +#. module: crm_l10n_eu_nace +#: model:ir.model,name:crm_l10n_eu_nace.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Piste/opportunité" + +#. module: crm_l10n_eu_nace +#: model:ir.model.fields,field_description:crm_l10n_eu_nace.field_crm_lead__nace_id +msgid "Main NACE" +msgstr "NACE Principal" + +#. module: crm_l10n_eu_nace +#: model_terms:ir.ui.view,arch_db:crm_l10n_eu_nace.view_crm_case_leads_filter +#: model_terms:ir.ui.view,arch_db:crm_l10n_eu_nace.view_crm_case_opportunities_filter +msgid "NACE" +msgstr "NACE" + +#. module: crm_l10n_eu_nace +#: model:ir.model.fields,field_description:crm_l10n_eu_nace.field_crm_lead__secondary_nace_ids +msgid "Secondary NACE" +msgstr "NACE Secondaire" diff --git a/crm_l10n_eu_nace/i18n/it.po b/crm_l10n_eu_nace/i18n/it.po new file mode 100644 index 00000000000..a0af5dc3917 --- /dev/null +++ b/crm_l10n_eu_nace/i18n/it.po @@ -0,0 +1,53 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_l10n_eu_nace +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-06-14 15:08+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: crm_l10n_eu_nace +#: model:ir.model.fields,field_description:crm_l10n_eu_nace.field_crm_lead__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: crm_l10n_eu_nace +#: model:ir.model.fields,field_description:crm_l10n_eu_nace.field_crm_lead__id +msgid "ID" +msgstr "ID" + +#. module: crm_l10n_eu_nace +#: model:ir.model.fields,field_description:crm_l10n_eu_nace.field_crm_lead____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: crm_l10n_eu_nace +#: model:ir.model,name:crm_l10n_eu_nace.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Contatto/Opportunità" + +#. module: crm_l10n_eu_nace +#: model:ir.model.fields,field_description:crm_l10n_eu_nace.field_crm_lead__nace_id +msgid "Main NACE" +msgstr "NACE principale" + +#. module: crm_l10n_eu_nace +#: model_terms:ir.ui.view,arch_db:crm_l10n_eu_nace.view_crm_case_leads_filter +#: model_terms:ir.ui.view,arch_db:crm_l10n_eu_nace.view_crm_case_opportunities_filter +msgid "NACE" +msgstr "NACE" + +#. module: crm_l10n_eu_nace +#: model:ir.model.fields,field_description:crm_l10n_eu_nace.field_crm_lead__secondary_nace_ids +msgid "Secondary NACE" +msgstr "NACE secondario" diff --git a/crm_l10n_eu_nace/models/__init__.py b/crm_l10n_eu_nace/models/__init__.py new file mode 100644 index 00000000000..e66f0d6cf4e --- /dev/null +++ b/crm_l10n_eu_nace/models/__init__.py @@ -0,0 +1 @@ +from . import crm_lead diff --git a/crm_l10n_eu_nace/models/crm_lead.py b/crm_l10n_eu_nace/models/crm_lead.py new file mode 100644 index 00000000000..ab655b4209b --- /dev/null +++ b/crm_l10n_eu_nace/models/crm_lead.py @@ -0,0 +1,23 @@ +from odoo import fields, models + + +class CrmLead(models.Model): + _inherit = "crm.lead" + + nace_id = fields.Many2one( + comodel_name="res.partner.nace", string="Main NACE", index=True + ) + secondary_nace_ids = fields.Many2many( + comodel_name="res.partner.nace", string="Secondary NACE" + ) + + def _prepare_customer_values(self, name, is_company, parent_id=False): + """Propagate NACE activity to created partner.""" + result = super()._prepare_customer_values(name, is_company, parent_id) + if self.nace_id: + result["nace_id"] = self.nace_id.id + if self.secondary_nace_ids: + result["secondary_nace_ids"] = [ + (4, id_) for id_ in self.secondary_nace_ids.ids + ] + return result diff --git a/crm_l10n_eu_nace/readme/CONTRIBUTORS.rst b/crm_l10n_eu_nace/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..a30d5b84d5c --- /dev/null +++ b/crm_l10n_eu_nace/readme/CONTRIBUTORS.rst @@ -0,0 +1,7 @@ +* `Tecnativa `__: + + * Pedro M. Baeza + * Antonio Espinosa + * David Vidal + * Jairo Llopis + * Ernesto Tejeda diff --git a/crm_l10n_eu_nace/readme/DESCRIPTION.rst b/crm_l10n_eu_nace/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..536568dda4e --- /dev/null +++ b/crm_l10n_eu_nace/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module adds the concept of NACE activity to the CRM main objects (lead, +opportunity), and propagates them through the workflow. diff --git a/crm_l10n_eu_nace/readme/INSTALL.rst b/crm_l10n_eu_nace/readme/INSTALL.rst new file mode 100644 index 00000000000..9b938e58339 --- /dev/null +++ b/crm_l10n_eu_nace/readme/INSTALL.rst @@ -0,0 +1,2 @@ +This module depends on ``l10n_eu_nace``, which you can download from +`OCA/community-data-files `__. diff --git a/crm_l10n_eu_nace/static/description/icon.png b/crm_l10n_eu_nace/static/description/icon.png new file mode 100644 index 00000000000..059da2ba0d6 Binary files /dev/null and b/crm_l10n_eu_nace/static/description/icon.png differ diff --git a/crm_l10n_eu_nace/static/description/index.html b/crm_l10n_eu_nace/static/description/index.html new file mode 100644 index 00000000000..405febfdcf2 --- /dev/null +++ b/crm_l10n_eu_nace/static/description/index.html @@ -0,0 +1,437 @@ + + + + + +European NACE categories in CRM + + + +
+

European NACE categories in CRM

+ + +

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

+

This module adds the concept of NACE activity to the CRM main objects (lead, +opportunity), and propagates them through the workflow.

+

Table of contents

+ +
+

Installation

+

This module depends on l10n_eu_nace, which you can download from +OCA/community-data-files.

+
+
+

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

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+
    +
  • Tecnativa:
      +
    • Pedro M. Baeza
    • +
    • Antonio Espinosa
    • +
    • David Vidal
    • +
    • Jairo Llopis
    • +
    • Ernesto Tejeda
    • +
    +
  • +
+
+
+

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

+

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

+
+
+
+ + diff --git a/crm_l10n_eu_nace/tests/__init__.py b/crm_l10n_eu_nace/tests/__init__.py new file mode 100644 index 00000000000..ebdfe8b505b --- /dev/null +++ b/crm_l10n_eu_nace/tests/__init__.py @@ -0,0 +1 @@ +from . import test_crm_nace diff --git a/crm_l10n_eu_nace/tests/test_crm_nace.py b/crm_l10n_eu_nace/tests/test_crm_nace.py new file mode 100644 index 00000000000..f4572daa059 --- /dev/null +++ b/crm_l10n_eu_nace/tests/test_crm_nace.py @@ -0,0 +1,33 @@ +from odoo.tests.common import SingleTransactionCase + + +class CrmNACECase(SingleTransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.nace_0 = cls.env["res.partner.nace"].create( + {"name": "name_0", "code": "code_0"} + ) + cls.nace_1 = cls.env["res.partner.nace"].create( + {"name": "name_1", "code": "code_1"} + ) + cls.nace_2 = cls.env["res.partner.nace"].create( + {"name": "name_2", "code": "code_2"} + ) + + def test_data_transferred_to_partner(self): + """Data is moved to partner when creating it from lead.""" + # Create a lead with nace codes but without partner yet + lead = self.env["crm.lead"].create( + { + "name": "test lead", + "partner_name": "someone", + "nace_id": self.nace_0.id, + "secondary_nace_ids": [(4, self.nace_1.id), (4, self.nace_2.id)], + } + ) + self.assertFalse(lead.partner_id) + # Create that partner automatically + partner = lead._create_customer() + self.assertEqual(partner.nace_id, self.nace_0) + self.assertEqual(partner.secondary_nace_ids, self.nace_1 | self.nace_2) diff --git a/crm_l10n_eu_nace/views/crm_lead_view.xml b/crm_l10n_eu_nace/views/crm_lead_view.xml new file mode 100644 index 00000000000..67fdaf882eb --- /dev/null +++ b/crm_l10n_eu_nace/views/crm_lead_view.xml @@ -0,0 +1,59 @@ + + + + Add NACE fields + crm.lead + + + + + + + + + + + + + + + Add NACE fields for searching and grouping + crm.lead + + + + + + + + + + + + + Add NACE fields for searching and grouping + crm.lead + + + + + + + + + + + diff --git a/setup/crm_l10n_eu_nace/odoo/addons/crm_l10n_eu_nace b/setup/crm_l10n_eu_nace/odoo/addons/crm_l10n_eu_nace new file mode 120000 index 00000000000..0b88d81f66d --- /dev/null +++ b/setup/crm_l10n_eu_nace/odoo/addons/crm_l10n_eu_nace @@ -0,0 +1 @@ +../../../../crm_l10n_eu_nace \ No newline at end of file diff --git a/setup/crm_l10n_eu_nace/setup.py b/setup/crm_l10n_eu_nace/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/crm_l10n_eu_nace/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)