Skip to content

Commit c8c1a6e

Browse files
committed
[IMP] get_anchor_link_to_record
Use new URL format after saas~17.2 closes #130 Signed-off-by: Christophe Simonis (chs) <[email protected]>
1 parent 04ad41f commit c8c1a6e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/util/report.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,13 @@ def ref(xid):
231231

232232
def get_anchor_link_to_record(model, id, name, action_id=None):
233233
_validate_model(model)
234-
anchor_tag = '<a target="_blank" href="/web?debug=1#view_type=form&amp;model=%s&amp;action=%s&amp;id=%s">%s</a>' % (
235-
model,
236-
action_id or "",
237-
id,
238-
html_escape(name),
239-
)
234+
if version_gte("saas~17.2"):
235+
part1 = "action-{}".format(action_id) if action_id else model
236+
url = "/odoo/{}/{}?debug=1".format(part1, id)
237+
else:
238+
url = "/web?debug=1#view_type=form&amp;model={}&amp;action={}&amp;id={}".format(model, action_id or "", id)
239+
240+
anchor_tag = '<a target="_blank" href="{}">{}</a>'.format(url, html_escape(name))
240241
if Markup:
241242
anchor_tag = Markup(anchor_tag)
242243
return anchor_tag

0 commit comments

Comments
 (0)