Add Column in tree view

Hi everyone,
I am trying to add another column or at the very least edit the existing warehouse tree column that states the balance in currency form. what I would like to do is change it to show Quantity and custom field Capacity.

What I tried to do is to edit the wawrehouse_tree.js

"> frappe.treeview_settings[‘Warehouse’] = {

	get_tree_nodes: "erpnext.stock.doctype.warehouse.warehouse.get_children",
	add_tree_node: "erpnext.stock.doctype.warehouse.warehouse.add_node",
	get_tree_root: false,
	root_label: "Warehouses",
	filters: [{
		fieldname: "company",
		fieldtype:"Select",
		options: erpnext.utils.get_tree_options("company"),
		label: __("Company"),
		default: erpnext.utils.get_tree_default("company")
	}],
	fields:[
		{fieldtype:'Data', fieldname: 'warehouse_name',
			label:__('New Warehouse Name'), reqd:true},
		{fieldtype:'Check', fieldname:'is_group', label:__('Is Group'),
			description: __("Child nodes can be only created under 'Group' type nodes")}
	],
	ignore_fields:["parent_warehouse"],
	onrender: function(node) {
		if (node.data && node.data.qty_after_transaction!==undefined) {
			$('<span class="balance-area pull-right text-muted small">'
			+ " " + node.data.qty_after_transaction
			+ '</span>').insertBefore(node.$ul);

		}
	}
}

Thanks everyone.

1 Like