-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
12.0 mig base cron exclusion #1393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
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 f8a41a7
[FIX] Module 'auditlog' - Fix some flake8 errors
sebalix 87bf703
[FIX] Module 'auditlog' - Put the module description in a README.rst …
sebalix 610846f
[ADD] Module 'auditlog' - 'auditlog.pot' file added
sebalix df303bf
[IMP] Module 'auditlog' - Split the 'create_logs()' method in several…
sebalix 65c63e5
[IMP] Module 'auditlog' - Clean up vim lines
sebalix 3f48b6d
[IMP] Module 'auditlog' - Add 'name' attributes on some filters and o…
sebalix 711b616
[IMP] Module 'auditlog' - Removed the 'timestamp' field from the 'aud…
sebalix 29df5a4
[IMP] Module 'auditlog' - README.rst updated (based on the OCA template)
sebalix 6e9785d
[FIX] Module 'auditlog' - 'time' module imported but unused
sebalix ff0b7d7
[IMP] ignore rules for nonexisting objects
hbrunn d73d1c5
[ADD] init hook to migrate from audittrail
hbrunn 7b7019c
[FIX] also migrate id sequences
hbrunn e30c204
[IMP] Module 'auditlog' - Contributors updated in README.rst + AUTHOR…
sebalix 6273d82
[ADD] change xmlids of legacy rules to point to auditlog.rule
hbrunn f1e4dcb
[IMP] use new import of _, SUPERUSER_ID
hbrunn 8824b42
[ADD] allow overriding modules to pass additional log values
hbrunn f57bc32
[IMP] cache model and field ids
hbrunn 34176be
[IMP] don't make a temporary copy of dict keys
hbrunn 9d23a0b
[FIX] don't reset caches in register_hook
hbrunn 81f3c9e
[ADD] pass old_values to create_log when deleting a record
hbrunn e2c4921
[FIX] cope with no additional log values
hbrunn ce62cab
[ADD] tests
hbrunn 23b6cae
[FIX] Module 'auditlog' - local variable 'ir_model' is assigned to bu…
sebalix 7c5cd9a
[IMP] use a model for test that is not influenced by the mail module
hbrunn b4bb515
[FIX] Module 'auditlog' - Remove 'active' field from __openerp__.py
sebalix 223b8e3
[IMP] Module 'auditlog' - README.rst updated (inform that the audittr…
sebalix 123f03e
[IMP] Module 'auditlog' - Useless lines of code removed
sebalix d739093
[IMP] Module 'auditlog' - Autoremove 'auditlog.log.line' records when…
sebalix 1647289
[IMP] Module 'auditlog' - Model 'auditlog.log.line', 'field_name' and…
sebalix 0fc90cb
[IMP] Module 'auditlog' - Added a second test using cached data gener…
sebalix d0428b2
[FIX] Module 'auditlog' - Data dictionaries of fields and models are …
sebalix 49bdeb0
[IMP] Module 'auditlog' - Add a test regarding a resource deleted thr…
sebalix e5d4435
[FIX] Module 'auditlog' - When updating a resource, filter IDs on 2ma…
sebalix fdafcff
[ADD] migration script
hbrunn 0ad5f76
Add OCA as author of OCA addons
gurneyalex 58bd2b3
[IMP] Module 'auditlog' - Performing logs on 'read' operations + Some…
sebalix 05f15b2
[FIX] Module 'auditlog' - Replace 'try/except statement by 'isinstanc…
sebalix bf720b7
[FIX] Module 'auditlog' - Support 'read' calls with one ID or a list …
sebalix 4deb116
[FIX] Module 'auditlog' - Unit tests, do not create users with the 'n…
sebalix c9b5e6f
[ADD] German translation for auditlog
eqms 6055405
[FIX] Module 'auditlog' - No log for internal processing (e.g. 'read'…
sebalix 4ee78da
[FIX] Module 'auditlog' - Fix lint check
sebalix 2a914db
[IMP] Module 'auditlog' - Unsubscribe rules before removing them + Un…
sebalix a806573
[FIX] Module 'auditlog' - Log fields coming from polymorphic inherita…
sebalix 79c6c56
[IMP] Module 'auditlog' - Remove the unit test causing trouble with T…
sebalix 454fde9
[ADD] auditlog: Added Spanish translation.
5fc1289
Add bug tracker link on README.rst
yvaucher b7acd5f
[FIX] ie related fields don't have an
hbrunn 6a9d008
[ADD] comment
hbrunn ff1f54c
[FIX] make patched create downgrade correctly to v6.1
hbrunn 3fe8f72
Add missing default oca icons
yvaucher 3021e78
[FIX] if someone else has overridden our patched,
hbrunn e2d753c
OCA Transbot updated translations from Transifex
oca-transbot 1b087a8
[UPD] prefix versions with 8.0
sbidoul 5259719
[MIG] Make modules uninstallable
pedrobaeza c7651eb
[FIX] remove en.po that was erroneously created by transbot
sbidoul 71072e6
[MIG] Rename manifest files
pedrobaeza 638daa5
Module 'auditlog' - Log HTTP user sessions and requests
sebalix 1a68382
Module 'auditlog' - Bump the version to 1.1.0
sebalix e80ec4d
Module 'auditlog' - Cleanup XML views (types removed)
sebalix d659f00
Module 'auditlog' - A log can be created with no current HTTP request…
sebalix c10d773
Module 'auditlog' - 'display_name' fields added for the user session …
sebalix 246c65f
Module 'auditlog' - Fix pylint check
sebalix d52535c
turn off prefetching when reding values
hbrunn a30c7a0
auditlog - Ability to choose the log type on the rule: Full log (comp…
sebalix 8b45f67
auditlog - Field 'type' renamed to 'log_type'
sebalix 4f65998
auditlog - Bump version number
sebalix ab26789
auditlog - Auto-vacuum logs, HTTP requests and HTTP user sessions
sebalix f871405
auditlog - Icon added + README updated (screenshots)
sebalix a9bbf8e
singleton error if we saved the current session two times (#473)
hbrunn 50885fc
Migrate auditlog module from 8.0 to 9.0
holdenrehg 558e8db
Updated the __openerp__.xml to include the license and images fields
holdenrehg 5b92543
auditlog module, Remove duplicate license key from openerp config
holdenrehg 9fdbbca
auditlog: Remove migration from audittrail functionality, this is not…
holdenrehg cac09b2
auditlog: Remove pre_init_hook reference from openerp, no pre_init ho…
holdenrehg 03a12f3
auditlog - Lint
sebalix 64b13c3
auditlog - Migrate 'AuditlogRule.create' and 'AuditlogRule.write' met…
sebalix e727939
[MIG] auditlog: Migrated to 10.0
8441c12
[FIX] Request id no longer exists after concurrency rollback
StefanRijnhart b0f8f5e
[FIX] auditlog: Duplicate logging
obulkin 86f018a
OCA Transbot updated translations from Transifex
oca-transbot 2c1e571
[MIG] auditlog: Migration to 11.0
etobella ca3c57b
[add] https
rgarnau 1f6d5a7
OCA Transbot updated translations from Transifex
oca-transbot ef54450
OCA Transbot updated translations from Transifex
oca-transbot 9654168
OCA Transbot updated translations from Transifex
oca-transbot bb3be02
OCA Transbot updated translations from Transifex
oca-transbot e82ded7
remove obsolete .pot files [ci skip]
sbidoul 33fe065
[UPD] Update auditlog.pot
oca-travis 30a21bc
Translated using Weblate (Português (Brasil))
ef76806
Translated using Weblate (Danish)
hhgabelgaard b2acd2e
Translated using Weblate (Portuguese (Brazil))
ed3bda9
Translated using Weblate (Spanish)
etobella 063d01e
[ADD] split module sale_exception into base_exception
mourad-ehm 51ca697
OCA Transbot updated translations from Transifex
oca-transbot d8825c7
Fix menu in base_exception (#803)
eugen-don d4a4a4d
[FIX] base_exception: '_check_exception' is 'api.multi' since it's ca…
lmignon 900a431
OCA Transbot updated translations from Transifex
oca-transbot aeda972
[MIG] base_exception: Migration to 11.0
mourad-ehm 3d948cd
style fixes
JordiBForgeFlow a37f1d3
[FIX] temp model test access rule & fix OCA remarks
mourad-ehm 38193fd
OCA Transbot updated translations from Transifex
oca-transbot 3ec02ec
OCA Transbot updated translations from Transifex
oca-transbot 038e86e
Refactor tests of module 'base_exception'.
JordiBForgeFlow 59a05c2
OCA Transbot updated translations from Transifex
oca-transbot 321262d
[FIX] Enable post_install for tests + pylint
astirpe 9c66905
OCA Transbot updated translations from Transifex
oca-transbot 3a7f7e1
remove obsolete .pot files [ci skip]
sbidoul 22f3c1d
[UPD] Update base_exception.pot
oca-travis f4d8388
Translated using Weblate (Arabic)
osoul f884235
Translated using Weblate (Persian)
fshahy 09a37e7
Translated using Weblate (Portuguese (Brazil))
cfd5922
[10.0] add new module to manage technical user on company
9e0bfdc
OCA Transbot updated translations from Transifex
oca-transbot 30489ed
[MIG] base_technical_user to V11
hugosantosred 0a1904d
[UPD] Update base_technical_user.pot
oca-travis 0a93ec9
Added translation using Weblate (Arabic)
osoul b02416d
Global pylint cleanup
simahawk 391b176
12.0 Migration base_cron_exclusion
8f6b89c
[MIG] base_exception: Migration to 12.0
digitalsatori 87094ee
update version to 12
b69a6e7
[MIG] base_technical_user: Migration to 12.0
9ff5701
Merge pull request #4 from 719923505/12.0-mig-base_tecnical_user
GoodERPJeff 0c1232e
Merge pull request #3 from digitalsatori/12.0-mig-base-exception
GoodERPJeff 1a26258
Merge pull request #2 from daimengmeng/12.0
GoodERPJeff adce27f
Merge pull request #1 from tanghulu0608/12.0-mig-auditlog
GoodERPJeff c97e552
mig pr for base_cron_exclusion
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| :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. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add image key |
||
| "installable": True, | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 "" | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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