Skip to content

Commit c9280f3

Browse files
Merge pull request #4744 from hbrunn/18.0-web_tour
[18.0][OU-ADD] web_tour
2 parents 673292e + 70c6179 commit c9280f3

File tree

4 files changed

+81
-1
lines changed

4 files changed

+81
-1
lines changed

docsource/modules170-180.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ Module coverage 17.0 -> 18.0
10341034
+---------------------------------------------------+----------------------+-------------------------------------------------+
10351035
| web_hierarchy | | |
10361036
+---------------------------------------------------+----------------------+-------------------------------------------------+
1037-
| web_tour | | |
1037+
| web_tour |Done | |
10381038
+---------------------------------------------------+----------------------+-------------------------------------------------+
10391039
| web_unsplash | | |
10401040
+---------------------------------------------------+----------------------+-------------------------------------------------+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from openupgradelib import openupgrade
2+
3+
4+
@openupgrade.migrate()
5+
def migrate(env, version=None):
6+
"""
7+
Set consumed tours from legacy table after migration
8+
"""
9+
openupgrade.logged_query(
10+
env.cr,
11+
f"""
12+
INSERT INTO res_users_web_tour_tour_rel
13+
(res_users_id, web_tour_tour_id)
14+
SELECT legacy_table.user_id, web_tour_tour.id
15+
FROM
16+
{openupgrade.get_legacy_name('web_tour_tour')} legacy_table,
17+
web_tour_tour
18+
WHERE web_tour_tour.name=legacy_table.name
19+
ON CONFLICT DO NOTHING
20+
""",
21+
)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from openupgradelib import openupgrade
2+
3+
4+
@openupgrade.migrate()
5+
def migrate(env, version=None):
6+
"""
7+
web_tour.tour used to be just a marker which tour has been run for which user,
8+
with a new record for every user who finished the tour.
9+
In v18 tours are unique by name and have a many2many field for recording which
10+
users have completed it.
11+
Move the v17 table out of the way so that we can set tours as consumed in
12+
end-migration (matched by tour name, if a tour name changes from v17 to v18,
13+
the migration script will have to rename it in the legacy table - no core module
14+
does this)
15+
"""
16+
openupgrade.remove_tables_fks(env.cr, ["web_tour_tour"])
17+
openupgrade.rename_tables(env.cr, [("web_tour_tour", None)])
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---Models in module 'web_tour'---
2+
new model web_tour.tour.step
3+
---Fields in module 'web_tour'---
4+
web_tour / res.users / tour_enabled (boolean) : NEW hasdefault: compute
5+
web_tour / web_tour.tour / _order : _order is now 'sequence, name, id' ('id')
6+
web_tour / web_tour.tour / custom (boolean) : NEW
7+
web_tour / web_tour.tour / rainbow_man_message (html) : NEW hasdefault: default
8+
web_tour / web_tour.tour / sequence (integer) : NEW hasdefault: default
9+
web_tour / web_tour.tour / step_ids (one2many) : NEW relation: web_tour.tour.step
10+
web_tour / web_tour.tour / url (char) : NEW hasdefault: default
11+
12+
NOTHING TO DO
13+
14+
web_tour / web_tour.tour / user_consumed_ids (many2many) : NEW relation: res.users
15+
web_tour / web_tour.tour / user_id (many2one) : DEL relation: res.users
16+
17+
DONE: move old table aside in pre-migration, set user_consumed_ids from this table and delete it in end migration
18+
19+
web_tour / web_tour.tour.step / content (char) : NEW
20+
web_tour / web_tour.tour.step / run (char) : NEW
21+
web_tour / web_tour.tour.step / sequence (integer) : NEW
22+
web_tour / web_tour.tour.step / tour_id (many2one) : NEW relation: web_tour.tour, required
23+
web_tour / web_tour.tour.step / trigger (char) : NEW required
24+
---XML records in module 'web_tour'---
25+
NEW ir.actions.act_window: web_tour.tour_action
26+
DEL ir.actions.act_window: web_tour.edit_tour_action
27+
NEW ir.actions.server: web_tour.tour_export_js_action
28+
NEW ir.model.access: web_tour.access_web_tour_tour_readonly
29+
NEW ir.model.access: web_tour.access_web_tour_tour_step_admin
30+
NEW ir.model.access: web_tour.access_web_tour_tour_step_readonly
31+
DEL ir.model.access: web_tour.access_web_tour_tour
32+
NEW ir.model.constraint: web_tour.constraint_web_tour_tour_uniq_name
33+
DEL ir.rule: web_tour.own_tours
34+
NEW ir.ui.view: web_tour.res_users_view_form
35+
NEW ir.ui.view: web_tour.tour_form
36+
NEW ir.ui.view: web_tour.tour_list
37+
NEW ir.ui.view: web_tour.tour_search
38+
DEL ir.ui.view: web_tour.edit_tour_form
39+
DEL ir.ui.view: web_tour.edit_tour_list
40+
DEL ir.ui.view: web_tour.edit_tour_search
41+
42+
NOTHING TO DO

0 commit comments

Comments
 (0)