fix: create new from dashboard will not set the value in the dynamic link field
This commit is contained in:
parent
b14d6e76b1
commit
f1463ccc24
3 changed files with 8 additions and 3 deletions
|
|
@ -382,7 +382,7 @@ $.extend(frappe.model, {
|
|||
tasks.push(() => frappe.model.trigger(key, value, doc));
|
||||
} else {
|
||||
// execute link triggers (want to reselect to execute triggers)
|
||||
if(fieldtype=="Link" && doc) {
|
||||
if(in_list(["Link", "Dynamic Link"], fieldtype) && doc) {
|
||||
tasks.push(() => frappe.model.trigger(key, value, doc));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -509,7 +509,12 @@ _f.Frm.prototype.make_new = function(doctype) {
|
|||
|
||||
// set link fields (if found)
|
||||
frappe.get_meta(doctype).fields.forEach(function(df) {
|
||||
if(df.fieldtype==='Link' && df.options===me.doctype) {
|
||||
if(df.fieldtype==='Link' && df.options==="DocType") {
|
||||
new_doc[df.fieldname] = me.doctype;
|
||||
}
|
||||
|
||||
if((df.fieldtype==='Link' && df.options===me.doctype)
|
||||
|| (df.fieldtype==='Dynamic Link' && new_doc[df.options] === me.doctype)) {
|
||||
new_doc[df.fieldname] = me.doc.name;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -615,7 +615,7 @@ _f.Frm.prototype.trigger_link_fields = function() {
|
|||
// trigger link fields which have default values set
|
||||
if (this.is_new() && this.doc.__run_link_triggers) {
|
||||
$.each(this.fields_dict, function(fieldname, field) {
|
||||
if (field.df.fieldtype=="Link" && this.doc[fieldname]) {
|
||||
if (in_list(['Link', 'Dynamic Link'], field.df.fieldtype) && this.doc[fieldname]) {
|
||||
// triggers add fetch, sets value in model and runs triggers
|
||||
field.set_value(this.doc[fieldname]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue