[FIX] mail_followers: display_subtypes

bzr revid: chm@openerp.com-20130215111926-tpnwii4a3of1gkb7
This commit is contained in:
Christophe Matthieu 2013-02-15 12:19:26 +01:00
parent 2ffa8c7979
commit 093f3a12f2
1 changed files with 7 additions and 5 deletions

View File

@ -206,21 +206,23 @@ openerp_mail_followers = function(session, mail) {
/** Fetch subtypes, only if current user is follower */
fetch_subtypes: function () {
var self = this;
var subtype_list_ul = this.$('.oe_subtype_list').empty();
if (! this.message_is_follower) return;
var context = new session.web.CompoundContext(this.build_context(), {});
this.ds_model.call('message_get_subscription_data', [[this.view.datarecord.id], context]).then(this.proxy('display_subtypes'));
var id = this.view.datarecord.id;
this.ds_model.call('message_get_subscription_data', [[id], new session.web.CompoundContext(this.build_context(), {})])
.then(function (data) {self.display_subtypes(data, id);});
},
/** Display subtypes: {'name': default, followed} */
display_subtypes:function (data) {
display_subtypes:function (data, id) {
var self = this;
var subtype_list_ul = this.$('.oe_subtype_list');
var records = [];
var nb_subtype = 0;
subtype_list_ul.empty();
if (this.view.datarecord.id) {
records = data[this.view.datarecord.id].message_subtype_data;
if (data[id]) {
records = data[id].message_subtype_data;
}
_(records).each(function (record) {nb_subtype++;});
if (nb_subtype > 1) {