How to set property of field in child table?
Ans: We can set property of doc fields using following syntax.
cur_frm.set_df_property(FIELDNAME, Property, Value);
e.g.
cur_frm.set_df_property("cheque_no", "reqd", doc.voucher_type=="Bank Entry");
We can also set property of fields in child table, which is the main reason for this post.
Syntax:
var df = frappe.meta.get_docfield("TABLE NAME","FIELDNAME", cur_frm.doc.name);
df.read_only = 1;
e.g.
var df = frappe.meta.get_docfield("Employer Project Details","company_name", cur_frm.doc.name);
df.options = ["Tech M", "Wipro", "TCS"];
Using above code, I have generated dynamic drop-down in child table field of Select type.
Reference:
http://sbkolate.blogspot.in
Thanks,
Sambhaji