Merge pull request #12770 from surajshetty3416/fix-get_route_options_for_new_doc

This commit is contained in:
Suraj Shetty 2021-04-01 18:34:33 +05:30 committed by GitHub
commit c78be3d28d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,11 +83,16 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({
var doctype = this.get_options();
var me = this;
if(!doctype) return;
if (!doctype) return;
let df = this.df;
if (this.frm && this.frm.doctype !== this.df.parent) {
// incase of grid use common df set in grid
df = this.frm.get_docfield(this.doc.parentfield, this.df.fieldname);
}
// set values to fill in the new document
if(this.df.get_route_options_for_new_doc) {
frappe.route_options = this.df.get_route_options_for_new_doc(this);
if (df && df.get_route_options_for_new_doc) {
frappe.route_options = df.get_route_options_for_new_doc(this);
} else {
frappe.route_options = {};
}