Is there any event clicked when I select the ‘Create New Journal Entry’ link ?
Here is an example with Purchase Receipt Item where I send supplier to the batch quick entry form:
frappe.ui.form.on('Purchase Receipt', {
refresh(frm) {
var df = frappe.meta.get_docfield("Purchase Receipt Item","batch_no", frm.doc.name);
df.get_route_options_for_new_doc = function (field) {
return {
"item": field.doc.item_code,
"supplier": field.doc.supplier
}
}
}
})
6 Likes
Another way is to define a quick entry form, with your doctype name as prefix. Frappe will pick this one instead of the generic QuickEntryForm.
To access any fields from the calling doc, use frappe._from_link.doc
frappe.ui.form.BatchQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({
render_dialog: async function() {
this._super();
let doc = this.doc;
let calling_doc = frappe._from_link?.doc;
// do your stuff
}
});
1 Like
Great, thanks!!!
Will test this out. Both of your answers are solutions, but we can pick only one at a time