diff --git a/partner_company_group/README.rst b/partner_company_group/README.rst new file mode 100644 index 000000000..98dcd04de --- /dev/null +++ b/partner_company_group/README.rst @@ -0,0 +1,79 @@ +===================== +Partner Company Group +===================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fpartner--contact-lightgray.png?logo=github + :target: https://github.com/OCA/partner-contact/tree/14.0/partner_company_group + :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-14-0/partner-contact-14-0-partner_company_group + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/134/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This Module adds a company group field to companies, which is also propagated to contacts and allows to search and group for the company group in contact, leads, sale orders and invoices. + +**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 smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Camptocamp SA + +Contributors +~~~~~~~~~~~~ + +* Timon Tschanz +* Yannick Vaucher +* `Tecnativa `_: + + * Ernesto Tejeda + +* Tharathip Chaweewongphan + +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_company_group/__init__.py b/partner_company_group/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/partner_company_group/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/partner_company_group/__manifest__.py b/partner_company_group/__manifest__.py new file mode 100644 index 000000000..f7fd832fd --- /dev/null +++ b/partner_company_group/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2019 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Partner Company Group", + "summary": "Adds the possibility to add a company group to a company", + "version": "14.0.1.0.0", + "category": "Sales", + "author": "Camptocamp SA, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": ["base", "account", "crm", "sale"], + "website": "https://github.com/OCA/partner-contact", + "data": [ + "views/opportunity_view.xml", + "views/contact_view.xml", + "views/sale_order_view.xml", + "views/account_move_views.xml", + ], + "installable": True, +} diff --git a/partner_company_group/i18n/es.po b/partner_company_group/i18n/es.po new file mode 100644 index 000000000..6e78c9928 --- /dev/null +++ b/partner_company_group/i18n/es.po @@ -0,0 +1,54 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_company_group +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-07-03 17:19+0000\n" +"Last-Translator: Sergio Teruel \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 3.10\n" + +#. module: partner_company_group +#: model_terms:ir.ui.view,arch_db:partner_company_group.view_account_invoice_filter +#: model_terms:ir.ui.view,arch_db:partner_company_group.view_crm_case_opportunities_filter +#: model_terms:ir.ui.view,arch_db:partner_company_group.view_res_partner_filter +#: model_terms:ir.ui.view,arch_db:partner_company_group.view_sales_order_filter +msgid "Company Group" +msgstr "Grupo compañía" + +#. module: partner_company_group +#: model:ir.model.fields,field_description:partner_company_group.field_account_move__company_group_id +#: model:ir.model.fields,field_description:partner_company_group.field_crm_lead__company_group_id +#: model:ir.model.fields,field_description:partner_company_group.field_res_partner__company_group_id +#: model:ir.model.fields,field_description:partner_company_group.field_res_users__company_group_id +#: model:ir.model.fields,field_description:partner_company_group.field_sale_order__company_group_id +msgid "Company group" +msgstr "Grupo compañía" + +#. module: partner_company_group +#: model:ir.model,name:partner_company_group.model_res_partner +msgid "Contact" +msgstr "Contacto" + +#. module: partner_company_group +#: model:ir.model,name:partner_company_group.model_account_move +msgid "Journal Entries" +msgstr "Asientos contables" + +#. module: partner_company_group +#: model:ir.model,name:partner_company_group.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Iniciativa / Oportunidad" + +#. module: partner_company_group +#: model:ir.model,name:partner_company_group.model_sale_order +msgid "Sales Order" +msgstr "Pedido de venta" diff --git a/partner_company_group/i18n/partner_company_group.pot b/partner_company_group/i18n/partner_company_group.pot new file mode 100644 index 000000000..16fd2aa88 --- /dev/null +++ b/partner_company_group/i18n/partner_company_group.pot @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_company_group +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.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_company_group +#: model_terms:ir.ui.view,arch_db:partner_company_group.view_account_invoice_filter +#: model_terms:ir.ui.view,arch_db:partner_company_group.view_crm_case_opportunities_filter +#: model_terms:ir.ui.view,arch_db:partner_company_group.view_res_partner_filter +#: model_terms:ir.ui.view,arch_db:partner_company_group.view_sales_order_filter +msgid "Company Group" +msgstr "" + +#. module: partner_company_group +#: model:ir.model.fields,field_description:partner_company_group.field_account_move__company_group_id +#: model:ir.model.fields,field_description:partner_company_group.field_crm_lead__company_group_id +#: model:ir.model.fields,field_description:partner_company_group.field_res_partner__company_group_id +#: model:ir.model.fields,field_description:partner_company_group.field_res_users__company_group_id +#: model:ir.model.fields,field_description:partner_company_group.field_sale_order__company_group_id +msgid "Company group" +msgstr "" + +#. module: partner_company_group +#: model:ir.model,name:partner_company_group.model_res_partner +msgid "Contact" +msgstr "" + +#. module: partner_company_group +#: model:ir.model,name:partner_company_group.model_account_move +msgid "Journal Entries" +msgstr "" + +#. module: partner_company_group +#: model:ir.model,name:partner_company_group.model_crm_lead +msgid "Lead/Opportunity" +msgstr "" + +#. module: partner_company_group +#: model:ir.model,name:partner_company_group.model_sale_order +msgid "Sales Order" +msgstr "" diff --git a/partner_company_group/i18n/zh_CN.po b/partner_company_group/i18n/zh_CN.po new file mode 100644 index 000000000..b855717b6 --- /dev/null +++ b/partner_company_group/i18n/zh_CN.po @@ -0,0 +1,54 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_company_group +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-03-21 14:13+0000\n" +"Last-Translator: Dong \n" +"Language-Team: none\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 3.10\n" + +#. module: partner_company_group +#: model_terms:ir.ui.view,arch_db:partner_company_group.view_account_invoice_filter +#: model_terms:ir.ui.view,arch_db:partner_company_group.view_crm_case_opportunities_filter +#: model_terms:ir.ui.view,arch_db:partner_company_group.view_res_partner_filter +#: model_terms:ir.ui.view,arch_db:partner_company_group.view_sales_order_filter +msgid "Company Group" +msgstr "集团公司" + +#. module: partner_company_group +#: model:ir.model.fields,field_description:partner_company_group.field_account_move__company_group_id +#: model:ir.model.fields,field_description:partner_company_group.field_crm_lead__company_group_id +#: model:ir.model.fields,field_description:partner_company_group.field_res_partner__company_group_id +#: model:ir.model.fields,field_description:partner_company_group.field_res_users__company_group_id +#: model:ir.model.fields,field_description:partner_company_group.field_sale_order__company_group_id +msgid "Company group" +msgstr "集团公司" + +#. module: partner_company_group +#: model:ir.model,name:partner_company_group.model_res_partner +msgid "Contact" +msgstr "联系人" + +#. module: partner_company_group +#: model:ir.model,name:partner_company_group.model_account_move +msgid "Journal Entries" +msgstr "会计分录" + +#. module: partner_company_group +#: model:ir.model,name:partner_company_group.model_crm_lead +msgid "Lead/Opportunity" +msgstr "线索/商机" + +#. module: partner_company_group +#: model:ir.model,name:partner_company_group.model_sale_order +msgid "Sales Order" +msgstr "销售订单" diff --git a/partner_company_group/models/__init__.py b/partner_company_group/models/__init__.py new file mode 100644 index 000000000..b0fa92b64 --- /dev/null +++ b/partner_company_group/models/__init__.py @@ -0,0 +1,4 @@ +from . import res_partner +from . import crm_lead +from . import sale_order +from . import account_move diff --git a/partner_company_group/models/account_move.py b/partner_company_group/models/account_move.py new file mode 100644 index 000000000..83a342cbb --- /dev/null +++ b/partner_company_group/models/account_move.py @@ -0,0 +1,12 @@ +# Copyright 2019 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class AccountMove(models.Model): + _inherit = "account.move" + + company_group_id = fields.Many2one( + related="partner_id.company_group_id", store=True + ) diff --git a/partner_company_group/models/crm_lead.py b/partner_company_group/models/crm_lead.py new file mode 100644 index 000000000..10b7d3ace --- /dev/null +++ b/partner_company_group/models/crm_lead.py @@ -0,0 +1,12 @@ +# Copyright 2019 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class CrmLead(models.Model): + _inherit = "crm.lead" + + company_group_id = fields.Many2one( + related="partner_id.company_group_id", store=True + ) diff --git a/partner_company_group/models/res_partner.py b/partner_company_group/models/res_partner.py new file mode 100644 index 000000000..6995b0048 --- /dev/null +++ b/partner_company_group/models/res_partner.py @@ -0,0 +1,15 @@ +# Copyright 2019 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class Contact(models.Model): + _inherit = "res.partner" + + company_group_id = fields.Many2one( + "res.partner", "Company group", domain=[("is_company", "=", True)] + ) + + def _commercial_fields(self): + return super()._commercial_fields() + ["company_group_id"] diff --git a/partner_company_group/models/sale_order.py b/partner_company_group/models/sale_order.py new file mode 100644 index 000000000..46e5386a4 --- /dev/null +++ b/partner_company_group/models/sale_order.py @@ -0,0 +1,12 @@ +# Copyright 2019 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + company_group_id = fields.Many2one( + related="partner_id.company_group_id", store=True + ) diff --git a/partner_company_group/readme/CONTRIBUTORS.rst b/partner_company_group/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..36d5510c0 --- /dev/null +++ b/partner_company_group/readme/CONTRIBUTORS.rst @@ -0,0 +1,7 @@ +* Timon Tschanz +* Yannick Vaucher +* `Tecnativa `_: + + * Ernesto Tejeda + +* Tharathip Chaweewongphan diff --git a/partner_company_group/readme/DESCRIPTION.rst b/partner_company_group/readme/DESCRIPTION.rst new file mode 100644 index 000000000..a9fce434c --- /dev/null +++ b/partner_company_group/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This Module adds a company group field to companies, which is also propagated to contacts and allows to search and group for the company group in contact, leads, sale orders and invoices. diff --git a/partner_company_group/static/description/icon.png b/partner_company_group/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/partner_company_group/static/description/icon.png differ diff --git a/partner_company_group/static/description/index.html b/partner_company_group/static/description/index.html new file mode 100644 index 000000000..ee61cff06 --- /dev/null +++ b/partner_company_group/static/description/index.html @@ -0,0 +1,425 @@ + + + + + + +Partner Company Group + + + +
+

