[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) <lba@odoo.com>
This commit is contained in:
Lina (liew)
2023-11-04 06:43:06 +00:00
parent 2143ae7a9f
commit 3eba3484f3
5 changed files with 1 additions and 40 deletions
-1
View File
@@ -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
-8
View File
@@ -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):
-15
View File
@@ -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(),
}
@@ -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() {
-11
View File
@@ -1,16 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="open_iap_account" model="ir.actions.server">
<field name="name">Open IAP Account</field>
<field name="model_id" ref="base_setup.model_res_config_settings"/>
<field name="binding_model_id" ref="base_setup.model_res_config_settings"/>
<field name="state">code</field>
<field name="code">
if records:
action = records._redirect_to_iap_account()
</field>
</record>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.base.setup.iap</field>
<field name="model">res.config.settings</field>