Parcourir la 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] il y a 2 ans
committed by GitHub
Parent
révision
465fb85d53
Aucune clé connue n'a été trouvée dans la base pour cette signature ID de la clé GPG: 4AEE18F83AFDEB23
1 fichiers modifiés avec 10 ajouts et 14 suppressions
  1. +10
    -14
      frappe/public/js/frappe/form/controls/link.js

+ 10
- 14
frappe/public/js/frappe/form/controls/link.js Voir le fichier

@@ -89,23 +89,19 @@ frappe.ui.form.ControlLink = class ControlLink extends frappe.ui.form.ControlDat
is_translatable() {
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);
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) {
let translated_link_text = this.get_translated(link_title);


Chargement…
Annuler
Enregistrer