Skip to content

Commit 24911e5

Browse files
committed
[FIX] website_*: correct 3 data bugs found in re-review
- website_event: remap only 'location' — track/track_proposal still exist in 19 (website_event_track selection_add); the broad remap corrupted them. - website_slides: raw DELETE of the access-request activity type hits mail_activity's RESTRICT FK on live DBs — use the safe-delete helper; and restore + load the 4 ir.rule link-visibility domains the noupdate trim had dropped (link-shared courses were invisible to public/portal users). - website_crm_partner_assign: delete by post-apriori-merge xml_ids — the website_membership-prefixed ones no longer exist when the script runs.
1 parent 826ccdd commit 24911e5

5 files changed

Lines changed: 69 additions & 16 deletions

File tree

openupgrade_scripts/scripts/website_crm_partner_assign/19.0.1.2/pre-migration.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
from openupgradelib import openupgrade
22

3-
# Obsolete website_membership noupdate record rules removed in 19.0; noupdate
3+
# Obsolete website_membership noupdate record rules removed in 19.0 (their
4+
# ir_model_data already moved here by the apriori merge in base); noupdate
45
# records aren't swept by the standard module update, so delete them by xml_id
56
# (record + ir_model_data) to drop the stale public membership access.
67
_obsolete_rule_xmlids = [
7-
"website_membership.membership_membership_line_public",
8-
"website_membership.membership_product_product_public",
8+
"website_crm_partner_assign.membership_membership_line_public",
9+
"website_crm_partner_assign.membership_product_product_public",
910
]
1011

1112

openupgrade_scripts/scripts/website_event/19.0.1.4/post-migration.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
@openupgrade.migrate()
55
def migrate(env, version):
6-
# Map menu_type values removed in 19.0 to the new "other" key.
6+
# Map the menu_type value removed in 19.0 to the new "other" key. track /
7+
# track_proposal still exist (selection_add in website_event_track).
78
env["website.event.menu"].search(
8-
[("menu_type", "in", ("location", "track", "track_proposal"))]
9+
[("menu_type", "=", "location")]
910
).menu_type = "other"
1011
openupgrade.load_data(env, "website_event", "19.0.1.4/noupdate_changes.xml")
Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,53 @@
1-
<?xml version='1.0' encoding='utf-8'?>
1+
<?xml version='1.0' encoding='UTF-8'?>
22
<odoo>
3+
<record id="rule_slide_channel_visibility_public_user" model="ir.rule">
4+
<field name="domain_force">[('website_published', '=', True), ('visibility', 'in', ['public', 'link'])]</field>
5+
<field name="name">Channel: public: restricted to public/link-based and published</field>
6+
</record>
7+
<record id="rule_slide_channel_visibility_signed_in_user" model="ir.rule">
8+
<field name="domain_force">[
9+
'&amp;',
10+
('website_published', '=', True),
11+
'|',
12+
('visibility', 'in', ('public', 'connected', 'link')),
13+
'|',
14+
('is_member_invited', '=', True),
15+
('is_member', '=', True),
16+
]
17+
</field>
18+
<field name="name">Channel: portal/user: restricted to published, public or (invited) attendee or link-based, connected user</field>
19+
</record>
20+
<record id="rule_slide_slide_public_user" model="ir.rule">
21+
<field name="domain_force">[
22+
('channel_id.website_published', '=', True),
23+
('website_published', '=', True),
24+
('channel_id.visibility', 'in', ['public', 'link']),
25+
'|',
26+
('is_category','=', True),
27+
('is_preview', '=', True),
28+
]
29+
</field>
30+
<field name="name">Slide: public: restricted to published or public/link-based channel &amp; (category or previewable)</field>
31+
</record>
32+
<record id="rule_slide_slide_signed_in_user" model="ir.rule">
33+
<field name="domain_force">[
34+
'&amp;',
35+
'|',
36+
('user_id', '=', user.id),
37+
'&amp;',
38+
('website_published', '=', True),
39+
('channel_id.website_published', '=', True),
40+
'|',
41+
'&amp;',
42+
'|',
43+
('channel_id.visibility', 'in', ('public', 'connected', 'link')),
44+
('channel_id.is_member_invited', '=', True),
45+
'|',
46+
('is_category', '=', True),
47+
('is_preview', '=', True),
48+
('channel_id.is_member', '=', True),
49+
]
50+
</field>
51+
<field name="name">Slide: portal/user: restricted to published and connected user, (invited) attendee or link-based, if course visible to attendees only</field>
52+
</record>
353
</odoo>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from openupgradelib import openupgrade
2+
3+
4+
@openupgrade.migrate()
5+
def migrate(env, version):
6+
openupgrade.load_data(env, "website_slides", "19.0.2.7/noupdate_changes.xml")
Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
from openupgradelib import openupgrade
22

3+
# Removed in 19.0; raw SQL would hit mail_activity's RESTRICT FK on DBs with
4+
# open access-request activities — the safe helper deactivates instead.
5+
36

47
@openupgrade.migrate()
58
def migrate(env, version):
6-
openupgrade.logged_query(
7-
env.cr,
8-
"""
9-
DELETE FROM mail_activity_type WHERE id IN (
10-
SELECT imd.res_id FROM ir_model_data imd
11-
WHERE imd.model = 'mail.activity.type'
12-
AND imd.module = 'website_slides'
13-
AND imd.name = 'mail_activity_data_access_request'
14-
)
15-
""",
9+
openupgrade.delete_records_safely_by_xml_id(
10+
env, ["website_slides.mail_activity_data_access_request"]
1611
)

0 commit comments

Comments
 (0)