diff options
Diffstat (limited to 'addons/web/static/src/js/widgets')
5 files changed, 74 insertions, 53 deletions
diff --git a/addons/web/static/src/js/widgets/change_password.js b/addons/web/static/src/js/widgets/change_password.js index c1c9c4dddea..b71ae4aaf4b 100644 --- a/addons/web/static/src/js/widgets/change_password.js +++ b/addons/web/static/src/js/widgets/change_password.js @@ -31,11 +31,12 @@ var ChangePassword = Widget.extend({ self.$el.parents('.modal').modal('hide'); }); $button.eq(0).click(function () { - self._rpc('/web/session/change_password') - .params({ - fields: $('form[name=change_password_form]').serializeArray() + self._rpc({ + route: '/web/session/change_password', + params: { + fields: $('form[name=change_password_form]').serializeArray() + } }) - .exec() .done(function (result) { if (result.error) { self._display_error(result); diff --git a/addons/web/static/src/js/widgets/data_export.js b/addons/web/static/src/js/widgets/data_export.js index dbe4c4d3d3c..f8c622bf5e8 100644 --- a/addons/web/static/src/js/widgets/data_export.js +++ b/addons/web/static/src/js/widgets/data_export.js @@ -218,18 +218,19 @@ var DataExport = Dialog.extend({ this.$fields_list = this.$('.o_fields_list'); this.$import_compat_radios = this.$('.o_import_compat input'); - waitFor.push(this._rpc('/web/export/formats').exec().then(do_setup_export_formats)); + waitFor.push(this._rpc({route: '/web/export/formats'}).then(do_setup_export_formats)); var got_fields = new $.Deferred(); this.$import_compat_radios.change(function(e) { self.$('.o_field_tree_structure').remove(); - self._rpc("/web/export/get_fields") - .params({ - model: self.dataset.model, - import_compat: !!$(e.target).val(), + self._rpc({ + route: '/web/export/get_fields', + params: { + model: self.dataset.model, + import_compat: !!$(e.target).val(), + }, }) - .exec() .done(function (records) { var compatible_fields = _.map(records, function (record) {return record.id}); self.$fields_list @@ -299,12 +300,13 @@ var DataExport = Dialog.extend({ self.$fields_list.empty(); var export_id = self.$('.o_exported_lists_select option:selected').val(); if(export_id) { - self._rpc('/web/export/namelist') - .params({ - model: self.dataset.model, - export_id: parseInt(export_id, 10), + self._rpc({ + route: '/web/export/namelist', + params: { + model: self.dataset.model, + export_id: parseInt(export_id, 10), + }, }) - .exec() .then(do_load_export_field); } }); @@ -347,16 +349,17 @@ var DataExport = Dialog.extend({ if(!record.loaded) { var self = this; - this._rpc("/web/export/get_fields") - .params({ - model: model, - prefix: prefix, - parent_name: name, - import_compat: !!this.$import_compat_radios.filter(':checked').val(), - parent_field_type : record['field_type'], - exclude: exclude_fields + this._rpc({ + route: '/web/export/get_fields', + params: { + model: model, + prefix: prefix, + parent_name: name, + import_compat: !!this.$import_compat_radios.filter(':checked').val(), + parent_field_type : record['field_type'], + exclude: exclude_fields + }, }) - .exec() .done(function(results) { record.loaded = true; self.on_show_data(results, record.id); diff --git a/addons/web/static/src/js/widgets/debug_manager.js b/addons/web/static/src/js/widgets/debug_manager.js index 697572257f8..fba49f71ade 100644 --- a/addons/web/static/src/js/widgets/debug_manager.js +++ b/addons/web/static/src/js/widgets/debug_manager.js @@ -63,13 +63,17 @@ var DebugManager = Widget.extend({ // whether the current user is an administrator this._is_admin = session.is_system; return $.when( - this._rpc('res.users', 'check_access_rights') - .kwargs({operation: 'write', raise_exception: false}) - .exec(), + this._rpc({ + model: 'res.users', + method: 'check_access_rights', + kwargs: {operation: 'write', raise_exception: false}, + }), session.user_has_group('base.group_no_one'), - this._rpc('ir.model.data', 'xmlid_to_res_id') - .kwargs({xmlid: 'base.group_no_one'}) - .exec(), + this._rpc({ + model: 'ir.model.data', + method: 'xmlid_to_res_id', + kwargs: {xmlid: 'base.group_no_one'}, + }), this._super() ).then(function (can_write_user, has_group_no_one, group_no_one_id) { this._features_group = can_write_user && group_no_one_id; @@ -165,11 +169,13 @@ var DebugManager = Widget.extend({ title: _t('Select a view'), disable_multiple_selection: true, on_selected: function (element_ids) { - self._rpc('ir.ui.view', 'search_read') - .withDomain([['id', '=', element_ids[0]]]) - .withFields(['name', 'model', 'type']) - .withLimit(1) - .exec() + self._rpc({ + model: 'ir.ui.view', + method: 'search_read', + domain: [['id', '=', element_ids[0]]], + fields: ['name', 'model', 'type'], + limit: 1, + }) .then(function (view) { self.do_action({ type: 'ir.actions.act_window', @@ -228,11 +234,13 @@ DebugManager.include({ get_view_fields: function () { var self = this; var model = this._action.res_model; - this._rpc(model, 'fields_get') - .kwargs({ - attributes: ['string', 'searchable', 'required', 'readonly', 'type', 'store', 'sortable', 'relation', 'help'] + this._rpc({ + model: model, + method: 'fields_get', + kwargs: { + attributes: ['string', 'searchable', 'required', 'readonly', 'type', 'store', 'sortable', 'relation', 'help'] + }, }) - .exec() .done(function (fields) { new Dialog(self, { title: _.str.sprintf(_t("Fields of %s"), model), @@ -266,9 +274,11 @@ DebugManager.include({ }); }, translate: function() { - this._rpc("ir.translation", 'get_technical_translations') - .args([this._action.res_model]) - .exec() + this._rpc({ + model: 'ir.translation', + method: 'get_technical_translations', + args: [this._action.res_model], + }) .then(this.do_action); } }); @@ -283,9 +293,11 @@ DebugManager.include({ this._can_edit_views = false; return $.when( this._super(), - this._rpc('ir.ui.view', 'check_access_rights') - .kwargs({operation: 'write', raise_exception: false}) - .exec() + this._rpc({ + model: 'ir.ui.view', + method: 'check_access_rights', + kwargs: {operation: 'write', raise_exception: false}, + }) .then(function (ar) { this._can_edit_views = ar; }.bind(this)) diff --git a/addons/web/static/src/js/widgets/model_field_selector.js b/addons/web/static/src/js/widgets/model_field_selector.js index 41433253499..ebe190b5b44 100644 --- a/addons/web/static/src/js/widgets/model_field_selector.js +++ b/addons/web/static/src/js/widgets/model_field_selector.js @@ -317,11 +317,14 @@ var ModelFieldSelector = Widget.extend({ _getModelFieldsFromCache: function (model, filters) { var def = modelFieldsCache.cacheDefs[model]; if (!def) { - def = modelFieldsCache.cacheDefs[model] = this._rpc(model, "fields_get") - .args([ - false, - ["store", "searchable", "type", "string", "relation", "selection", "related"]]) - .exec() + def = modelFieldsCache.cacheDefs[model] = this._rpc({ + model: model, + method: 'fields_get', + args: [ + false, + ["store", "searchable", "type", "string", "relation", "selection", "related"] + ] + }) .then((function (fields) { modelFieldsCache.cache[model] = sortFields(fields); }).bind(this)); diff --git a/addons/web/static/src/js/widgets/switch_company_menu.js b/addons/web/static/src/js/widgets/switch_company_menu.js index 1f5f0733938..8bea91a5a97 100644 --- a/addons/web/static/src/js/widgets/switch_company_menu.js +++ b/addons/web/static/src/js/widgets/switch_company_menu.js @@ -18,9 +18,11 @@ var SwitchCompanyMenu = Widget.extend({ this.$el.on('click', '.dropdown-menu li a[data-menu]', _.debounce(function(ev) { ev.preventDefault(); var company_id = $(ev.currentTarget).data('company-id'); - self._rpc('res.users', 'write') - .args([[session.uid], {'company_id': company_id}]) - .exec() + self._rpc({ + model: 'res.users', + method: 'write', + args: [[session.uid], {'company_id': company_id}], + }) .then(function() { location.reload(); }); |
