ERPNext Conference 2019* ERPNext.com Blog

How to change name for "Status" column in list view

customization

#1

Hi all,

I’m adding listview_settings for a doctype, in order to change indicators color.

By default column name is showed as “Status” …how to change that name?


#2

Can you share a screenshot or something. I think “Status” is docstatus (Draft, Submitted, Cancelled etc)


#3

@rmehta

scarto_reparto_list.js:

frappe.listview_settings['Scarto Reparto'] = {
	// add fields to listview
	add_fields: ["refuse_type"],

	get_indicator: function (doc) {
		return [__(doc.refuse_type), {
			"Frutta": "orange",
			"Verdura": "green",
		}[doc.refuse_type], "refuse_type,=," + doc.refuse_type];
	}
};

result:

I’d expect Refuse Type column name instead of Status, but probably it’s “hard coded” somewhere …


#4

After some research in the code that build the header of the list views, I concluded that for some reason Frappe isn’t pick up the “Status” label translation. I think this happen because that label is a variable, not a string.


So, in order to fix it (temporary at least) you need to do a couple of things:

  • First, adding this to your scarto_reparto_list.js
frappe.listview_settings['Scarto Reparto'] = {
	// add fields to listview
	add_fields: ["refuse_type"],

	get_indicator: function (doc) {
		return [__(doc.refuse_type), {
			"Frutta": "orange",
			"Verdura": "green",
		}[doc.refuse_type], "refuse_type,=," + doc.refuse_type];
	}
};

__("Status");  // Enabling to Frappe to pick up the translation of the "Status" word.
  • Save the file
  • Go to Home > Customize > Custom Translations and add the translation for “Status” word in your language.
  • Run bench --site all clear-cache after reload the page.

That’s all, it works ok for me in Frappe V12.