I have two child tables in same doc type. I want to fetch start date and end date from on child table to other. Is it possible? which script i can use?
You can view do by this script
frappe.ui.form.on("[CHILD_TABLE_TARGET_DOCTYPE]", {
[CHILD_TABLE_LINK_FIELD]: function(frm, cdt, cdn) {
var row = locals[cdt][cdn];
if (row.[CHILD_TABLE_LINK_FIELD]) {
frappe.model.with_doc("[SOURCE_DOCTYPE]", row.[CHILD_TABLE_LINK_FIELD], function() {
var doc = frappe.model.get_doc("[SOURCE_DOCTYPE]", row.[CHILD_TABLE_LINK FIELD]);
$.each(doc.[SOURCE_DOCTYPE_CHILD_TABLE] || [], function(i, r) {
if(r.[SOURCE_CHILD_TABLE_FIELD] == frm.doc.[TARGET_PARENT_DOCTYPE_FIELD]) {
var df = frappe.meta.get_docfield("CHILD_TABLE_TARGET_DOCTYPE","[TARGET_CHILD_TABLE_CUSTOM_FIELD]", frm.doc.name);
df.options += ["\n" + r.[TARGET_CHILD_TABLE_CUSTOM_FIELD]];
}
})
});
frm.refresh_field("[TARGET_DOCTYPE_CHILD_TABLE]")
}
}
});
for more information visit Community Developed Custom Scripts · frappe/erpnext Wiki · GitHub