Browse Source

fix(Link): dont validate DocType when setting value (#18069)

(cherry picked from commit 1ea1d5de04)

Co-authored-by: Sagar Vora <sagar@resilient.tech>
version-14
mergify[bot] 2 years ago
committed by GitHub
parent
commit
465fb85d53
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 14 deletions
  1. +10
    -14
      frappe/public/js/frappe/form/controls/link.js

+ 10
- 14
frappe/public/js/frappe/form/controls/link.js View File

@@ -89,23 +89,19 @@ frappe.ui.form.ControlLink = class ControlLink extends frappe.ui.form.ControlDat
is_translatable() { is_translatable() {
return in_list(frappe.boot?.translated_doctypes || [], this.get_options()); return in_list(frappe.boot?.translated_doctypes || [], this.get_options());
} }
set_link_title(value) {
let doctype = this.get_options();

if (!doctype) return;
async set_link_title(value) {
const doctype = this.get_options();


if (in_list(frappe.boot.link_title_doctypes, doctype)) {
let link_title = frappe.utils.get_link_title(doctype, value);
if (!link_title) {
link_title = frappe.utils.fetch_link_title(doctype, value).then((link_title) => {
this.translate_and_set_input_value(link_title, value);
});
} else {
this.translate_and_set_input_value(link_title, value);
}
} else {
if (!doctype || !in_list(frappe.boot.link_title_doctypes, doctype)) {
this.translate_and_set_input_value(value, value); this.translate_and_set_input_value(value, value);
return;
} }

const link_title =
frappe.utils.get_link_title(doctype, value) ||
(await frappe.utils.fetch_link_title(doctype, value));

this.translate_and_set_input_value(link_title, value);
} }
translate_and_set_input_value(link_title, value) { translate_and_set_input_value(link_title, value) {
let translated_link_text = this.get_translated(link_title); let translated_link_text = this.get_translated(link_title);


Loading…
Cancel
Save