diff options
| author | Aaron Bohy <aab@odoo.com> | 2018-01-05 13:57:46 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2018-01-05 14:39:34 +0100 |
| commit | 35c829f12b28615351cb306397b1a3dfbfdeaccb (patch) | |
| tree | 4a64d297b19c1495fd840bb56214e7346a92a604 | |
| parent | 7a31bc60fb67a7322d6f105270cf809f5fc46e5d (diff) | |
[FIX] mail: Discuss: apply default filters
Before this rev., the default filters were ignored in Discuss. The
SearchView was instantiated and correctly retrieved the default
filters. However, a first manual 'do_search' needs to be done by
the client action for the search view to provide the domain, and
for Discuss to correctly filter the messages.
Steps to reproduce the issue:
- In Discuss (e.g. in Inbox), add to Favorites a given search,
and tick 'Use by default'
- Leave Discuss, and then go back: the default filter correctly
appears in the search view, but the messages aren't filtered.
| -rw-r--r-- | addons/mail/static/src/js/client_action.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/addons/mail/static/src/js/client_action.js b/addons/mail/static/src/js/client_action.js index ca34192488f..5ef150e6d1d 100644 --- a/addons/mail/static/src/js/client_action.js +++ b/addons/mail/static/src/js/client_action.js @@ -231,6 +231,9 @@ var ChatAction = Widget.extend(ControlPanelMixin, { var def3 = this.extended_composer.appendTo(this.$('.o_mail_chat_content')); var def4 = this.searchview.appendTo($("<div>")).then(function () { self.$searchview_buttons = self.searchview.$buttons.contents(); + // manually call do_search to generate the initial domain and filter + // the messages in the default channel + self.searchview.do_search(); }); this.render_sidebar(); @@ -547,7 +550,12 @@ var ChatAction = Widget.extend(ControlPanelMixin, { }); this.domain = result.domain; - this.fetch_and_render_thread(); + if (this.channel) { + // initially (when do_search is called manually), there is no + // channel set yet, so don't try to fetch and render the thread as + // this will be done as soon as the default channel is set + this.fetch_and_render_thread(); + } }, on_post_message: function (message) { |
