From 01b24fc907bfb4274505b17270f806b65a7511a2 Mon Sep 17 00:00:00 2001 From: AjmalCybro Date: Wed, 27 Mar 2024 15:18:19 +0530 Subject: [PATCH] Mar 27 [UPDT] : Updated 'odoo_google_contact_integration' --- .../models/res_company.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/odoo_google_contact_integration/models/res_company.py b/odoo_google_contact_integration/models/res_company.py index 29f7ffa72..9937170e5 100644 --- a/odoo_google_contact_integration/models/res_company.py +++ b/odoo_google_contact_integration/models/res_company.py @@ -21,8 +21,9 @@ ############################################################################## import logging import requests -from odoo import fields, models, _ +from odoo import api, fields, models, _ from odoo.exceptions import UserError, ValidationError +from odoo.http import request _logger = logging.getLogger(__name__) @@ -39,7 +40,7 @@ class ResCompany(models.Model): string="Client Secret", help='People API Client Secret') contact_redirect_uri = fields.Char( string="Authorized redirect URIs", - default="http://localhost:8016/google_contact_authentication", + compute="_compute_contact_redirect_uri", help='People API Authorized redirect URIs') contact_company_access_token = fields.Char( string="Access Token", copy=False, @@ -51,6 +52,14 @@ class ResCompany(models.Model): contact_company_authorization_code = fields.Char( string="Authorization Code", help='People API Authorization Code') + @api.depends('contact_redirect_uri') + def _compute_contact_redirect_uri(self): + """Compute the redirect URI for onedrive and Google Drive""" + for rec in self: + base_url = request.env['ir.config_parameter'].get_param( + 'web.base.url') + rec.contact_redirect_uri = base_url + '/google_contact_authentication' + def action_google_contact_authenticate(self): """Authenticate the connection to Google.""" if not self.contact_client_id: