[IMP] mail_follower: unfollow when no subtypes following

bzr revid: chm@openerp.com-20120924101108-iyhv21w0zkvzb4jb
This commit is contained in:
Christophe Matthieu
2012-09-24 12:11:08 +02:00
parent 278faf5f30
commit ac7adf29d2
+5 -3
View File
@@ -85,7 +85,6 @@ openerp_mail_followers = function(session, mail) {
},
set_value: function(value_) {
console.log("set_value", value_);
this.reinit();
return this.fetch_followers(value_ || this.get_value());
},
@@ -209,8 +208,11 @@ openerp_mail_followers = function(session, mail) {
if($(record).is(':checked')) {
checklist.push(parseInt($(record).data('id')))}
});
return this.ds_model.call('message_subscribe_users',[[self.view.datarecord.id], undefined, checklist, context]).pipe(this.proxy('read_value'));
if(!checklist.length)
return this.do_unfollow();
else
return this.ds_model.call('message_subscribe_users',[[self.view.datarecord.id], undefined, checklist, context]).pipe(this.proxy('read_value'));
},
});