diff --git a/company_cascade_category/README.rst b/company_cascade_category/README.rst new file mode 100644 index 000000000..abd9dee1d --- /dev/null +++ b/company_cascade_category/README.rst @@ -0,0 +1,99 @@ +=================== +Cascading companies +=================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png + :target: https://odoo-community.org/page/development-status + :alt: Alpha +.. |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%2Fmulti--company-lightgray.png?logo=github + :target: https://github.com/OCA/multi-company/tree/16.0/company_cascade + :alt: OCA/multi-company +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/multi-company-16-0/multi-company-16-0-company_cascade + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/multi-company&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module maintains relations between company specific records (think accounts, journals) of parent and child companies, enabling users to configure things in the parent company and then copy (=cascade) this configuration to child companies. + +Originally conceived for financial hosting, this mechanism is useful for any setting where Odoo is used to manage multiple organizations that have a very similar financial configuration, but organizational units are a bad fit because the companies are different (legal) entities, or just need more independence from the parent company than OUs provide. + +.. IMPORTANT:: + This is an alpha version, the data model and design can change at any time without warning. + Only for development or testing purpose, do not use in production. + `More details on development status `_ + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +#. Go to an account/journal/etc in your parent company +#. Click Actions/Cascade to child companies +#. If not existing yet, an equivalent record will be created in the child company +#. If an equivalent record exists already, it will be overwritten with the parent company's values + +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 +~~~~~~~ + +* Hunki Enterprises BV +* Moshchot Coop + +Contributors +~~~~~~~~~~~~ + +* Holger Brunn (https://hunki-enterprises.com) + +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-hbrunn| image:: https://github.com/hbrunn.png?size=40px + :target: https://github.com/hbrunn + :alt: hbrunn + +Current `maintainer `__: + +|maintainer-hbrunn| + +This module is part of the `OCA/multi-company `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/company_cascade_category/__init__.py b/company_cascade_category/__init__.py new file mode 100644 index 000000000..aee8895e7 --- /dev/null +++ b/company_cascade_category/__init__.py @@ -0,0 +1,2 @@ +from . import models +from . import wizards diff --git a/company_cascade_category/__manifest__.py b/company_cascade_category/__manifest__.py new file mode 100644 index 000000000..cb3fdee6d --- /dev/null +++ b/company_cascade_category/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2023 Hunki Enterprises BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) + +{ + "name": "Cascading companies (company category support)", + "summary": "Sync configuration from parent companies to children", + "version": "16.0.1.0.0", + "development_status": "Alpha", + "category": "Technical", + "website": "https://github.com/moshchot/BANKayma", + "author": "Hunki Enterprises BV, Odoo Community Association (OCA), Moshchot Coop", + "maintainers": ["hbrunn"], + "license": "AGPL-3", + "application": False, + "installable": True, + "preloadable": True, + "depends": ["company_cascade", "res_company_category"], + "data": [ + "wizards/company_cascade_wizard.xml", + ], +} diff --git a/company_cascade_category/i18n/he_IL.po b/company_cascade_category/i18n/he_IL.po new file mode 100644 index 000000000..83b48e26c --- /dev/null +++ b/company_cascade_category/i18n/he_IL.po @@ -0,0 +1,247 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * company_cascade +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-07-12 09:38+0000\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: he_IL\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" + +#. module: company_cascade +#: model:ir.model,name:company_cascade.model_account_account +msgid "Account" +msgstr "" + +#. module: company_cascade +#: model:ir.model,name:company_cascade.model_account_fiscal_position_account +msgid "Accounts Mapping of Fiscal Position" +msgstr "" + +#. module: company_cascade +#: model:ir.model,name:company_cascade.model_ir_actions_actions +msgid "Actions" +msgstr "" + +#. module: company_cascade +#: model:ir.model,name:company_cascade.model_account_analytic_account +msgid "Analytic Account" +msgstr "" + +#. module: company_cascade +#: model:ir.model,name:company_cascade.model_account_analytic_plan +msgid "Analytic Plans" +msgstr "" + +#. module: company_cascade +#: model_terms:ir.ui.view,arch_db:company_cascade.view_company_cascade_wizard_form +msgid "Cancel" +msgstr "" + +#. module: company_cascade +#: model:ir.model.fields,field_description:company_cascade.field_res_company__company_cascade_from_parent +msgid "Cascade from parent" +msgstr "" + +#. module: company_cascade +#: model:ir.model,name:company_cascade.model_company_cascade_wizard +msgid "Cascade records to child companies" +msgstr "" + +#. module: company_cascade +#: model:ir.actions.act_window,name:company_cascade.action_company_cascade_wizard +#: model_terms:ir.ui.view,arch_db:company_cascade.view_company_cascade_wizard_form +msgid "Cascade to child companies" +msgstr "" + +#. module: company_cascade +#: model:ir.model,name:company_cascade.model_company_cascade_mixin +msgid "Cascade values to child companies" +msgstr "" + +#. module: company_cascade +#: model:ir.model,name:company_cascade.model_res_company +msgid "Companies" +msgstr "" + +#. module: company_cascade +#: model:ir.model.fields,field_description:company_cascade.field_account_payment_method_line__company_id +#: model:ir.model.fields,field_description:company_cascade.field_res_company__company_id +msgid "Company" +msgstr "" + +#. module: company_cascade +#: model:ir.model.fields,field_description:company_cascade.field_account_account__company_cascade_child_ids +#: model:ir.model.fields,field_description:company_cascade.field_account_analytic_account__company_cascade_child_ids +#: model:ir.model.fields,field_description:company_cascade.field_account_analytic_plan__company_cascade_child_ids +#: model:ir.model.fields,field_description:company_cascade.field_account_fiscal_position__company_cascade_child_ids +#: model:ir.model.fields,field_description:company_cascade.field_account_fiscal_position_account__company_cascade_child_ids +#: model:ir.model.fields,field_description:company_cascade.field_account_fiscal_position_tax__company_cascade_child_ids +#: model:ir.model.fields,field_description:company_cascade.field_account_journal__company_cascade_child_ids +#: model:ir.model.fields,field_description:company_cascade.field_account_payment_method_line__company_cascade_child_ids +#: model:ir.model.fields,field_description:company_cascade.field_account_payment_mode__company_cascade_child_ids +#: model:ir.model.fields,field_description:company_cascade.field_account_payment_term__company_cascade_child_ids +#: model:ir.model.fields,field_description:company_cascade.field_account_tax__company_cascade_child_ids +#: model:ir.model.fields,field_description:company_cascade.field_account_tax_repartition_line__company_cascade_child_ids +#: model:ir.model.fields,field_description:company_cascade.field_company_cascade_mixin__company_cascade_child_ids +#: model:ir.model.fields,field_description:company_cascade.field_ir_property__company_cascade_child_ids +#: model:ir.model.fields,field_description:company_cascade.field_ir_sequence__company_cascade_child_ids +#: model:ir.model.fields,field_description:company_cascade.field_payment_provider__company_cascade_child_ids +#: model:ir.model.fields,field_description:company_cascade.field_res_company__company_cascade_child_ids +msgid "Company Cascade Child" +msgstr "" + +#. module: company_cascade +#: model:ir.model.fields,field_description:company_cascade.field_account_account__company_cascade_parent_id +#: model:ir.model.fields,field_description:company_cascade.field_account_analytic_account__company_cascade_parent_id +#: model:ir.model.fields,field_description:company_cascade.field_account_analytic_plan__company_cascade_parent_id +#: model:ir.model.fields,field_description:company_cascade.field_account_fiscal_position__company_cascade_parent_id +#: model:ir.model.fields,field_description:company_cascade.field_account_fiscal_position_account__company_cascade_parent_id +#: model:ir.model.fields,field_description:company_cascade.field_account_fiscal_position_tax__company_cascade_parent_id +#: model:ir.model.fields,field_description:company_cascade.field_account_journal__company_cascade_parent_id +#: model:ir.model.fields,field_description:company_cascade.field_account_payment_method_line__company_cascade_parent_id +#: model:ir.model.fields,field_description:company_cascade.field_account_payment_mode__company_cascade_parent_id +#: model:ir.model.fields,field_description:company_cascade.field_account_payment_term__company_cascade_parent_id +#: model:ir.model.fields,field_description:company_cascade.field_account_tax__company_cascade_parent_id +#: model:ir.model.fields,field_description:company_cascade.field_account_tax_repartition_line__company_cascade_parent_id +#: model:ir.model.fields,field_description:company_cascade.field_company_cascade_mixin__company_cascade_parent_id +#: model:ir.model.fields,field_description:company_cascade.field_ir_property__company_cascade_parent_id +#: model:ir.model.fields,field_description:company_cascade.field_ir_sequence__company_cascade_parent_id +#: model:ir.model.fields,field_description:company_cascade.field_payment_provider__company_cascade_parent_id +#: model:ir.model.fields,field_description:company_cascade.field_res_company__company_cascade_parent_id +msgid "Company Cascade Parent" +msgstr "" + +#. module: company_cascade +#: model:ir.model,name:company_cascade.model_ir_property +msgid "Company Property" +msgstr "" + +#. module: company_cascade +#: model:ir.model.fields,help:company_cascade.field_account_payment_method_line__company_id +msgid "Company related to this journal" +msgstr "" + +#. module: company_cascade +#: model_terms:ir.ui.view,arch_db:company_cascade.view_company_cascade_wizard_form +msgid "Create/Overwrite equivalent records of child companies?" +msgstr "" + +#. module: company_cascade +#: model:ir.model.fields,field_description:company_cascade.field_company_cascade_wizard__create_uid +msgid "Created by" +msgstr "" + +#. module: company_cascade +#: model:ir.model.fields,field_description:company_cascade.field_company_cascade_wizard__create_date +msgid "Created on" +msgstr "" + +#. module: company_cascade +#: model:ir.model.fields,field_description:company_cascade.field_company_cascade_wizard__display_name +msgid "Display Name" +msgstr "" + +#. module: company_cascade +#: model:ir.model.fields,field_description:company_cascade.field_company_cascade_wizard__field_ids +msgid "Fields to cascade" +msgstr "" + +#. module: company_cascade +#: model:ir.model,name:company_cascade.model_account_fiscal_position +msgid "Fiscal Position" +msgstr "" + +#. module: company_cascade +#: model:ir.model.fields,field_description:company_cascade.field_company_cascade_wizard__id +msgid "ID" +msgstr "" + +#. module: company_cascade +#: model:ir.model,name:company_cascade.model_account_journal +msgid "Journal" +msgstr "" + +#. module: company_cascade +#: model:ir.model.fields,field_description:company_cascade.field_company_cascade_wizard____last_update +msgid "Last Modified on" +msgstr "" + +#. module: company_cascade +#: model:ir.model.fields,field_description:company_cascade.field_company_cascade_wizard__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: company_cascade +#: model:ir.model.fields,field_description:company_cascade.field_company_cascade_wizard__write_date +msgid "Last Updated on" +msgstr "" + +#. module: company_cascade +#: model:ir.model.fields,field_description:company_cascade.field_company_cascade_wizard__model_id +msgid "Model" +msgstr "" + +#. module: company_cascade +#. odoo-python +#: code:addons/company_cascade/wizards/company_cascade_wizard.py:0 +#, python-format +msgid "Only admin can cascade companies" +msgstr "" + +#. module: company_cascade +#: model:ir.model,name:company_cascade.model_account_payment_method_line +msgid "Payment Methods" +msgstr "" + +#. module: company_cascade +#: model:ir.model,name:company_cascade.model_account_payment_mode +msgid "Payment Modes" +msgstr "" + +#. module: company_cascade +#: model:ir.model,name:company_cascade.model_payment_provider +msgid "Payment Provider" +msgstr "" + +#. module: company_cascade +#: model:ir.model,name:company_cascade.model_account_payment_term +msgid "Payment Terms" +msgstr "" + +#. module: company_cascade +#: model_terms:ir.ui.view,arch_db:company_cascade.view_company_cascade_wizard_form +msgid "Select fields to cascade" +msgstr "" + +#. module: company_cascade +#: model:ir.model.fields,help:company_cascade.field_company_cascade_wizard__field_ids +msgid "Select fields to cascade, otherwise all fields will be cascaded" +msgstr "" + +#. module: company_cascade +#: model:ir.model,name:company_cascade.model_ir_sequence +msgid "Sequence" +msgstr "" + +#. module: company_cascade +#: model:ir.model,name:company_cascade.model_account_tax +msgid "Tax" +msgstr "" + +#. module: company_cascade +#: model:ir.model,name:company_cascade.model_account_fiscal_position_tax +msgid "Tax Mapping of Fiscal Position" +msgstr "" + +#. module: company_cascade +#: model:ir.model,name:company_cascade.model_account_tax_repartition_line +msgid "Tax Repartition Line" +msgstr "" diff --git a/company_cascade_category/models/__init__.py b/company_cascade_category/models/__init__.py new file mode 100644 index 000000000..2af2c754f --- /dev/null +++ b/company_cascade_category/models/__init__.py @@ -0,0 +1 @@ +from . import company_cascade_mixin diff --git a/company_cascade_category/models/company_cascade_mixin.py b/company_cascade_category/models/company_cascade_mixin.py new file mode 100644 index 000000000..9671d5699 --- /dev/null +++ b/company_cascade_category/models/company_cascade_mixin.py @@ -0,0 +1,38 @@ +# Copyright 2024 Hunki Enterprises BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + + +from odoo import models + + +class CompanyCascadeMixin(models.AbstractModel): + _inherit = "company.cascade.mixin" + + def _company_cascade_get_categories(self): + return self.env.context.get("company_cascade_catgory_categories") or self.env[ + "res.company.category" + ].search([]) + + def _company_cascade_get_companies(self): + categories = self._company_cascade_get_categories() + return ( + super() + ._company_cascade_get_companies() + .filtered(lambda x: x.company_id in categories) + ) + + def _company_cascade_get_children(self): + categories = self._company_cascade_get_categories() + return ( + super() + ._company_cascade_get_children() + .filtered(lambda x: x.company_id in categories) + ) + + def _company_cascade_get_all(self, company=None): + categories = self._company_cascade_get_categories() + return ( + super() + ._company_cascade_get_all(company=company) + .filtered(lambda x: x.company_id in categories) + ) diff --git a/company_cascade_category/readme/CONTRIBUTORS.rst b/company_cascade_category/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..33b6eb2c3 --- /dev/null +++ b/company_cascade_category/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Holger Brunn (https://hunki-enterprises.com) diff --git a/company_cascade_category/readme/DESCRIPTION.rst b/company_cascade_category/readme/DESCRIPTION.rst new file mode 100644 index 000000000..2238d7fc7 --- /dev/null +++ b/company_cascade_category/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module maintains relations between company specific records (think accounts, journals) of parent and child companies, enabling users to configure things in the parent company and then copy (=cascade) this configuration to child companies. + +Originally conceived for financial hosting, this mechanism is useful for any setting where Odoo is used to manage multiple organizations that have a very similar financial configuration, but organizational units are a bad fit because the companies are different (legal) entities, or just need more independence from the parent company than OUs provide. diff --git a/company_cascade_category/readme/USAGE.rst b/company_cascade_category/readme/USAGE.rst new file mode 100644 index 000000000..e11c1214a --- /dev/null +++ b/company_cascade_category/readme/USAGE.rst @@ -0,0 +1,7 @@ +To use this module, you need to: + +#. Go to an account/journal/etc in your parent company +#. Click Actions/Cascade to child companies +#. Select the company categories to cascade to +#. If not existing yet, an equivalent record will be created in the child company +#. If an equivalent record exists already, it will be overwritten with the parent company's values diff --git a/company_cascade_category/static/description/icon.png b/company_cascade_category/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/company_cascade_category/static/description/icon.png differ diff --git a/company_cascade_category/static/description/index.html b/company_cascade_category/static/description/index.html new file mode 100644 index 000000000..96b90bf34 --- /dev/null +++ b/company_cascade_category/static/description/index.html @@ -0,0 +1,440 @@ + + + + + + +Cascading companies + + + +
+

