[ADD] Added follow/unfollow action on buttons in ThreadView
bzr revid: tde@openerp.com-20120206124631-igyes2l7dbadtbaf
This commit is contained in:
parent
a61be0bf53
commit
9a8782ba05
|
@ -102,13 +102,6 @@
|
|||
<field name="public" nolabel="1" colspan="1"/>
|
||||
<label string="This group is visible by non members" colspan="2"/>
|
||||
</group>
|
||||
<separator string="Actions" colspan="4"/>
|
||||
<group colspan="2" col="2">
|
||||
<button name="action_follow" type="object" context="{}"
|
||||
string="Follow" icon="gtk-go-forward" colspan="2"/>
|
||||
<button name="action_unfollow" type="object" context="{}"
|
||||
string="Unfollow" icon="gtk-go-forward" colspan="2"/>
|
||||
</group>
|
||||
<separator string="OpenChatter" colspan="4"/>
|
||||
<field name="message_ids_social" colspan="4" widget="ThreadView" nolabel="1"/>
|
||||
</form>
|
||||
|
|
|
@ -14,6 +14,7 @@ openerp.mail = function(session) {
|
|||
// this.timeout;
|
||||
this._super.apply(this, arguments);
|
||||
this.ds = new session.web.DataSet(this, this.view.model);
|
||||
this.ds_sub = new session.web.DataSet(this, 'mail.subscription');
|
||||
},
|
||||
|
||||
start: function() {
|
||||
|
@ -54,13 +55,16 @@ openerp.mail = function(session) {
|
|||
},
|
||||
|
||||
do_follow: function () {
|
||||
var self = this;
|
||||
console.log('Follow');
|
||||
console.log(this);
|
||||
this.ds_sub.create({'res_model': this.view.model, 'user_id': this.session.uid, 'res_id': this.view.datarecord.id}).then(
|
||||
console.log('Subscription done'));
|
||||
},
|
||||
|
||||
do_unfollow: function () {
|
||||
var self = this;
|
||||
console.log('Unfollow');
|
||||
return this.ds.call('message_unsubscribe', [[this.view.datarecord.id]]).then(
|
||||
console.log('Unfollowing'));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue