refactor: build document links with get_form_link in form scripts

This commit is contained in:
diptanilsaha
2026-08-18 22:49:47 +05:30
parent cfb664804c
commit 93d6ccd041
3 changed files with 11 additions and 3 deletions

View File

@@ -309,7 +309,9 @@ frappe.ui.form.on("BOM", {
frm.set_intro(
__("This is a Template BOM and will be used to make the work order for {0} of the item {1}", [
`<a class="variants-intro">variants</a>`,
`<a href="/app/item/${frm.doc.item}">${frm.doc.item}</a>`,
`<a href="${frappe.utils.get_form_link("Item", frm.doc.item)}">${frappe.utils.escape_html(
frm.doc.item
)}</a>`,
]),
true
);

View File

@@ -290,7 +290,10 @@ frappe.ui.form.on("Item", {
if (frm.doc.variant_of) {
frm.set_intro(
__("This Item is a Variant of {0} (Template).", [
`<a href="/app/item/${frm.doc.variant_of}" onclick="location.reload()">${frm.doc.variant_of}</a>`,
`<a href="${frappe.utils.get_form_link(
"Item",
frm.doc.variant_of
)}" onclick="location.reload()">${frappe.utils.escape_html(frm.doc.variant_of)}</a>`,
]),
true
);

View File

@@ -174,7 +174,10 @@ frappe.ui.form.on("Shipment", {
__("Email or Phone/Mobile of the Contact are mandatory to continue.") +
"</br>" +
__("Please set Email/Phone for the contact") +
` <a href='/app/contact/${contact_name}'>${contact_name}</a>`
` <a href="${frappe.utils.get_form_link(
"Contact",
contact_name
)}">${frappe.utils.escape_html(contact_name)}</a>`
);
}
let contact_display = r.message.contact_display;