From e51c341aa07ac1330ef93a5e91b9adebf0922c16 Mon Sep 17 00:00:00 2001 From: Nisha patel Date: Thu, 3 Sep 2020 13:45:58 +0000 Subject: [PATCH] [IMP] iap: Link to the IAP Portal from each service setting Purpose of this task is, the current link to the IAP portal is very well hidden in the general settings, so we are confident most users won't find it. So in this commit, we added 'View my Services' link below the 'Buy credits' in various IAP settings like: crm, account and settings. closes odoo/odoo#57063 Taskid: 2157984 Signed-off-by: Yannick Tivisse (yti) --- addons/iap/static/src/js/iap_buy_more_credits.js | 13 +++++++++++++ addons/iap/static/src/xml/iap_templates.xml | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/addons/iap/static/src/js/iap_buy_more_credits.js b/addons/iap/static/src/js/iap_buy_more_credits.js index a9ed1c472bd..dbef2cd6898 100644 --- a/addons/iap/static/src/js/iap_buy_more_credits.js +++ b/addons/iap/static/src/js/iap_buy_more_credits.js @@ -31,6 +31,7 @@ var IAPBuyMoreCreditsWidget = Widget.extend({ this.$buyLink = this.$widget.find('.buy_credits'); this.$widget.appendTo(this.$el); this.$buyLink.click(this._getLink.bind(this)); + this.el.querySelector('.o_iap_view_my_services').addEventListener('click', this._getMyServices.bind(this)); }, //-------------------------------------------------------------------------- @@ -51,6 +52,18 @@ var IAPBuyMoreCreditsWidget = Widget.extend({ }); }); }, + + /** + * @private + */ + _getMyServices() { + return this._rpc({ + model: 'iap.account', + method: 'get_account_url', + }).then(url => { + this.do_action({type: 'ir.actions.act_url', url: url}); + }); + }, }); widgetRegistry.add('iap_buy_more_credits', IAPBuyMoreCreditsWidget); diff --git a/addons/iap/static/src/xml/iap_templates.xml b/addons/iap/static/src/xml/iap_templates.xml index 7ea6047eabc..d206f79a17d 100644 --- a/addons/iap/static/src/xml/iap_templates.xml +++ b/addons/iap/static/src/xml/iap_templates.xml @@ -24,7 +24,8 @@
- +
+