瀏覽代碼

[hotfix] Disallow Single DocType for Dynamic Link (#4986)

version-14
Faris Ansari 7 年之前
committed by GitHub
父節點
當前提交
0d9b3680b7
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: 4AEE18F83AFDEB23
共有 1 個文件被更改,包括 10 次插入8 次删除
  1. +10
    -8
      frappe/public/js/frappe/form/controls/dynamic_link.js

+ 10
- 8
frappe/public/js/frappe/form/controls/dynamic_link.js 查看文件

@@ -1,11 +1,12 @@
frappe.ui.form.ControlDynamicLink = frappe.ui.form.ControlLink.extend({
get_options: function() {
let options = '';
if(this.df.get_options) {
return this.df.get_options();
options = this.df.get_options();
}
if (this.docname==null && cur_dialog) {
//for dialog box
return cur_dialog.get_value(this.df.options);
options = cur_dialog.get_value(this.df.options);
}
if (!cur_frm) {
const selector = `input[data-fieldname="${this.df.options}"]`;
@@ -18,14 +19,15 @@ frappe.ui.form.ControlDynamicLink = frappe.ui.form.ControlLink.extend({
input = $(cur_page.page).find(selector);
}
if (input) {
return input.val();
options = input.val();
}
}
var options = frappe.model.get_value(this.df.parent, this.docname, this.df.options);
// if(!options) {
// frappe.msgprint(__("Please set {0} first",
// [frappe.meta.get_docfield(this.df.parent, this.df.options, this.docname).label]));
// }
options = frappe.model.get_value(this.df.parent, this.docname, this.df.options);

if (frappe.model.is_single(options)) {
frappe.throw(__(`${options.bold()} is not a valid DocType for Dynamic Link`));
}

return options;
},
});

Loading…
取消
儲存