Commit 00c5c086 authored by niv-openerp's avatar niv-openerp

[fix] reverted auto_context feature due to problems in some rare cases

parent 33a3eeea
......@@ -140,8 +140,7 @@ class Connection(object):
Initialize with login information. The login information is facultative to allow specifying
it after the initialization of this object.
......@@ -152,15 +151,11 @@ class Connection(object):
:param password: The password of the user.
:param user_id: The user id is a number identifying the user. This is only useful if you
already know it, in most cases you don't need to specify it.
:param auto_context: If true, automatically queries the context of the user and adds it to all
method calls on models. If a context is already specified, the contexts are merged with it (the
user context has the lowest priority). Default to True.
self.connector = connector
self.set_login_info(database, login, password, user_id)
self.user_context = None
self.auto_context = auto_context
def set_login_info(self, database, login, password, user_id=None):
......@@ -202,9 +197,7 @@ class Connection(object):
Query the default context of the user.
if not self.user_context:
mod = self.get_model('res.users')
mod.override_auto_context = False
self.user_context = mod.context_get()
self.user_context = self.get_model('res.users').context_get()
return self.user_context
def get_model(self, model_name):
......@@ -244,7 +237,6 @@ class Model(object):
self.connection = connection
self.model_name = model_name
self.override_auto_context = None
self.__logger = _getChildLogger(_getChildLogger(_logger, 'object'), model_name or "")
def __getattr__(self, method):
......@@ -259,10 +251,6 @@ class Model(object):
if (self.override_auto_context is not None and self.override_auto_context) or \
(self.override_auto_context is None and self.connection.auto_context):
kw = dict(kw)
kw['context'] = dict(self.connection.get_user_context(), **kw.get('context', {}))
result = self.connection.get_service('object').execute_kw(
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment