[15.0][MIG] base_cron_exclusion

pull/2882/head
Christopher Ormaza 2021-12-10 11:14:09 -05:00 committed by Carlos Vallés Fuster
parent 64d5e9fc8a
commit fa09454d21
4 changed files with 15 additions and 11 deletions

View File

@ -23,7 +23,7 @@ Base Cron Exclusion
:target: https://runbot.odoo-community.org/runbot/149/14.0 :target: https://runbot.odoo-community.org/runbot/149/14.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
This module extends the functionality of scheduled actions to allow you to This module extends the functionality of scheduled actions to allow you to
select the ones that should not run simultaneously. select the ones that should not run simultaneously.
@ -68,6 +68,7 @@ Contributors
* Lois Rilo <lois.rilo@forgeflow.com> * Lois Rilo <lois.rilo@forgeflow.com>
* Jordi Ballester <jordi.ballester@forgeflow.com> * Jordi Ballester <jordi.ballester@forgeflow.com>
* Bhavesh Odedra <bodedra@opensourceintegrators.com> * Bhavesh Odedra <bodedra@opensourceintegrators.com>
* Christopher Ormaza <chris.ormaza@forgeflow.com>
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@ -85,10 +86,13 @@ promote its widespread use.
.. |maintainer-LoisRForgeFlow| image:: https://github.com/LoisRForgeFlow.png?size=40px .. |maintainer-LoisRForgeFlow| image:: https://github.com/LoisRForgeFlow.png?size=40px
:target: https://github.com/LoisRForgeFlow :target: https://github.com/LoisRForgeFlow
:alt: LoisRForgeFlow :alt: LoisRForgeFlow
.. |maintainer-ChrisOForgeFlow| image:: https://github.com/ChrisOForgeFlow.png?size=40px
:target: https://github.com/ChrisOForgeFlow
:alt: ChrisOForgeFlow
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-LoisRForgeFlow| |maintainer-LoisRForgeFlow| |maintainer-ChrisOForgeFlow|
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/14.0/base_cron_exclusion>`_ project on GitHub. This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/14.0/base_cron_exclusion>`_ project on GitHub.

View File

@ -1,13 +1,13 @@
# Copyright 2017-19 ForgeFlow S.L. (https://www.forgeflow.com) # Copyright 2017-21 ForgeFlow S.L. (https://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{ {
"name": "Base Cron Exclusion", "name": "Base Cron Exclusion",
"summary": "Allow you to select scheduled actions that should not run " "summary": "Allow you to select scheduled actions that should not run "
"simultaneously.", "simultaneously.",
"version": "14.0.1.0.0", "version": "15.0.1.0.0",
"author": "ForgeFlow, Odoo Community Association (OCA)", "author": "ForgeFlow, Odoo Community Association (OCA)",
"maintainers": ["LoisRForgeFlow"], "maintainers": ["LoisRForgeFlow", "ChrisOForgeFlow"],
"development_status": "Production/Stable", "development_status": "Production/Stable",
"website": "https://github.com/OCA/server-tools", "website": "https://github.com/OCA/server-tools",
"category": "Tools", "category": "Tools",

View File

@ -1,9 +1,9 @@
# Copyright 2017-19 ForgeFlow S.L. (https://www.forgeflow.com) # Copyright 2017-21 ForgeFlow S.L. (https://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
import logging import logging
from odoo import _, api, fields, models, sql_db from odoo import _, api, fields, models
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
@ -61,11 +61,10 @@ class IrCron(models.Model):
return lock_cr return lock_cr
@classmethod @classmethod
def _process_job(cls, job_cr, job, cron_cr): def _process_job(cls, db, cron_cr, job):
db = sql_db.db_connect(cls.pool._db.dbname)
locked_crons = cls._lock_mutually_exclusive_cron(db, job["id"]) locked_crons = cls._lock_mutually_exclusive_cron(db, job["id"])
try: try:
res = super(IrCron, cls)._process_job(job_cr, job, cron_cr) res = super(IrCron, cls)._process_job(db, cron_cr, job)
finally: finally:
locked_crons.close() locked_crons.close()
_logger.debug("released blocks for cron job %s" % job["cron_name"]) _logger.debug("released blocks for cron job %s" % job["cron_name"])

View File

@ -1,3 +1,4 @@
* Christopher Ormaza <chris.ormaza@forgeflow.com>
* Lois Rilo <lois.rilo@forgeflow.com> * Lois Rilo <lois.rilo@forgeflow.com>
* Jordi Ballester <jordi.ballester@forgeflow.com> * Jordi Ballester <jordi.ballester@forgeflow.com>
* Bhavesh Odedra <bodedra@opensourceintegrators.com> * Bhavesh Odedra <bodedra@opensourceintegrators.com>