How to hide the create a new user option in child table.i only need to select this field
its not working for child table field
Sometimes, does not always apply the parent logic in child table, some has a limitation. if you want then apply it but it will only work when you select the add row button, it does not work on the first row if the first row has already added.
Please check the syntax:
frappe.ui.form.on('Child Table DocType', {
childtablename_add: function(frm, cdt, cdn) {
var child = locals[cdt][cdn];
frm.set_df_property('child_table_name', 'only_select', true, frm.docname, 'your_link_field_name', child.name);
frm.refresh_field('child_table_name');
}
});
// Example:
frappe.ui.form.on('Sales Invoice Item', {
items_add: function(frm, cdt, cdn) {
var child = locals[cdt][cdn];
frm.set_df_property('items', 'only_select', true, frm.docname, 'item_code', child.name);
frm.refresh_field('items');
}
});
1 Like
@NCP I have used to hide but this script is not working . i was verify twice
all table name and field name is ok ?
Can you please check . and i have add a new row .
frappe.ui.form.on('Opportunity Item', {
items_add: function(frm, cdt, cdn) {
var child = locals[cdt][cdn];
frm.set_df_property('items', 'only_select', true, frm.docname, 'bom', child.name);
frm.refresh_field('items');
}
});
I have to put this script inside the Parent doctype . that one is opportunity.