[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) <yti@odoo.com>
Signed-off-by: Arnaud Joset <arj@odoo.com>
This commit is contained in:
Arnaud Joset
2021-12-06 16:49:24 +00:00
parent 60728a63db
commit 4196ea9dc2
2 changed files with 2 additions and 1 deletions
@@ -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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 google_calendar_account_reset google_calendar_account_reset_access_right model_google_calendar_account_reset base.group_system 1 1 1 0
3 google_calendar.access_google_calendar_credentials access_google_calendar_credentials google_calendar.model_google_calendar_credentials base.group_user 1 0 0 0
4 google_calendar_manager access_google_calendar_credentials_manager google_calendar.model_google_calendar_credentials base.group_system 1 1 0 0
@@ -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,