[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.
This commit is contained in:
fwi-odoo
2016-11-23 16:08:16 +01:00
parent b9c79b0a97
commit 96b9d28351
+12 -1
View File
@@ -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);