forked from tvtma/OpenUpgrade
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] microsoft_calendar: nothing to do (#645)
* [MIG] microsoft_calendar: nothing to do * [IMP] microsoft_calendar: create new record microsoft.calendar.credentials in post-migration * Update openupgrade_scripts/scripts/microsoft_calendar/17.0.1.0/post-migration.py * Update openupgrade_scripts/scripts/microsoft_calendar/17.0.1.0/post-migration.py --------- Co-authored-by: Roy Le <[email protected]> Co-authored-by: Roy Le <[email protected]>
- Loading branch information
1 parent
d92f061
commit 0595541
Showing
3 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
openupgrade_scripts/scripts/microsoft_calendar/17.0.1.0/post-migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright 2024 Viindoo Technology Joint Stock Company (Viindoo) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from openupgradelib import openupgrade | ||
|
||
|
||
def _fill_res_users_microsoft_calendar_account_id(env): | ||
env.cr.execute( | ||
""" | ||
SELECT id, microsoft_calendar_sync_token, microsoft_synchronization_stopped | ||
FROM res_users | ||
WHERE microsoft_calendar_sync_token IS NOT NULL | ||
""" | ||
) | ||
vals_list = [] | ||
for row in env.cr.fetchall(): | ||
vals_list.append( | ||
{ | ||
"calendar_sync_token": row[1], | ||
"synchronization_stopped": row[2], | ||
"user_ids": [(6, 0, [row[0]])], | ||
} | ||
) | ||
if vals_list: | ||
env["microsoft.calendar.credentials"].create(vals_list) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
_fill_res_users_microsoft_calendar_account_id(env) |
25 changes: 25 additions & 0 deletions
25
openupgrade_scripts/scripts/microsoft_calendar/17.0.1.0/upgrade_analysis_work.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
---Models in module 'microsoft_calendar'--- | ||
new model microsoft.calendar.credentials | ||
# NOTHING TO DO | ||
|
||
---Fields in module 'microsoft_calendar'--- | ||
microsoft_calendar / microsoft.calendar.credentials / calendar_sync_token (char) : NEW | ||
microsoft_calendar / microsoft.calendar.credentials / last_sync_date (datetime) : NEW | ||
microsoft_calendar / microsoft.calendar.credentials / synchronization_stopped (boolean): NEW | ||
microsoft_calendar / microsoft.calendar.credentials / user_ids (one2many) : NEW relation: res.users, required | ||
# NOTHING TO DO: new feature | ||
|
||
microsoft_calendar / res.users / microsoft_calendar_account_id (many2one): NEW relation: microsoft.calendar.credentials | ||
microsoft_calendar / res.users / microsoft_calendar_sync_token (char): not stored anymore | ||
microsoft_calendar / res.users / microsoft_calendar_sync_token (char): now related | ||
microsoft_calendar / res.users / microsoft_synchronization_stopped (boolean): not stored anymore | ||
microsoft_calendar / res.users / microsoft_synchronization_stopped (boolean): now related | ||
# DONE: create new record microsoft.calendar.credentials in post-migration | ||
|
||
---XML records in module 'microsoft_calendar'--- | ||
NEW ir.model.access: microsoft_calendar.access_microsoft_calendar_credentials | ||
NEW ir.model.access: microsoft_calendar.microsoft_calendar_manager | ||
NEW ir.rule: microsoft_calendar.microsoft_calendar_not_own_token_rule (noupdate) | ||
NEW ir.rule: microsoft_calendar.microsoft_calendar_own_token_rule (noupdate) | ||
NEW ir.rule: microsoft_calendar.microsoft_calendar_token_system_access (noupdate) | ||
# NOTHING TO DO |