From 3eba3484f3f8a21dde4492c494c40cf88a6c8e08 Mon Sep 17 00:00:00 2001 From: "Lina (liew)" Date: Thu, 2 Nov 2023 14:24:05 +0100 Subject: [PATCH] [IMP] iap: redirect to view my services Description of the issue/feature this PR addresses: The "View My Services" button of the widget should open the IAP accounts tree view, just as the main "View My Services" button of the general settings. Current behavior before PR: View my services widget redirected to iap website Desired behavior after PR is merged: Updated the widget to redirect to tree view of services task-3580190 closes odoo/odoo#140904 Signed-off-by: Louis Baudoux (lba) --- addons/iap/models/__init__.py | 1 - addons/iap/models/iap_account.py | 8 -------- addons/iap/models/res_config_settings.py | 15 --------------- .../action_buttons_widget.js | 6 +----- addons/iap/views/res_config_settings.xml | 11 ----------- 5 files changed, 1 insertion(+), 40 deletions(-) delete mode 100644 addons/iap/models/res_config_settings.py diff --git a/addons/iap/models/__init__.py b/addons/iap/models/__init__.py index 2e95fd52ee5..a8953fb44f3 100644 --- a/addons/iap/models/__init__.py +++ b/addons/iap/models/__init__.py @@ -2,5 +2,4 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import iap_account -from . import res_config_settings from . import iap_enrich_api diff --git a/addons/iap/models/iap_account.py b/addons/iap/models/iap_account.py index 8aae79f9e0b..e5c6e5e1fcd 100644 --- a/addons/iap/models/iap_account.py +++ b/addons/iap/models/iap_account.py @@ -203,14 +203,6 @@ class IapAccount(models.Model): def action_toggle_show_token(self): for account in self: account.show_token = not account.show_token - @api.model - def get_account_url(self): - """ Called only by res settings """ - route = '/iap/services' - endpoint = iap_tools.iap_get_endpoint(self.env) - d = {'dbuuid': self.env['ir.config_parameter'].sudo().get_param('database.uuid')} - - return '%s?%s' % (endpoint + route, werkzeug.urls.url_encode(d)) @api.model def get_config_account_url(self): diff --git a/addons/iap/models/res_config_settings.py b/addons/iap/models/res_config_settings.py deleted file mode 100644 index 9c999eed653..00000000000 --- a/addons/iap/models/res_config_settings.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo import api, models - - -class ResConfigSettings(models.TransientModel): - _inherit = 'res.config.settings' - - @api.model - def _redirect_to_iap_account(self): - return { - 'type': 'ir.actions.act_url', - 'url': self.env['iap.account'].get_account_url(), - } diff --git a/addons/iap/static/src/action_buttons_widget/action_buttons_widget.js b/addons/iap/static/src/action_buttons_widget/action_buttons_widget.js index d7a06c4d65b..8c5525e56ea 100644 --- a/addons/iap/static/src/action_buttons_widget/action_buttons_widget.js +++ b/addons/iap/static/src/action_buttons_widget/action_buttons_widget.js @@ -12,11 +12,7 @@ class IAPActionButtonsWidget extends Component { } async onViewServicesClicked() { - const url = await this.orm.silent.call("iap.account", "get_account_url"); - this.action.doAction({ - type: "ir.actions.act_url", - url: url, - }); + this.action.doAction("iap.iap_account_action"); } async onBuyLinkClicked() { diff --git a/addons/iap/views/res_config_settings.xml b/addons/iap/views/res_config_settings.xml index 06ddc5ce61c..94ea4c5970a 100644 --- a/addons/iap/views/res_config_settings.xml +++ b/addons/iap/views/res_config_settings.xml @@ -1,16 +1,5 @@ - - Open IAP Account - - - code - -if records: - action = records._redirect_to_iap_account() - - - res.config.settings.view.form.inherit.base.setup.iap res.config.settings