From b83f5a8ef965f8f50bf516c3e62f8c787fe829dd Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 26 Mar 2015 12:59:08 +0100 Subject: [PATCH] [FIX] ir_filters: filters not in the language of the user the context must be passed to the get_filters function to take into account the language of the user. opw:630057 --- addons/web/static/src/js/search.js | 3 ++- openerp/addons/base/ir/ir_filters.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 33bc40b3f6f..6d96ba03481 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -1624,7 +1624,8 @@ instance.web.search.FavoriteMenu = instance.web.Widget.extend({ this.prepare_dropdown_menu([]); return $.when(); } - return this.model.call('get_filters', [this.target_model, this.action_id]) + return this.model.call('get_filters', [this.target_model, this.action_id], + {context: this.searchview.dataset.context}) .done(this.proxy('prepare_dropdown_menu')); }, prepare_dropdown_menu: function (filters) { diff --git a/openerp/addons/base/ir/ir_filters.py b/openerp/addons/base/ir/ir_filters.py index 3b48d723f21..137c48884b4 100644 --- a/openerp/addons/base/ir/ir_filters.py +++ b/openerp/addons/base/ir/ir_filters.py @@ -45,7 +45,7 @@ class ir_filters(osv.osv): # only global ones return [('action_id', '=', False)] - def get_filters(self, cr, uid, model, action_id=None): + def get_filters(self, cr, uid, model, action_id=None, context=None): """Obtain the list of filters available for the user on the given model. :param action_id: optional ID of action to restrict filters to this action @@ -62,7 +62,7 @@ class ir_filters(osv.osv): filter_ids = self.search(cr, uid, action_domain + [('model_id','=',model),('user_id','in',[uid, False])]) my_filters = self.read(cr, uid, filter_ids, - ['name', 'is_default', 'domain', 'context', 'user_id']) + ['name', 'is_default', 'domain', 'context', 'user_id'], context=context) return my_filters def _check_global_default(self, cr, uid, vals, matching_filters, context=None):