From 3764f21b3f57aea4c70294756f9d92cdde51874d Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Fri, 31 May 2024 13:53:25 +0200 Subject: [PATCH] fixup! [IMP] webservice: allow web application flow --- webservice/models/webservice_backend.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/webservice/models/webservice_backend.py b/webservice/models/webservice_backend.py index ef99fa2b..001025c0 100644 --- a/webservice/models/webservice_backend.py +++ b/webservice/models/webservice_backend.py @@ -40,7 +40,6 @@ class WebserviceBackend(models.Model): ], readonly=False, store=True, - compute="_compute_oauth2_flow", ) oauth2_clientid = fields.Char(string="Client ID", auth_type="oauth2") oauth2_client_secret = fields.Char(string="Client Secret", auth_type="oauth2") @@ -122,8 +121,10 @@ def _get_adapter_protocol(self): protocol += f"+{self.auth_type}-{self.oauth2_flow}" return protocol - @api.depends("auth_type") - def _compute_oauth2_flow(self): + @api.onchange("auth_type") + def _onchange_oauth2_auth_type(self): + # reset the auth2_flow when auth_type is not oaut2 + # using a compute method interfers with the server environment mixin for rec in self: if rec.auth_type != "oauth2": rec.oauth2_flow = False