Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docsource/modules170-180.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ Module coverage 17.0 -> 18.0
+---------------------------------------------------+----------------------+-------------------------------------------------+
| web_hierarchy | | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| web_tour | | |
| web_tour |Done | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| web_unsplash | | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
21 changes: 21 additions & 0 deletions openupgrade_scripts/scripts/web_tour/18.0.1.0/end-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version=None):
"""
Set consumed tours from legacy table after migration
"""
openupgrade.logged_query(
env.cr,
f"""
INSERT INTO res_users_web_tour_tour_rel
(res_users_id, web_tour_tour_id)
SELECT legacy_table.user_id, web_tour_tour.id
FROM
{openupgrade.get_legacy_name('web_tour_tour')} legacy_table,
web_tour_tour
WHERE web_tour_tour.name=legacy_table.name
ON CONFLICT DO NOTHING
""",
)
17 changes: 17 additions & 0 deletions openupgrade_scripts/scripts/web_tour/18.0.1.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version=None):
"""
web_tour.tour used to be just a marker which tour has been run for which user,
with a new record for every user who finished the tour.
In v18 tours are unique by name and have a many2many field for recording which
users have completed it.
Move the v17 table out of the way so that we can set tours as consumed in
end-migration (matched by tour name, if a tour name changes from v17 to v18,
the migration script will have to rename it in the legacy table - no core module
does this)
"""
openupgrade.remove_tables_fks(env.cr, ["web_tour_tour"])
openupgrade.rename_tables(env.cr, [("web_tour_tour", None)])
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---Models in module 'web_tour'---
new model web_tour.tour.step
---Fields in module 'web_tour'---
web_tour / res.users / tour_enabled (boolean) : NEW hasdefault: compute
web_tour / web_tour.tour / _order : _order is now 'sequence, name, id' ('id')
web_tour / web_tour.tour / custom (boolean) : NEW
web_tour / web_tour.tour / rainbow_man_message (html) : NEW hasdefault: default
web_tour / web_tour.tour / sequence (integer) : NEW hasdefault: default
web_tour / web_tour.tour / step_ids (one2many) : NEW relation: web_tour.tour.step
web_tour / web_tour.tour / url (char) : NEW hasdefault: default

NOTHING TO DO

web_tour / web_tour.tour / user_consumed_ids (many2many) : NEW relation: res.users
web_tour / web_tour.tour / user_id (many2one) : DEL relation: res.users

DONE: move old table aside in pre-migration, set user_consumed_ids from this table and delete it in end migration

web_tour / web_tour.tour.step / content (char) : NEW
web_tour / web_tour.tour.step / run (char) : NEW
web_tour / web_tour.tour.step / sequence (integer) : NEW
web_tour / web_tour.tour.step / tour_id (many2one) : NEW relation: web_tour.tour, required
web_tour / web_tour.tour.step / trigger (char) : NEW required
---XML records in module 'web_tour'---
NEW ir.actions.act_window: web_tour.tour_action
DEL ir.actions.act_window: web_tour.edit_tour_action
NEW ir.actions.server: web_tour.tour_export_js_action
NEW ir.model.access: web_tour.access_web_tour_tour_readonly
NEW ir.model.access: web_tour.access_web_tour_tour_step_admin
NEW ir.model.access: web_tour.access_web_tour_tour_step_readonly
DEL ir.model.access: web_tour.access_web_tour_tour
NEW ir.model.constraint: web_tour.constraint_web_tour_tour_uniq_name
DEL ir.rule: web_tour.own_tours
NEW ir.ui.view: web_tour.res_users_view_form
NEW ir.ui.view: web_tour.tour_form
NEW ir.ui.view: web_tour.tour_list
NEW ir.ui.view: web_tour.tour_search
DEL ir.ui.view: web_tour.edit_tour_form
DEL ir.ui.view: web_tour.edit_tour_list
DEL ir.ui.view: web_tour.edit_tour_search

NOTHING TO DO
Loading