[MERGE] forward port branch 10.0 up to 6431e366a8
This commit is contained in:
@@ -39,7 +39,7 @@ class ServerAction(models.Model):
|
||||
def _get_website_url(self):
|
||||
for action in self:
|
||||
if action.state == 'code' and action.website_published:
|
||||
action.website_url = self._compute_website_url(action.website_path, action.xml_id)
|
||||
action.website_url = action._compute_website_url(action.website_path, action.xml_id)
|
||||
|
||||
@api.model
|
||||
def _get_eval_context(self, action):
|
||||
|
||||
@@ -16,6 +16,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
|
||||
|
||||
try:
|
||||
from cStringIO import StringIO
|
||||
@@ -479,6 +480,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()
|
||||
|
||||
+5
-1
@@ -2500,7 +2500,11 @@ class BaseModel(object):
|
||||
cr.execute("SELECT indexname FROM pg_indexes WHERE indexname = %s and tablename = %s", (indexname, self._table))
|
||||
res2 = cr.dictfetchall()
|
||||
if not res2 and field.index:
|
||||
cr.execute('CREATE INDEX "%s_%s_index" ON "%s" ("%s")' % (self._table, name, self._table, name))
|
||||
try: # DO NOT FORWARD-PORT TO SAAS-15 AND UP (stop at saas-14)
|
||||
with cr.savepoint():
|
||||
cr.execute('CREATE INDEX "%s_%s_index" ON "%s" ("%s")' % (self._table, name, self._table, name))
|
||||
except psycopg2.OperationalError as e:
|
||||
_schema.error('Unable to add index for %s (%s):\n %s', self._table, name, e.message)
|
||||
cr.commit()
|
||||
if field.type == 'text':
|
||||
# FIXME: for fields.text columns we should try creating GIN indexes instead (seems most suitable for an ERP context)
|
||||
|
||||
Reference in New Issue
Block a user