diff --git a/oca_dependencies.txt b/oca_dependencies.txt new file mode 100644 index 00000000000..1fff7bceef6 --- /dev/null +++ b/oca_dependencies.txt @@ -0,0 +1 @@ +queue diff --git a/partner_base_multicompany_default_queue/README.rst b/partner_base_multicompany_default_queue/README.rst new file mode 100644 index 00000000000..fff16d351bd --- /dev/null +++ b/partner_base_multicompany_default_queue/README.rst @@ -0,0 +1,94 @@ +======================================== +Partner Base Multi-Company Default Queue +======================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:d875bc1184c96c1ba6c8761bfb4515baf2e75a5f1139bcd188f52740a09322e5 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-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/partner_base_multicompany_default_queue + :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-partner_base_multicompany_default_queue + :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/multi-company&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Glue module inbetween `partner_base_multicompany` and `queue_job`. + +The propagation of the fields can be costly given the amount of fields to be propagated +and the amount of companies. + +With this module, we want to make the propagation of the fields asynchronous with the creation of queue_jobs. + +.. 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: + +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 +~~~~~~~ + +* Camptocamp + +Contributors +~~~~~~~~~~~~ + +* Denis Leemann + +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-camptocamp| image:: https://github.com/camptocamp.png?size=40px + :target: https://github.com/camptocamp + :alt: camptocamp + +Current `maintainer `__: + +|maintainer-camptocamp| + +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/partner_base_multicompany_default_queue/__init__.py b/partner_base_multicompany_default_queue/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/partner_base_multicompany_default_queue/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/partner_base_multicompany_default_queue/__manifest__.py b/partner_base_multicompany_default_queue/__manifest__.py new file mode 100644 index 00000000000..bca99bd7079 --- /dev/null +++ b/partner_base_multicompany_default_queue/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2024 Camptocamp SA +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0) + +{ + "name": "Partner Base Multi-Company Default Queue", + "summary": "Glue module between partner_base_multicompany and queue_job", + "version": "16.0.0.1.0", + "development_status": "Alpha", + "category": "Technical", + "website": "https://github.com/OCA/multi-company", + "author": "Camptocamp, Odoo Community Association (OCA)", + "maintainers": ["camptocamp"], + "license": "LGPL-3", + "depends": [ + "partner_base_multicompany_default", + "queue_job", + ], + "data": [], +} diff --git a/partner_base_multicompany_default_queue/models/__init__.py b/partner_base_multicompany_default_queue/models/__init__.py new file mode 100644 index 00000000000..0649de787a2 --- /dev/null +++ b/partner_base_multicompany_default_queue/models/__init__.py @@ -0,0 +1,2 @@ +from . import base +from . import partner diff --git a/partner_base_multicompany_default_queue/models/base.py b/partner_base_multicompany_default_queue/models/base.py new file mode 100644 index 00000000000..ab97fb9f330 --- /dev/null +++ b/partner_base_multicompany_default_queue/models/base.py @@ -0,0 +1,18 @@ +# Copyright 2024 Camptocamp +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html) + +from odoo import api, models + + +class Base(models.AbstractModel): + + _inherit = "base" + + @api.model + def _job_prepare_context_before_enqueue_keys(self): + """Keys to keep in context of stored jobs + Empty by default for backward compatibility. + """ + return super()._job_prepare_context_before_enqueue_keys() + ( + "property_propagation", + ) diff --git a/partner_base_multicompany_default_queue/models/partner.py b/partner_base_multicompany_default_queue/models/partner.py new file mode 100644 index 00000000000..56f674a1b17 --- /dev/null +++ b/partner_base_multicompany_default_queue/models/partner.py @@ -0,0 +1,23 @@ +# Copyright 2024 Camptocamp SA +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0) + +from odoo import models + + +class Partner(models.Model): + + _inherit = "res.partner" + + def _propagate_property_fields(self): + # Adding a call with_delay() make an aync propagation of the property fields + if ( + self.env.context.get("force_property_propagation") + and not self.env.context.get("property_propagation") == "enqueued" + ): + # changing the context to avoid infinite loop + self_enqueued = self.with_context(property_propagation="enqueued") + return ( + super(Partner, self_enqueued).with_delay()._propagate_property_fields() + ) + else: + return super()._propagate_property_fields() diff --git a/partner_base_multicompany_default_queue/readme/CONTRIBUTORS.rst b/partner_base_multicompany_default_queue/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..fcb7aaa08fb --- /dev/null +++ b/partner_base_multicompany_default_queue/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Denis Leemann diff --git a/partner_base_multicompany_default_queue/readme/DESCRIPTION.rst b/partner_base_multicompany_default_queue/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..0021a934334 --- /dev/null +++ b/partner_base_multicompany_default_queue/readme/DESCRIPTION.rst @@ -0,0 +1,6 @@ +Glue module inbetween `partner_base_multicompany` and `queue_job`. + +The propagation of the fields can be costly given the amount of fields to be propagated +and the amount of companies. + +With this module, we want to make the propagation of the fields asynchronous with the creation of queue_jobs. diff --git a/partner_base_multicompany_default_queue/static/description/index.html b/partner_base_multicompany_default_queue/static/description/index.html new file mode 100644 index 00000000000..471b071b672 --- /dev/null +++ b/partner_base_multicompany_default_queue/static/description/index.html @@ -0,0 +1,431 @@ + + + + + +Partner Base Multi-Company Default Queue + + + +
+

Partner Base Multi-Company Default Queue

+ + +

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

+

Glue module inbetween partner_base_multicompany and queue_job.

+

The propagation of the fields can be costly given the amount of fields to be propagated +and the amount of companies.

+

With this module, we want to make the propagation of the fields asynchronous with the creation of queue_jobs.

+
+

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

+ +
+

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

+
    +
  • Camptocamp
  • +
+
+ +
+

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:

+

camptocamp

+

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/setup/partner_base_multicompany_default_queue/odoo/addons/partner_base_multicompany_default_queue b/setup/partner_base_multicompany_default_queue/odoo/addons/partner_base_multicompany_default_queue new file mode 120000 index 00000000000..d392d4d6a89 --- /dev/null +++ b/setup/partner_base_multicompany_default_queue/odoo/addons/partner_base_multicompany_default_queue @@ -0,0 +1 @@ +../../../../partner_base_multicompany_default_queue \ No newline at end of file diff --git a/setup/partner_base_multicompany_default_queue/setup.py b/setup/partner_base_multicompany_default_queue/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/partner_base_multicompany_default_queue/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)