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 <sudarshan@cliniexperts.com>
This commit is contained in:
parent
fef9d89ce0
commit
e9e90a68b1
1 changed files with 11 additions and 3 deletions
|
|
@ -164,6 +164,7 @@ frappe.form.formatters = {
|
|||
return `<input type="checkbox" disabled
|
||||
class="disabled-${value ? "selected" : "deselected"}">`;
|
||||
},
|
||||
|
||||
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 ? `<a href="${url}" target="_blank">${url}</a>` : "";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue