Skip to content

Commit efc5663

Browse files
committed
[FIX] upgrade report: fix disabled/overwritten views links on saas~17.2
With path-based routing added to saas~17.2 we need to force the root relative url as the discuss channel url will not be `/web` anymore, but `/odoo/discuss.channel_*/discuss'. closes #59 Signed-off-by: Christophe Simonis (chs) <[email protected]>
1 parent 48bb328 commit efc5663

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/util/report-migration.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
'Overridden views': ['The below standard views have been overriden with their original content during the migration because the changes made in them were no longer valid.', '%(xml_id)s'],
1010
'Disabled views': ['The below custom views have been disabled during the migration because they were no longer valid.', '%(name)s'],
1111
}"/>
12-
<t t-set="view_action_link" t-value="'web?debug=1#view_type=form&amp;model=ir.ui.view&amp;action=%s&amp;id=%%s' % action_view_id"/>
1312
<t t-set="message_type" t-value="view_message_types[category]"/>
1413
<li><details t-if="messages[category]">
1514
<summary>
@@ -22,12 +21,12 @@
2221
<t t-if="view.get('copy_id')">
2322
<t t-esc="message_type[1] % view"/>
2423
&amp;nbsp;
25-
<a t-att-href="view_action_link % view['id']" target="_blank">Original</a>
24+
<t t-raw="get_anchor_link_to_record('ir.ui.view', view['id'], 'Original', action_id=action_view_id)"/>
2625
&amp;nbsp;
27-
<a t-att-href="view_action_link % view['copy_id']" target="_blank">Copy</a>
26+
<t t-raw="get_anchor_link_to_record('ir.ui.view', view['copy_id'], 'Copy', action_id=action_view_id)"/>
2827
</t>
2928
<t t-if="not view.get('copy_id')">
30-
<a t-att-href="view_action_link % view['id']" target="_blank"><t t-esc="message_type[1] % view"/></a>
29+
<t t-raw="get_anchor_link_to_record('ir.ui.view', view['id'], message_type[1] % view, action_id=action_view_id)"/>
3130
</t>
3231
</li>
3332
</t>
@@ -39,7 +38,7 @@
3938
<summary>During the upgrade some fields have been removed. The records below have been automatically corrected.</summary>
4039
<ul>
4140
<t t-foreach="messages[category]" t-as="message">
42-
<li><a t-att-href="'web?debug=1#view_type=form&amp;model=%s&amp;id=%s' % (message[0][0], message[0][1])" t-esc="message[0][2]" target="_blank"/></li>
41+
<t t-raw="get_anchor_link_to_record(*message[0])"/>
4342
</t>
4443
</ul>
4544
</details></li>

src/util/report.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ def announce_migration_report(cr):
9494
"action_view_id": e.ref("base.action_ui_view").id,
9595
"major_version": release.major_version,
9696
"messages": migration_reports,
97+
"get_anchor_link_to_record": get_anchor_link_to_record,
9798
}
9899
_logger.info(migration_reports)
99100
render = e["ir.qweb"].render if hasattr(e["ir.qweb"], "render") else e["ir.qweb"]._render
@@ -230,7 +231,7 @@ def ref(xid):
230231

231232
def get_anchor_link_to_record(model, id, name, action_id=None):
232233
_validate_model(model)
233-
return '<a target="_blank" href="web?debug=1#view_type=form&amp;model=%s&amp;action=%s&amp;id=%s">%s</a>' % (
234+
return '<a target="_blank" href="/web?debug=1#view_type=form&amp;model=%s&amp;action=%s&amp;id=%s">%s</a>' % (
234235
model,
235236
action_id or "",
236237
id,

0 commit comments

Comments
 (0)