frappe.ui.form.on(‘Stock Entry’, {
refresh: (frm, cdt, cdn) => {
let doc = locals[cdt][cdn]
// console.log(doc)
// console.log(frm.doc.purpose===‘Material Transfer’)
frm.fields_dict[“items”].grid.set_column_disp(“source_warehouse_storage_location”, frm.doc.purpose ===‘Material Transfer’);
}
})
im trying to hide/show the child doctype fields based on stock entry type but it is not working.
P.S - I have a doctype js hook so the code is in my custom app not client script but anyways i check through client script it didnt work even then.
ERPNext: v13.19.0 (version-13)
Frappe Framework: v13.19.0 (version-13)
tried this but it works only before form is loaded
@OmarJaber this is working but it works only during setup,onload, refresh events my requirement is i need this field based on some conditions suppose from stock entry pupose and stock entry detail warehouse selected so if there is workaround so that I can use df even in child table fieldname events it would be very helpfull for me
Thank you
I’ve struggled with this too. The best solution I found came from this post. Using Sagar’s example, I’ve been able to trigger on refresh() events, and hide/show columns using some logic.
To hide grid columns using custom script, you can call this function at your desired event:
function removeColumns(frm, fields, table) {
let grid = frm.get_field(table).grid;
for (let field of fields) {
grid.fields_map[field].hidden = 1;
}
grid.visible_columns = undefined;
grid.setup_visible_columns();
grid.header_row.wrapper.remove();
delete grid.header_row;
grid.make_head();
for (let row of grid.grid_rows) {
if (row.open_…
@brian_pond thank you let me try this out.
This did not work it worked fine in version 12 but then again version 13.19.0 its the same problem unable to hide fields on child table.
NCP
February 25, 2022, 12:36pm
8
Hi @Yashwanth ,
Please try in Depends On / Read Only Depends On permission
eval: parent.stock_entry_type == “Material Transfer”
OR
eval: parent.stock_entry_type != “Material Transfer”
Thanks!
i want it in script which user should not be able to see so, is there any other way
Thank you