From 4196ea9dc24b8b931c4acc263b843406be7c7b25 Mon Sep 17 00:00:00 2001 From: Arnaud Joset Date: Mon, 6 Dec 2021 10:15:47 +0000 Subject: [PATCH] [FIX] google_calendar: prevent traceback when resetting the google tokens from the reset account wizard Before this commit, the account reset would fail with the following traceback: ```py The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/odoo/src/odoo/15.0/odoo/http.py", line 643, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/home/odoo/src/odoo/15.0/odoo/http.py", line 301, in _handle_exception raise exception.with_traceback(None) from new_cause AttributeError: 'res.users' object has no attribute '_set_auth_tokens' ``` This commit allows to use the wizard. opw-2705169 closes odoo/odoo#80918 X-original-commit: 9f2aa5c87a9809899cba872e6a0428f86c687b9a Signed-off-by: Yannick Tivisse (yti) Signed-off-by: Arnaud Joset --- addons/google_calendar/security/ir.model.access.csv | 1 + addons/google_calendar/wizard/reset_account.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/google_calendar/security/ir.model.access.csv b/addons/google_calendar/security/ir.model.access.csv index ccbc397081c..f2f622519e3 100644 --- a/addons/google_calendar/security/ir.model.access.csv +++ b/addons/google_calendar/security/ir.model.access.csv @@ -1,3 +1,4 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink google_calendar_account_reset,google_calendar_account_reset_access_right,model_google_calendar_account_reset,base.group_system,1,1,1,0 google_calendar.access_google_calendar_credentials,access_google_calendar_credentials,google_calendar.model_google_calendar_credentials,base.group_user,1,0,0,0 +google_calendar_manager,access_google_calendar_credentials_manager,google_calendar.model_google_calendar_credentials,base.group_system,1,1,0,0 diff --git a/addons/google_calendar/wizard/reset_account.py b/addons/google_calendar/wizard/reset_account.py index 4a7242126d9..5aded942ecb 100644 --- a/addons/google_calendar/wizard/reset_account.py +++ b/addons/google_calendar/wizard/reset_account.py @@ -45,7 +45,7 @@ class ResetGoogleAccount(models.TransientModel): 'need_sync': True, }) - self.user_id._set_auth_tokens(False, False, 0) + self.user_id.google_cal_account_id._set_auth_tokens(False, False, 0) self.user_id.write({ 'google_calendar_sync_token': False, 'google_calendar_cal_id': False,