diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index 6b007e2f097..18e415a5f0a 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -101,7 +101,7 @@ openerp.account = function (instance) { return self.rpc("/web/action/load", { action_id: result[1], context: additional_context - }, function (result) { + }).then(function (result) { result = result.result; result.context = _.extend(result.context || {}, additional_context); result.flags = result.flags || {}; diff --git a/addons/auth_openid/static/src/js/auth_openid.js b/addons/auth_openid/static/src/js/auth_openid.js index 70739e056ed..56ec5b57d3f 100644 --- a/addons/auth_openid/static/src/js/auth_openid.js +++ b/addons/auth_openid/static/src/js/auth_openid.js @@ -69,7 +69,7 @@ instance.web.Login = instance.web.Login.extend({ _check_error: function() { var self = this; if (this.params.loginerror !== undefined) { - this.rpc('/auth_openid/login/status', {}, function(result) { + this.rpc('/auth_openid/login/status', {}).then(function(result) { if (_.contains(['success', 'failure'], result.status) && result.message) { self.do_warn('Invalid OpenID Login', result.message); } @@ -106,7 +106,7 @@ instance.web.Login = instance.web.Login.extend({ do_openid_login: function(db, openid_url) { var self = this; - this.rpc('/auth_openid/login/verify', {'db': db, 'url': openid_url}, function(result) { + this.rpc('/auth_openid/login/verify', {'db': db, 'url': openid_url}).then(function(result) { if (result.error) { self.do_warn(result.title, result.error); return; diff --git a/addons/board/static/src/js/dashboard.js b/addons/board/static/src/js/dashboard.js index 2dbd9f5c9cc..30802fc2bd7 100644 --- a/addons/board/static/src/js/dashboard.js +++ b/addons/board/static/src/js/dashboard.js @@ -46,7 +46,7 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({ delete(action.attrs.colspan); var action_id = _.str.toNumber(action.attrs.name); if (!_.isNaN(action_id)) { - self.rpc('/web/action/load', {action_id: action_id}, function(result) { + self.rpc('/web/action/load', {action_id: action_id}).then(function(result) { self.on_load_action(result, column_index + '_' + action_index, action.attrs); }); } @@ -81,7 +81,7 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({ this.rpc('/web/view/undo_custom', { view_id: this.view.fields_view.view_id, reset: true - }, this.do_reload); + }).then(this.do_reload); }, on_change_layout: function() { var self = this; @@ -382,7 +382,7 @@ instance.board.AddToDashboard = instance.web.search.Input.extend({ domain: domain, view_mode: view_parent.active_view, name: this.$el.find("input").val() - }, function(r) { + }).then(function(r) { if (r === false) { self.do_warn("Could not add filter to dashboard"); } else { diff --git a/addons/edi/static/src/js/edi.js b/addons/edi/static/src/js/edi.js index abb6d9a6232..e82871cdd43 100644 --- a/addons/edi/static/src/js/edi.js +++ b/addons/edi/static/src/js/edi.js @@ -15,7 +15,7 @@ openerp.edi.EdiView = openerp.web.Widget.extend({ this._super(); var self = this; var param = {"db": self.db, "token": self.token}; - return self.rpc('/edi/get_edi_document', param, this.on_document_loaded, this.on_document_failed); + return self.rpc('/edi/get_edi_document', param).then(this.on_document_loaded, this.on_document_failed); }, on_document_loaded: function(docs){ this.doc = docs[0]; @@ -149,11 +149,11 @@ openerp.edi.EdiImport = openerp.web.Widget.extend({ }, do_import: function() { - this.rpc('/edi/import_edi_url', {url: this.url}, this.on_imported, this.on_imported_error); + this.rpc('/edi/import_edi_url', {url: this.url}).then(this.on_imported, this.on_imported_error); }, on_imported: function(response) { if ('action' in response) { - this.rpc("/web/session/save_session_action", {the_action: response.action}, function(key) { + this.rpc("/web/session/save_session_action", {the_action: response.action}).then(function(key) { window.location = "/#sa="+encodeURIComponent(key); }); } diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index c2c0ded407b..0e5583fa953 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -16,7 +16,7 @@ var QWeb = instance.web.qweb, var form = self.getParent(); form.sidebar_context().then(function (context) { var ds = new instance.web.DataSet(this, 'ir.attachment', context); - def = ds.call('google_doc_get', [form.dataset.model, [form.datarecord.id], context], function(r) { + ds.call('google_doc_get', [form.dataset.model, [form.datarecord.id], context]).then(function(r) { if (r == 'False') { var params = { error: response, @@ -27,11 +27,9 @@ var QWeb = instance.web.qweb, modal: true, }); } - - }).done(function(){ - form.reload(); - }); - }) + form.reload(); + }); + }); } - }) -} + }); +}; diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 15a81be4c54..00142d1a0ea 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -1267,7 +1267,7 @@ openerp.mail = function(session) { domains: domains || [], contexts: contexts || [], group_by_seq: groupbys || [] - }, function (results) { + }).then(function (results) { self.search_results['context'] = results.context; self.search_results['domain'] = results.domain; self.thread.destroy(); diff --git a/addons/point_of_sale/static/src/js/devices.js b/addons/point_of_sale/static/src/js/devices.js index 142d35bd340..c96aff3d9c1 100644 --- a/addons/point_of_sale/static/src/js/devices.js +++ b/addons/point_of_sale/static/src/js/devices.js @@ -37,8 +37,7 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal callbacks[i](params); } - this.connection.rpc('/pos/'+name, params || {}, - function(result){ + this.connection.rpc('/pos/'+name, params || {}).then(function(result){ ret.resolve(result); }, function(error){ diff --git a/addons/process/static/src/js/process.js b/addons/process/static/src/js/process.js index 386a9653c02..c214dbb0fdf 100644 --- a/addons/process/static/src/js/process.js +++ b/addons/process/static/src/js/process.js @@ -216,13 +216,12 @@ instance.web.ViewManager.include({ var dataset = new instance.web.DataSet(this, 'ir.values', this.session.user_context); var action_manager = new instance.web.ActionManager(self); dataset.call('get', - ['action', 'tree_but_open',[['ir.ui.menu', id]], dataset.context], - function(res) { + ['action', 'tree_but_open',[['ir.ui.menu', id]], dataset.context]).then(function(res) { var action = res[0][res[0].length - 1]; self.rpc("/web/action/load", { action_id: action.id, context: dataset.context - }, function(result) { + }).then(function(result) { action_manager.replace(self.$el); action_manager.do_action(result.result); }) diff --git a/addons/share/static/src/js/share.js b/addons/share/static/src/js/share.js index bab3cac243f..e73e68144d0 100644 --- a/addons/share/static/src/js/share.js +++ b/addons/share/static/src/js/share.js @@ -15,7 +15,7 @@ openerp.share = function(session) { self.rpc('/web/session/eval_domain_and_context', { domains: [domain], contexts: [view.dataset.context] - }, function (result) { + }).then(function (result) { Share.create({ name: action.name, record_name: rec_name, @@ -24,9 +24,8 @@ openerp.share = function(session) { user_type: user_type || 'embedded', view_type: view.fields_view.type, invite: invite || false, - }, function(result) { - var share_id = result.result; - var step1 = Share.call('go_step_1', [[share_id],], function(result) { + }).then(function(share_id) { + var step1 = Share.call('go_step_1', [[share_id]]).then(function(result) { var action = result; self.do_action(action); }); diff --git a/addons/web_shortcuts/static/src/js/web_shortcuts.js b/addons/web_shortcuts/static/src/js/web_shortcuts.js index c6d5a2f41fb..fe955379c21 100644 --- a/addons/web_shortcuts/static/src/js/web_shortcuts.js +++ b/addons/web_shortcuts/static/src/js/web_shortcuts.js @@ -46,7 +46,7 @@ instance.web_shortcuts.Shortcuts = instance.web.Widget.extend({ load: function() { var self = this; this.$el.find('.oe_systray_shortcuts_items').empty(); - return this.rpc('/web/shortcuts/list', {}, function(shortcuts) { + return this.rpc('/web/shortcuts/list', {}).then(function(shortcuts) { _.each(shortcuts, function(sc) { self.trigger('display', sc); }); @@ -80,7 +80,7 @@ instance.web_shortcuts.Shortcuts = instance.web.Widget.extend({ id = $link.data('id'); self.session.active_id = id; // TODO: Use do_action({menu_id: id, type: 'ir.actions.menu'}) - self.rpc('/web/menu/action', {'menu_id': id}, function(ir_menu_data) { + self.rpc('/web/menu/action', {'menu_id': id}).then(function(ir_menu_data) { if (ir_menu_data.action.length){ instance.webclient.user_menu.on_action({action_id: ir_menu_data.action[0][2].id}); }