Cascading companies

+ + +

Alpha License: AGPL-3 OCA/multi-company Translate me on Weblate Try me on Runboat

+

This module maintains relations between company specific records (think accounts, journals) of parent and child companies, enabling users to configure things in the parent company and then copy (=cascade) this configuration to child companies.

+

Originally conceived for financial hosting, this mechanism is useful for any setting where Odoo is used to manage multiple organizations that have a very similar financial configuration, but organizational units are a bad fit because the companies are different (legal) entities, or just need more independence from the parent company than OUs provide.

+
+

Important

+

This is an alpha version, the data model and design can change at any time without warning. +Only for development or testing purpose, do not use in production. +More details on development status

+
+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to an account/journal/etc in your parent company
  2. +
  3. Click Actions/Cascade to child companies
  4. +
  5. If not existing yet, an equivalent record will be created in the child company
  6. +
  7. If an equivalent record exists already, it will be overwritten with the parent company’s values
  8. +
+
+
+

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

+
    +
  • Hunki Enterprises BV
  • +
  • Moshchot Coop
  • +
+
+ +
+

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:

+

hbrunn

+

This module is part of the OCA/multi-company project on GitHub.

+

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

+
+
+
+ + diff --git a/company_cascade_category/tests/__init__.py b/company_cascade_category/tests/__init__.py new file mode 100644 index 000000000..e5068547a --- /dev/null +++ b/company_cascade_category/tests/__init__.py @@ -0,0 +1 @@ +from . import test_company_cascade diff --git a/company_cascade_category/tests/test_company_cascade.py b/company_cascade_category/tests/test_company_cascade.py new file mode 100644 index 000000000..c4edb4df9 --- /dev/null +++ b/company_cascade_category/tests/test_company_cascade.py @@ -0,0 +1,2 @@ +# Copyright 2024 Hunki Enterprises BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) diff --git a/company_cascade_category/wizards/__init__.py b/company_cascade_category/wizards/__init__.py new file mode 100644 index 000000000..7542edff5 --- /dev/null +++ b/company_cascade_category/wizards/__init__.py @@ -0,0 +1 @@ +from . import company_cascade_wizard diff --git a/company_cascade_category/wizards/company_cascade_wizard.py b/company_cascade_category/wizards/company_cascade_wizard.py new file mode 100644 index 000000000..de6ffda78 --- /dev/null +++ b/company_cascade_category/wizards/company_cascade_wizard.py @@ -0,0 +1,20 @@ +# Copyright 2024 Hunki Enterprises BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class CompanyCascadeWizard(models.TransientModel): + _inherit = "company.cascade.wizard" + _description = "Cascade records to child companies" + + category_ids = fields.Many2many( + "res.company.category", + string="Categories", + ) + + def action_cascade(self): + return super( + CompanyCascadeWizard, + self.with_context(company_cascade_category_categories=self.category_ids), + ).action_cascade() diff --git a/company_cascade_category/wizards/company_cascade_wizard.xml b/company_cascade_category/wizards/company_cascade_wizard.xml new file mode 100644 index 000000000..71ff85d00 --- /dev/null +++ b/company_cascade_category/wizards/company_cascade_wizard.xml @@ -0,0 +1,31 @@ + + + + + company.cascade.wizard + + +
+ + + + +
+
+
+
diff --git a/setup/company_cascade_category/odoo/addons/company_cascade_category b/setup/company_cascade_category/odoo/addons/company_cascade_category new file mode 120000 index 000000000..1c27b0f52 --- /dev/null +++ b/setup/company_cascade_category/odoo/addons/company_cascade_category @@ -0,0 +1 @@ +../../../../company_cascade_category \ No newline at end of file diff --git a/setup/company_cascade_category/setup.py b/setup/company_cascade_category/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/company_cascade_category/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)