[FIX] web: current transaction is aborted
This reverts commitbd9cbdfc41
. The above revision solved the SQL constraints not being translated when raised. They were not translated because the context, containing the lang, was not located as expected in the `kwargs` dict. While it solved this issue, it had as side-effect to raise `current transaction is aborted, commands ignored until end of transaction block` errors more often when using the web client. This can be explained by the double check, when the first check raised this error - which can happen, e.g. when the cursor is closed, there is a retry mechanism in such cases - and by the fact the transaction was not rollbacked. This issue could have been solved as well by rollbacking the transaction, but it is regarded as not-so-clean. Therefore, to solve this issue, while still having the SQL constraints translated, we apply the second patch proposed inbd9cbdfc41
commit message, which is not-so-clean as well, but which is a proper solution. opw-651393
This commit is contained in:
parent
38c9deeab4
commit
8209368b02
|
@ -33,7 +33,6 @@ import openerp
|
|||
import openerp.modules.registry
|
||||
from openerp.addons.base.ir.ir_qweb import AssetsBundle, QWebTemplateNotFound
|
||||
from openerp.modules import get_module_resource
|
||||
from openerp.service import model as service_model
|
||||
from openerp.tools import topological_sort
|
||||
from openerp.tools.translate import _
|
||||
from openerp.tools import ustr
|
||||
|
@ -934,10 +933,7 @@ class DataSet(http.Controller):
|
|||
if method.startswith('_'):
|
||||
raise Exception("Access Denied: Underscore prefixed methods cannot be remotely called")
|
||||
|
||||
@service_model.check
|
||||
def checked_call(__dbname, *args, **kwargs):
|
||||
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
|
||||
return checked_call(request.db, *args, **kwargs)
|
||||
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
|
||||
|
||||
@http.route('/web/dataset/call', type='json', auth="user")
|
||||
def call(self, model, method, args, domain_id=None, context_id=None):
|
||||
|
|
|
@ -54,7 +54,12 @@ def check(f):
|
|||
if args and isinstance(args[-1], dict):
|
||||
ctx = args[-1]
|
||||
elif isinstance(kwargs, dict):
|
||||
ctx = kwargs.get('context', {})
|
||||
if 'context' in kwargs:
|
||||
ctx = kwargs['context']
|
||||
elif 'kwargs' in kwargs:
|
||||
# http entry points such as call_kw()
|
||||
ctx = kwargs['kwargs'].get('context')
|
||||
|
||||
|
||||
uid = 1
|
||||
if args and isinstance(args[0], (long, int)):
|
||||
|
|
Loading…
Reference in New Issue