From e9e90a68b1e99d4c53e2b16ed2cfea6ce8f7599e Mon Sep 17 00:00:00 2001 From: Sudarshan <73628063+sudarsan2001@users.noreply.github.com> Date: Fri, 20 Feb 2026 10:41:41 +0530 Subject: [PATCH] fix: make translation for link field value irrespective of user permissions only if the source doctype is in translated doctypes (#35803) Co-authored-by: sudarshan-g --- frappe/public/js/frappe/form/formatters.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/frappe/public/js/frappe/form/formatters.js b/frappe/public/js/frappe/form/formatters.js index 6da3227a48..dc1c7a5fe2 100644 --- a/frappe/public/js/frappe/form/formatters.js +++ b/frappe/public/js/frappe/form/formatters.js @@ -164,6 +164,7 @@ frappe.form.formatters = { return ``; }, + Link: function (value, docfield, options, doc) { var doctype = docfield._options || docfield.options; var original_value = value; @@ -178,7 +179,7 @@ frappe.form.formatters = { } if (options && (options.for_print || options.only_value)) { - return link_title || value; + return get_link_display_value(doctype, link_title, value); } if (frappe.form.link_formatters[doctype]) { @@ -211,10 +212,10 @@ frappe.form.formatters = { a.innerText = __((options && options.label) || link_title || value); return a.outerHTML; } else { - return link_title || value; + return get_link_display_value(doctype, link_title, value); } } else { - return link_title || value; + return get_link_display_value(doctype, link_title, value); } }, Date: function (value) { @@ -407,6 +408,13 @@ frappe.form.formatters = { AttachImage: format_attachment_url, }; +function get_link_display_value(doctype, link_title, value) { + let translated_doctypes = frappe.boot?.translated_doctypes || []; + if (translated_doctypes.includes(doctype)) { + return __(link_title || value); + } + return link_title || value; +} function format_attachment_url(url) { return url ? `${url}` : ""; }