[FIX] base: call context_get with the right user

self.env.user returns the current user but browsed with the superuser:
- self.env.user == current user
- self.env.user.env.user == administrator

get_context uses self.env.user to retrieve the context of the user.
Before this patch, the name of the filters was translated in the
language of the administrator instead of the current user.

Closes odoo/odoo#40086

closes odoo/odoo#40170

X-original-commit: b39c8da2a49e43cc1bd7c837bf0e99ad437992ff
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
This commit is contained in:
fw-bot
2019-11-13 09:35:16 +00:00
parent 062735847c
commit 8d792001c6
+1 -1
View File
@@ -71,7 +71,7 @@ class IrFilters(models.Model):
# and filters for the action (action_id=action_id) or global (action_id=NULL)
action_domain = self._get_action_domain(action_id)
filters = self.search(action_domain + [('model_id', '=', model), ('user_id', 'in', [self._uid, False])])
user_context = self.env.user.context_get()
user_context = self.env['res.users'].context_get()
return filters.with_context(user_context).read(['name', 'is_default', 'domain', 'context', 'user_id', 'sort'])
@api.model