Partner Company Group

+ + +

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

+

This Module adds a company group field to companies, which is also propagated to contacts and allows to search and group for the company group in contact, leads, sale orders and invoices.

+

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 smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp SA
  • +
+
+
+

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_company_group/tests/__init__.py b/partner_company_group/tests/__init__.py new file mode 100644 index 000000000..ac7b02108 --- /dev/null +++ b/partner_company_group/tests/__init__.py @@ -0,0 +1 @@ +from . import test_partner_company_group diff --git a/partner_company_group/tests/test_partner_company_group.py b/partner_company_group/tests/test_partner_company_group.py new file mode 100644 index 000000000..3f7075781 --- /dev/null +++ b/partner_company_group/tests/test_partner_company_group.py @@ -0,0 +1,20 @@ +# Copyright 2020 Ecosoft Co., Ltd (http://ecosoft.co.th/) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.tests.common import TransactionCase + + +class TestPartnerCompanyGroup(TransactionCase): + def setUp(self): + super().setUp() + self.partner_model = self.env["res.partner"] + self.company = self.partner_model.create( + {"name": "Test Company", "company_type": "company"} + ) + self.contact = self.partner_model.create( + {"name": "Test Contact", "type": "contact", "parent_id": self.company.id} + ) + + def test_partner_company_group(self): + self.company.write({"company_group_id": self.company.id}) + self.assertEqual(self.company.company_group_id, self.contact.company_group_id) diff --git a/partner_company_group/views/account_move_views.xml b/partner_company_group/views/account_move_views.xml new file mode 100644 index 000000000..715afadf9 --- /dev/null +++ b/partner_company_group/views/account_move_views.xml @@ -0,0 +1,19 @@ + + + + account.move + + + + + + + + + + + diff --git a/partner_company_group/views/contact_view.xml b/partner_company_group/views/contact_view.xml new file mode 100644 index 000000000..8555a8857 --- /dev/null +++ b/partner_company_group/views/contact_view.xml @@ -0,0 +1,33 @@ + + + + res.partner.form + res.partner + + + + + + + + + res.partner.select + res.partner + + + + + + + + + + + diff --git a/partner_company_group/views/opportunity_view.xml b/partner_company_group/views/opportunity_view.xml new file mode 100644 index 000000000..f787ce294 --- /dev/null +++ b/partner_company_group/views/opportunity_view.xml @@ -0,0 +1,20 @@ + + + + crm.lead.search.opportunity + crm.lead + + + + + + + + + + + diff --git a/partner_company_group/views/sale_order_view.xml b/partner_company_group/views/sale_order_view.xml new file mode 100644 index 000000000..2e12c8dc7 --- /dev/null +++ b/partner_company_group/views/sale_order_view.xml @@ -0,0 +1,20 @@ + + + + sale.order.list.select + sale.order + + + + + + + + + + + diff --git a/setup/partner_company_group/odoo/addons/partner_company_group b/setup/partner_company_group/odoo/addons/partner_company_group new file mode 120000 index 000000000..2738b49f7 --- /dev/null +++ b/setup/partner_company_group/odoo/addons/partner_company_group @@ -0,0 +1 @@ +../../../../partner_company_group \ No newline at end of file diff --git a/setup/partner_company_group/setup.py b/setup/partner_company_group/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/partner_company_group/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)