Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
85546be
[ADD] Module 'auditlog' - A substitute to the deprecated 'audittrail'…
sebalix Jan 21, 2015
f8a41a7
[FIX] Module 'auditlog' - Fix some flake8 errors
sebalix Jan 22, 2015
87bf703
[FIX] Module 'auditlog' - Put the module description in a README.rst …
sebalix Jan 22, 2015
610846f
[ADD] Module 'auditlog' - 'auditlog.pot' file added
sebalix Jan 22, 2015
df303bf
[IMP] Module 'auditlog' - Split the 'create_logs()' method in several…
sebalix Jan 22, 2015
65c63e5
[IMP] Module 'auditlog' - Clean up vim lines
sebalix Jan 22, 2015
3f48b6d
[IMP] Module 'auditlog' - Add 'name' attributes on some filters and o…
sebalix Jan 22, 2015
711b616
[IMP] Module 'auditlog' - Removed the 'timestamp' field from the 'aud…
sebalix Jan 28, 2015
29df5a4
[IMP] Module 'auditlog' - README.rst updated (based on the OCA template)
sebalix Jan 28, 2015
6e9785d
[FIX] Module 'auditlog' - 'time' module imported but unused
sebalix Jan 28, 2015
ff0b7d7
[IMP] ignore rules for nonexisting objects
hbrunn Jan 28, 2015
d73d1c5
[ADD] init hook to migrate from audittrail
hbrunn Jan 28, 2015
7b7019c
[FIX] also migrate id sequences
hbrunn Jan 28, 2015
e30c204
[IMP] Module 'auditlog' - Contributors updated in README.rst + AUTHOR…
sebalix Jan 28, 2015
6273d82
[ADD] change xmlids of legacy rules to point to auditlog.rule
hbrunn Jan 28, 2015
f1e4dcb
[IMP] use new import of _, SUPERUSER_ID
hbrunn Jan 29, 2015
8824b42
[ADD] allow overriding modules to pass additional log values
hbrunn Jan 29, 2015
f57bc32
[IMP] cache model and field ids
hbrunn Jan 29, 2015
34176be
[IMP] don't make a temporary copy of dict keys
hbrunn Jan 29, 2015
9d23a0b
[FIX] don't reset caches in register_hook
hbrunn Jan 29, 2015
81f3c9e
[ADD] pass old_values to create_log when deleting a record
hbrunn Jan 29, 2015
e2c4921
[FIX] cope with no additional log values
hbrunn Jan 29, 2015
ce62cab
[ADD] tests
hbrunn Jan 29, 2015
23b6cae
[FIX] Module 'auditlog' - local variable 'ir_model' is assigned to bu…
sebalix Jan 30, 2015
7c5cd9a
[IMP] use a model for test that is not influenced by the mail module
hbrunn Feb 1, 2015
b4bb515
[FIX] Module 'auditlog' - Remove 'active' field from __openerp__.py
sebalix Feb 2, 2015
223b8e3
[IMP] Module 'auditlog' - README.rst updated (inform that the audittr…
sebalix Feb 2, 2015
123f03e
[IMP] Module 'auditlog' - Useless lines of code removed
sebalix Feb 2, 2015
d739093
[IMP] Module 'auditlog' - Autoremove 'auditlog.log.line' records when…
sebalix Feb 4, 2015
1647289
[IMP] Module 'auditlog' - Model 'auditlog.log.line', 'field_name' and…
sebalix Feb 4, 2015
0fc90cb
[IMP] Module 'auditlog' - Added a second test using cached data gener…
sebalix Feb 4, 2015
d0428b2
[FIX] Module 'auditlog' - Data dictionaries of fields and models are …
sebalix Feb 4, 2015
49bdeb0
[IMP] Module 'auditlog' - Add a test regarding a resource deleted thr…
sebalix Feb 9, 2015
e5d4435
[FIX] Module 'auditlog' - When updating a resource, filter IDs on 2ma…
sebalix Feb 9, 2015
fdafcff
[ADD] migration script
hbrunn Feb 16, 2015
0ad5f76
Add OCA as author of OCA addons
gurneyalex Mar 2, 2015
58bd2b3
[IMP] Module 'auditlog' - Performing logs on 'read' operations + Some…
sebalix Apr 1, 2015
05f15b2
[FIX] Module 'auditlog' - Replace 'try/except statement by 'isinstanc…
sebalix Apr 2, 2015
bf720b7
[FIX] Module 'auditlog' - Support 'read' calls with one ID or a list …
sebalix Apr 2, 2015
4deb116
[FIX] Module 'auditlog' - Unit tests, do not create users with the 'n…
sebalix Apr 8, 2015
c9b5e6f
[ADD] German translation for auditlog
eqms Apr 19, 2015
6055405
[FIX] Module 'auditlog' - No log for internal processing (e.g. 'read'…
sebalix Apr 19, 2015
4ee78da
[FIX] Module 'auditlog' - Fix lint check
sebalix Apr 19, 2015
2a914db
[IMP] Module 'auditlog' - Unsubscribe rules before removing them + Un…
sebalix Apr 19, 2015
a806573
[FIX] Module 'auditlog' - Log fields coming from polymorphic inherita…
sebalix Apr 19, 2015
79c6c56
[IMP] Module 'auditlog' - Remove the unit test causing trouble with T…
sebalix Apr 21, 2015
454fde9
[ADD] auditlog: Added Spanish translation.
May 17, 2015
5fc1289
Add bug tracker link on README.rst
yvaucher May 22, 2015
b7acd5f
[FIX] ie related fields don't have an
hbrunn Jun 11, 2015
6a9d008
[ADD] comment
hbrunn Jul 8, 2015
ff1f54c
[FIX] make patched create downgrade correctly to v6.1
hbrunn Jul 17, 2015
3fe8f72
Add missing default oca icons
yvaucher Aug 18, 2015
3021e78
[FIX] if someone else has overridden our patched,
hbrunn Sep 16, 2015
e2d753c
OCA Transbot updated translations from Transifex
oca-transbot Oct 5, 2015
1b087a8
[UPD] prefix versions with 8.0
sbidoul Oct 9, 2015
5259719
[MIG] Make modules uninstallable
pedrobaeza Oct 14, 2015
c7651eb
[FIX] remove en.po that was erroneously created by transbot
sbidoul Aug 15, 2016
71072e6
[MIG] Rename manifest files
pedrobaeza Oct 6, 2016
638daa5
Module 'auditlog' - Log HTTP user sessions and requests
sebalix Oct 30, 2015
1a68382
Module 'auditlog' - Bump the version to 1.1.0
sebalix Oct 30, 2015
e80ec4d
Module 'auditlog' - Cleanup XML views (types removed)
sebalix Oct 30, 2015
d659f00
Module 'auditlog' - A log can be created with no current HTTP request…
sebalix Oct 30, 2015
c10d773
Module 'auditlog' - 'display_name' fields added for the user session …
sebalix Oct 31, 2015
246c65f
Module 'auditlog' - Fix pylint check
sebalix Oct 31, 2015
d52535c
turn off prefetching when reding values
hbrunn Nov 26, 2015
a30c7a0
auditlog - Ability to choose the log type on the rule: Full log (comp…
sebalix Feb 1, 2016
8b45f67
auditlog - Field 'type' renamed to 'log_type'
sebalix Feb 13, 2016
4f65998
auditlog - Bump version number
sebalix Feb 13, 2016
ab26789
auditlog - Auto-vacuum logs, HTTP requests and HTTP user sessions
sebalix Feb 13, 2016
f871405
auditlog - Icon added + README updated (screenshots)
sebalix May 26, 2016
a9bbf8e
singleton error if we saved the current session two times (#473)
hbrunn Jul 4, 2016
50885fc
Migrate auditlog module from 8.0 to 9.0
holdenrehg Jun 6, 2016
558e8db
Updated the __openerp__.xml to include the license and images fields
holdenrehg Jun 13, 2016
5b92543
auditlog module, Remove duplicate license key from openerp config
holdenrehg Jun 24, 2016
9fdbbca
auditlog: Remove migration from audittrail functionality, this is not…
holdenrehg Jun 27, 2016
cac09b2
auditlog: Remove pre_init_hook reference from openerp, no pre_init ho…
holdenrehg Jun 27, 2016
03a12f3
auditlog - Lint
sebalix Nov 14, 2016
64b13c3
auditlog - Migrate 'AuditlogRule.create' and 'AuditlogRule.write' met…
sebalix Nov 14, 2016
e727939
[MIG] auditlog: Migrated to 10.0
Jan 20, 2017
8441c12
[FIX] Request id no longer exists after concurrency rollback
StefanRijnhart Jan 16, 2017
b0f8f5e
[FIX] auditlog: Duplicate logging
obulkin Feb 16, 2017
86f018a
OCA Transbot updated translations from Transifex
oca-transbot Oct 26, 2015
2c1e571
[MIG] auditlog: Migration to 11.0
etobella Nov 3, 2017
ca3c57b
[add] https
rgarnau Nov 14, 2017
1f6d5a7
OCA Transbot updated translations from Transifex
oca-transbot Dec 9, 2017
ef54450
OCA Transbot updated translations from Transifex
oca-transbot Dec 30, 2017
9654168
OCA Transbot updated translations from Transifex
oca-transbot Jan 16, 2018
bb3be02
OCA Transbot updated translations from Transifex
oca-transbot Mar 3, 2018
e82ded7
remove obsolete .pot files [ci skip]
sbidoul Jun 15, 2018
33fe065
[UPD] Update auditlog.pot
oca-travis Jun 17, 2018
30a21bc
Translated using Weblate (Português (Brasil))
Jun 20, 2018
ef76806
Translated using Weblate (Danish)
hhgabelgaard Jun 20, 2018
b2acd2e
Translated using Weblate (Portuguese (Brazil))
Jun 20, 2018
ed3bda9
Translated using Weblate (Spanish)
etobella Jul 13, 2018
063d01e
[ADD] split module sale_exception into base_exception
mourad-ehm Feb 21, 2017
51ca697
OCA Transbot updated translations from Transifex
oca-transbot May 1, 2017
d8825c7
Fix menu in base_exception (#803)
eugen-don May 20, 2017
d4a4a4d
[FIX] base_exception: '_check_exception' is 'api.multi' since it's ca…
lmignon Jun 9, 2017
900a431
OCA Transbot updated translations from Transifex
oca-transbot Jun 10, 2017
aeda972
[MIG] base_exception: Migration to 11.0
mourad-ehm Oct 13, 2017
3d948cd
style fixes
JordiBForgeFlow Nov 22, 2017
a37f1d3
[FIX] temp model test access rule & fix OCA remarks
mourad-ehm Nov 24, 2017
38193fd
OCA Transbot updated translations from Transifex
oca-transbot Dec 9, 2017
3ec02ec
OCA Transbot updated translations from Transifex
oca-transbot Dec 30, 2017
038e86e
Refactor tests of module 'base_exception'.
JordiBForgeFlow Dec 28, 2017
59a05c2
OCA Transbot updated translations from Transifex
oca-transbot Jan 17, 2018
321262d
[FIX] Enable post_install for tests + pylint
astirpe Feb 15, 2018
9c66905
OCA Transbot updated translations from Transifex
oca-transbot Mar 3, 2018
3a7f7e1
remove obsolete .pot files [ci skip]
sbidoul Jun 15, 2018
22f3c1d
[UPD] Update base_exception.pot
oca-travis Jun 17, 2018
f4d8388
Translated using Weblate (Arabic)
osoul Jun 28, 2018
f884235
Translated using Weblate (Persian)
fshahy Jul 21, 2018
09a37e7
Translated using Weblate (Portuguese (Brazil))
Aug 3, 2018
cfd5922
[10.0] add new module to manage technical user on company
Jun 14, 2017
9e0bfdc
OCA Transbot updated translations from Transifex
oca-transbot Dec 2, 2017
30489ed
[MIG] base_technical_user to V11
hugosantosred Feb 7, 2018
0a1904d
[UPD] Update base_technical_user.pot
oca-travis Jun 17, 2018
0a93ec9
Added translation using Weblate (Arabic)
osoul Jun 29, 2018
b02416d
Global pylint cleanup
simahawk Sep 3, 2018
391b176
12.0 Migration base_cron_exclusion
Oct 13, 2018
8f6b89c
[MIG] base_exception: Migration to 12.0
digitalsatori Oct 13, 2018
87094ee
update version to 12
Oct 13, 2018
b69a6e7
[MIG] base_technical_user: Migration to 12.0
Oct 13, 2018
9ff5701
Merge pull request #4 from 719923505/12.0-mig-base_tecnical_user
GoodERPJeff Oct 13, 2018
0c1232e
Merge pull request #3 from digitalsatori/12.0-mig-base-exception
GoodERPJeff Oct 13, 2018
1a26258
Merge pull request #2 from daimengmeng/12.0
GoodERPJeff Oct 13, 2018
adce27f
Merge pull request #1 from tanghulu0608/12.0-mig-auditlog
GoodERPJeff Oct 13, 2018
c97e552
mig pr for base_cron_exclusion
Oct 14, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions base_cron_exclusion/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see many remarks from #1392 (review) that might apply here

:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

===================
Base Cron Exclusion
===================

This module extends the functionality of scheduled actions to allow you to
select the ones that should not run simultaneously.

Usage
=====

To use this module, you need to:

#. Go to *Settings > Technical > Automation > Scheduled Actions*.
#. In the form view go to the tab *Mutually Exclusive Scheduled Actions*.
#. Fill it with the actions that should be blocked while running the action
you are editing. Note that this is mutual and the selected actions will
block the initial action when running.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/11.0

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.

Credits
=======

Images
------

* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.

Contributors
------------

* Lois Rilo <lois.rilo@eficent.com>
* Jordi Ballester <jordi.ballester@eficent.com>
* Bhavesh Odedra <bodedra@opensourceintegrators.com>

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

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

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.

To contribute to this module, please visit https://odoo-community.org.
3 changes: 3 additions & 0 deletions base_cron_exclusion/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import models
21 changes: 21 additions & 0 deletions base_cron_exclusion/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
"name": "Base Cron Exclusion",
"summary": "Allow you to select scheduled actions that should not run "
"simultaneously.",
"version": "12.0.1.0.0",
"author": "Eficent, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/server-tools",
"category": "Tools",
"depends": [
"base",
],
"data": [
"views/ir_cron_view.xml",
],
"license": "AGPL-3",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add image key

"installable": True,
}
32 changes: 32 additions & 0 deletions base_cron_exclusion/i18n/base_cron_exclusion.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_cron_exclusion
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.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: base_cron_exclusion
#: model:ir.model.fields,field_description:base_cron_exclusion.field_ir_cron_mutually_exclusive_cron_ids
#: model:ir.ui.view,arch_db:base_cron_exclusion.ir_cron_view
msgid "Mutually Exclusive Scheduled Actions"
msgstr ""

#. module: base_cron_exclusion
#: model:ir.model,name:base_cron_exclusion.model_ir_cron
msgid "Scheduled Actions"
msgstr ""

#. module: base_cron_exclusion
#: code:addons/base_cron_exclusion/models/ir_cron.py:21
#, python-format
msgid "You can not mutually exclude a scheduled actions with itself."
msgstr ""

37 changes: 37 additions & 0 deletions base_cron_exclusion/i18n/cs_CZ.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_cron_exclusion
#
# Translators:
# Lukáš Spurný <lukasspurny8@gmail.com>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-03 10:08+0000\n"
"PO-Revision-Date: 2018-03-03 10:08+0000\n"
"Last-Translator: Lukáš Spurný <lukasspurny8@gmail.com>, 2018\n"
"Language-Team: Czech (Czech Republic) (https://www.transifex.com/oca/"
"teams/23907/cs_CZ/)\n"
"Language: cs_CZ\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"

#. module: base_cron_exclusion
#: model:ir.model.fields,field_description:base_cron_exclusion.field_ir_cron_mutually_exclusive_cron_ids
#: model:ir.ui.view,arch_db:base_cron_exclusion.ir_cron_view
msgid "Mutually Exclusive Scheduled Actions"
msgstr "Vzájemně výlučné plánované akce"

#. module: base_cron_exclusion
#: model:ir.model,name:base_cron_exclusion.model_ir_cron
msgid "Scheduled Actions"
msgstr "Plánované akce"

#. module: base_cron_exclusion
#: code:addons/base_cron_exclusion/models/ir_cron.py:21
#, python-format
msgid "You can not mutually exclude a scheduled actions with itself."
msgstr "Nemůžete vzájemně vylučují naplánovaná akce se sebou samým."
36 changes: 36 additions & 0 deletions base_cron_exclusion/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_cron_exclusion
#
# Translators:
# enjolras <yo@miguelrevilla.com>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-03 10:08+0000\n"
"PO-Revision-Date: 2018-03-03 10:08+0000\n"
"Last-Translator: enjolras <yo@miguelrevilla.com>, 2018\n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\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"

#. module: base_cron_exclusion
#: model:ir.model.fields,field_description:base_cron_exclusion.field_ir_cron_mutually_exclusive_cron_ids
#: model:ir.ui.view,arch_db:base_cron_exclusion.ir_cron_view
msgid "Mutually Exclusive Scheduled Actions"
msgstr "Acciones programadas excluyentes mutuamente"

#. module: base_cron_exclusion
#: model:ir.model,name:base_cron_exclusion.model_ir_cron
msgid "Scheduled Actions"
msgstr "Acciones programadas"

#. module: base_cron_exclusion
#: code:addons/base_cron_exclusion/models/ir_cron.py:21
#, python-format
msgid "You can not mutually exclude a scheduled actions with itself."
msgstr "No puede excluir mutuamente una acción con ella misma."
37 changes: 37 additions & 0 deletions base_cron_exclusion/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_cron_exclusion
#
# Translators:
# Quentin THEURET <odoo@kerpeo.com>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-03 10:08+0000\n"
"PO-Revision-Date: 2018-03-03 10:08+0000\n"
"Last-Translator: Quentin THEURET <odoo@kerpeo.com>, 2018\n"
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\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"

#. module: base_cron_exclusion
#: model:ir.model.fields,field_description:base_cron_exclusion.field_ir_cron_mutually_exclusive_cron_ids
#: model:ir.ui.view,arch_db:base_cron_exclusion.ir_cron_view
msgid "Mutually Exclusive Scheduled Actions"
msgstr "Actions planifiées mutuellement exclusives"

#. module: base_cron_exclusion
#: model:ir.model,name:base_cron_exclusion.model_ir_cron
msgid "Scheduled Actions"
msgstr "Actions planifiées"

#. module: base_cron_exclusion
#: code:addons/base_cron_exclusion/models/ir_cron.py:21
#, python-format
msgid "You can not mutually exclude a scheduled actions with itself."
msgstr ""
"Vous ne pouvez pas exclure mutuellement une action planifiée avec elle-même."
3 changes: 3 additions & 0 deletions base_cron_exclusion/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import ir_cron
62 changes: 62 additions & 0 deletions base_cron_exclusion/models/ir_cron.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

import logging

from odoo import sql_db
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError

_logger = logging.getLogger(__name__)


class IrCron(models.Model):
_inherit = "ir.cron"

@api.constrains('mutually_exclusive_cron_ids')
def _check_auto_exclusion(self):
for item in self:
if item in item.mutually_exclusive_cron_ids:
raise ValidationError(_(
"You can not mutually exclude a scheduled actions with "
"itself."))

mutually_exclusive_cron_ids = fields.Many2many(
comodel_name="ir.cron", relation="ir_cron_exclusion",
column1="ir_cron1_id", column2="ir_cron2_id",
string="Mutually Exclusive Scheduled Actions")

@staticmethod
def _lock_mutually_exclusive_cron(db, job_id):
lock_cr = db.cursor()
lock_cr.execute("""
WITH Q1 AS (SELECT ir_cron2_id as cron_id FROM ir_cron_exclusion
WHERE ir_cron1_id=%s
UNION ALL
SELECT ir_cron1_id as cron_id FROM ir_cron_exclusion
WHERE ir_cron2_id=%s)
SELECT * FROM Q1
GROUP BY cron_id;""", (job_id, job_id))
locked_ids = tuple([row[0] for row in lock_cr.fetchall()])
if locked_ids:
lock_cr.execute("""SELECT *
FROM ir_cron
WHERE numbercall != 0
AND active
AND id IN %s
FOR UPDATE NOWAIT""",
(locked_ids,), log_exceptions=False)
lock_cr.fetchall()
return lock_cr

@classmethod
def _process_job(cls, job_cr, job, cron_cr):
db = sql_db.db_connect(cls.pool._db.dbname)
locked_crons = cls._lock_mutually_exclusive_cron(db, job['id'])
try:
res = super(IrCron, cls)._process_job(job_cr, job, cron_cr)
finally:
locked_crons.close()
_logger.debug("released blocks for cron job %s" % job['cron_name'])
return res
Binary file added base_cron_exclusion/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions base_cron_exclusion/views/ir_cron_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<!-- Copyright 2017 Eficent Business and IT Consulting Services S.L.
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) -->

<odoo>
<record id="ir_cron_view" model="ir.ui.view">
<field name="name">ir.cron.form - base_cron_exclusion</field>
<field name="model">ir.cron</field>
<field name="inherit_id" ref="base.ir_cron_view_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page name="exclusive_cron" groups="base.group_no_one"
string="Mutually Exclusive Scheduled Actions">
<field name="mutually_exclusive_cron_ids"/>
</page>
</notebook>
</field>
</record>
</odoo>