How to set link formatter in case of indicators?

Hi there,

in Sales Order Item, the iten field show the indicator based on qty available; in this case it show item code only, see:

How to set item_code : item_name together with indicator?

@JoEz,

You can replace the item_code with item_name, please check the following

Hi @makarand_b ,

i tried your hint, but it seems not working on Purchase Order see my custom script:

frappe.ui.form.on("Purchase Order", {
	onload: function (frm) {
		frm.set_indicator_formatter('item_name',
			function (doc) { return (doc.stock_qty <= doc.delivered_qty) ? "green" : "orange" });
	}
});

I tried either passing a custom get_text function, but it seems script is loaded before the one in original onload script:

frappe.ui.form.on("Purchase Order", {
	onload: function (frm) {
		frm.set_indicator_formatter('item_code',
			function (doc) { return (doc.stock_qty <= doc.delivered_qty) ? "green" : "orange" },
			function (doc) {
				if(doc && doc.item_name && doc.item_name !== doc.item_code) {
					return doc.item_code ? doc.item_code + ': ' + doc.item_name : doc.item_name;
				} else {
					return doc.item_code;
				}
			}
		);
	}
});

Any hint?

@JoEz,

The second custom script should work fine. Please check if there is any error in the console

@makarand_b not getting any error on console, it seems that formatter in purchase_order.js is called after the one in custom script.

Can’t understand what’s wrong, can someone double check it?

Thx

Instead of Onload try on Refresh …works for me for the Green or Red