diff options
| author | Thibault Delavallée <tde@odoo.com> | 2017-04-05 11:50:43 +0200 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2017-06-19 17:37:38 +0200 |
| commit | e331c0bd19c4738b5646bb6fe9ccb959e14b3d9d (patch) | |
| tree | a480ce7e3622b1c52d52807a7817b24fffc3e529 /addons/website/static/src | |
| parent | ac23ca499ed34337a692fd01ee1d207b40d30926 (diff) | |
[IMP] website: improve setting ga_client_id from dashboard
It now update the website settings parameter use_google_analytics_dashboard
so that the settings are correctly updated with the user choice.
Implementation is changed so that the dashboard uses a jsonRpc call instead
of directly calling ir_config_parameter set_param.
Diffstat (limited to 'addons/website/static/src')
| -rw-r--r-- | addons/website/static/src/js/website.backendDashboard.js | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/addons/website/static/src/js/website.backendDashboard.js b/addons/website/static/src/js/website.backendDashboard.js index 9c6416da4ac..f5c9c6b7b2f 100644 --- a/addons/website/static/src/js/website.backendDashboard.js +++ b/addons/website/static/src/js/website.backendDashboard.js @@ -96,21 +96,19 @@ var Dashboard = Widget.extend(ControlPanelMixin, { }, on_save_ga_client_id: function(ga_client_id) { - - if (!ga_client_id.endsWith(".apps.googleusercontent.com") || ga_client_id.startsWith(" ")) { - this.do_warn(_t('Incorrect Client ID'), _t('The Google Analytics Client ID you have entered seems incorrect.')); - return; - } - var self = this; - this._rpc({ - model: 'ir.config_parameter', - method: 'set_param', - args: ['google_management_client_id', ga_client_id], - }) - .then(function(){ - self.on_date_range_button('week'); - }); + return this._rpc({ + route: '/website/dashboard/set_ga_client_id', + params: { + 'ga_client_id': ga_client_id + }, + }).then(function (result) { + if (result.error) { + self.do_warn(result.error.title, result.error.message); + return; + } + self.on_date_range_button('week'); + }); }, render_dashboards: function() { |
