ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Show or hide column base on condition


Hi I’m trying to hide a certain column base on a condition. I have tried what I saw on the old thread Show or hide columns child table but doesnt work for me.

My code:

frappe.ui.form.on("Purchase Invoice", "onload", function(frm) {
	console.log('>>> ONLOAD <<<');

var df = frappe.meta.get_docfield("Purchase Invoice Item","sales_order",;
    	df.in_list_view = 0;

    	cur_frm.fields_dict.items.grid.set_editable_grid_column_disp("sales_order", false);
    	cur_frm.fields_dict.items.grid.set_editable_grid_column_disp("set_column_disp", false);

    	frm.set_df_property("sales_order", "read_only", 0);
    	frm.set_df_property("sales_order", "in_list_view", 0);



Hi @johnskywalker I guess that you can use this

cur_frm.fields_dict.items.grid.fields_map. sales_order.hidden = 1;


Dear @johnskywalker

Did you achieved column hiding?