Set the context's user when fetching user preferences

The call to _get_preferences makes some processing based on the user of the
context.

In order for those computations to return the right value the context must be
set when instanciating the user.

issue3068
review1711002
This commit is contained in:
Nicolas Évrard
2013-12-10 12:01:30 +01:00
parent 90324479f2
commit e8bdcd5550
+1 -1
View File
@@ -337,7 +337,7 @@ class User(ModelSQL, ModelView):
if preferences is not None:
return preferences.copy()
user = Transaction().user
with Transaction().set_user(0):
with Transaction().set_user(0, set_context=True):
user = cls(user)
preferences = cls._get_preferences(user, context_only=context_only)
cls._get_preferences_cache.set(key, preferences)