From 96b9d28351a0aaf66e326cfc7d5fddc47610d676 Mon Sep 17 00:00:00 2001 From: fwi-odoo Date: Tue, 22 Nov 2016 13:00:06 +0100 Subject: [PATCH] [FIX] mail: add filter to see messages where user is mentioned We add the filter during the instantiation of the search view by the "Discuss" client action because we can't access the partner_id in the xml filter definition. --- addons/mail/static/src/js/client_action.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/js/client_action.js b/addons/mail/static/src/js/client_action.js index fe9ad84ba39..4f11030b92a 100644 --- a/addons/mail/static/src/js/client_action.js +++ b/addons/mail/static/src/js/client_action.js @@ -17,6 +17,7 @@ var Model = require('web.Model'); var pyeval = require('web.pyeval'); var SearchView = require('web.SearchView'); +var session = require('web.session'); var Widget = require('web.Widget'); var QWeb = core.qweb; @@ -196,7 +197,17 @@ var ChatAction = Widget.extend(ControlPanelMixin, { 'channel_inbox'; var default_channel = chat_manager.get_channel(default_channel_id) || chat_manager.get_channel('channel_inbox'); - + var mention_filter = { + tag: 'filter', + children: [], + attrs:{ + name: 'mentions', + string: _t('Has Mentions'), + domain: "[('partner_ids', 'in', " + session.partner_id + ")]" + } + }; + this.fields_view = $.extend(true, {}, this.fields_view); + this.fields_view.arch.children.push(mention_filter); this.searchview = new SearchView(this, this.dataset, this.fields_view, options); this.searchview.on('search_data', this, this.on_search);