From 86a87aa8b0dde2237cfe1bb769724e8ed269b62e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Tue, 7 Mar 2017 16:14:05 +0100 Subject: [REF] *: use _rpc method for all rpcs The _rpc method is now the preferred method to do a rpc, so we need to update all calls. --- addons/website/static/src/js/website.snippets.editor.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'addons/website/static/src/js/website.snippets.editor.js') diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js index 604c8d589f9..426c63e1d2e 100644 --- a/addons/website/static/src/js/website.snippets.editor.js +++ b/addons/website/static/src/js/website.snippets.editor.js @@ -4,6 +4,7 @@ odoo.define('website.snippets.editor', function (require) { var ajax = require("web.ajax"); var core = require("web.core"); var Dialog = require("web.Dialog"); +var rpc = require("web.rpc"); var editor = require("web_editor.editor"); var animation = require('web_editor.snippets.animation'); var options = require('web_editor.snippets.options'); @@ -54,7 +55,6 @@ options.registry.menu_data = options.Class.extend({ options.registry.company_data = options.Class.extend({ start: function () { - var self = this; this._super.apply(this, arguments); var proto = options.registry.company_data.prototype; @@ -62,11 +62,14 @@ options.registry.company_data = options.Class.extend({ if (proto.__link_deferred === undefined) { proto.__link_deferred = $.Deferred(); return ajax.jsonRpc("/web/session/get_session_info", "call").then(function (session) { - return self.performModelRPC("res.users", "read", [session.uid, ["company_id"]]).then(function (res) { - proto.__link_deferred.resolve( - "/web#action=base.action_res_company_form&view_type=form&id=" + (res && res[0] && res[0].company_id[0] || 1) - ); - }); + return rpc.query({model: "res.users", method: "read"}) + .args([session.uid, ["company_id"]]) + .exec({type: "ajax"}) + .then(function (res) { + proto.__link_deferred.resolve( + "/web#action=base.action_res_company_form&view_type=form&id=" + (res && res[0] && res[0].company_id[0] || 1) + ); + }); }); } }, -- cgit v1.2.3