diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-04-08 16:46:31 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-04-08 16:46:31 +0200 |
| commit | 9a7e3c8b4986fcfecf3699a194e45f5ec94bde6c (patch) | |
| tree | f3eb55ac5763798c428071d4a6ae4ab2d72ec556 /odoo/addons/base/module/module.py | |
| parent | 8d95b6c172334593aa9042b45224b94461d2e88f (diff) | |
| parent | cd28e53a31d255b17835f613c0de12a93417f9d9 (diff) | |
[MERGE] forward port branch saas-15 up to cd28e53a31d
Diffstat (limited to 'odoo/addons/base/module/module.py')
| -rw-r--r-- | odoo/addons/base/module/module.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/odoo/addons/base/module/module.py b/odoo/addons/base/module/module.py index cad65d0114e..817ebca1967 100644 --- a/odoo/addons/base/module/module.py +++ b/odoo/addons/base/module/module.py @@ -21,6 +21,7 @@ from docutils.core import publish_string from docutils.transforms import Transform, writer_aux from docutils.writers.html4css1 import Writer import lxml.html +import psycopg2 import odoo from odoo import api, fields, models, modules, tools, _ @@ -536,6 +537,14 @@ class Module(models.Model): @api.multi def _button_immediate_function(self, function): + try: + # This is done because the installation/uninstallation/upgrade can modify a currently + # running cron job and prevent it from finishing, and since the ir_cron table is locked + # during execution, the lock won't be released until timeout. + self._cr.execute("SELECT * FROM ir_cron FOR UPDATE NOWAIT") + except psycopg2.OperationalError: + raise UserError(_("The server is busy right now, module operations are not possible at" + " this time, please try again later.")) function(self) self._cr.commit() |
