From da5d4ce66490ab8aa43e84ee819990df2361a052 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 8 Nov 2012 15:22:30 +0100 Subject: [PATCH] [IMP] mail: pipe to then in js bzr revid: chm@openerp.com-20121108142230-i1bk5hx2dx5x5tyh --- addons/mail/static/src/js/mail_followers.js | 18 +++++++++--------- .../mail/static/src/js/many2many_tags_email.js | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index a13d2048bf3..a5a97f48d26 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -85,7 +85,7 @@ openerp_mail_followers = function(session, mail) { read_value: function () { var self = this; - return this.ds_model.read_ids([this.view.datarecord.id], ['message_follower_ids']).pipe(function (results) { + return this.ds_model.read_ids([this.view.datarecord.id], ['message_follower_ids']).then(function (results) { self.set_value(results[0].message_follower_ids); }); }, @@ -98,9 +98,9 @@ openerp_mail_followers = function(session, mail) { fetch_followers: function (value_) { this.value = value_ || {}; return this.ds_follow.call('read', [this.value, ['name', 'user_ids']]) - .pipe(this.proxy('display_followers'), this.proxy('fetch_generic')) - .pipe(this.proxy('display_buttons')) - .pipe(this.proxy('fetch_subtypes')); + .then(this.proxy('display_followers'), this.proxy('fetch_generic')) + .then(this.proxy('display_buttons')) + .then(this.proxy('fetch_subtypes')); }, /** Read on res.partner failed: fall back on a generic case @@ -109,10 +109,10 @@ openerp_mail_followers = function(session, mail) { fetch_generic: function (error, event) { var self = this; event.preventDefault(); - return this.ds_users.call('read', [this.session.uid, ['partner_id']]).pipe(function (results) { + return this.ds_users.call('read', [this.session.uid, ['partner_id']]).then(function (results) { var pid = results['partner_id'][0]; self.message_is_follower = (_.indexOf(self.get('value'), pid) != -1); - }).pipe(self.proxy('display_generic')); + }).then(self.proxy('display_generic')); }, _format_followers: function(count){ // TDE note: why redefining _t ? @@ -179,7 +179,7 @@ openerp_mail_followers = function(session, mail) { 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]).pipe(this.proxy('display_subtypes')); + this.ds_model.call('message_get_subscription_data', [[this.view.datarecord.id], context]).then(this.proxy('display_subtypes')); }, /** Display subtypes: {'name': default, followed} */ @@ -206,7 +206,7 @@ openerp_mail_followers = function(session, mail) { $(record).attr('checked',false); }); var context = new session.web.CompoundContext(this.build_context(), {}); - return this.ds_model.call('message_unsubscribe_users', [[this.view.datarecord.id], [this.session.uid], context]).pipe(this.proxy('read_value')); + return this.ds_model.call('message_unsubscribe_users', [[this.view.datarecord.id], [this.session.uid], context]).then(this.proxy('read_value')); }, do_update_subscription: function (event) { @@ -221,7 +221,7 @@ openerp_mail_followers = function(session, mail) { var context = new session.web.CompoundContext(this.build_context(), {}); return this.ds_model.call('message_subscribe_users', [[this.view.datarecord.id], [this.session.uid], this.message_is_follower ? checklist:undefined, context]) - .pipe(this.proxy('read_value')); + .then(this.proxy('read_value')); }, }); }; diff --git a/addons/mail/static/src/js/many2many_tags_email.js b/addons/mail/static/src/js/many2many_tags_email.js index 52dcbf7aeb5..cc701e8a585 100644 --- a/addons/mail/static/src/js/many2many_tags_email.js +++ b/addons/mail/static/src/js/many2many_tags_email.js @@ -46,7 +46,7 @@ instance.web.form.FieldMany2ManyTagsEmail = instance.web.form.FieldMany2ManyTags ["email", "=", false], ["notification_email_send", "in", ['all', 'comment']] ]], {context: this.build_context()}) - .pipe(function (record_ids) { + .then(function (record_ids) { // valid partner var valid_partner = _.difference(ids, record_ids); self.values = self.values.concat(valid_partner);