How to override erpnext javascript function?

erpnext.selling.doctype.sales_order.sales_order_list.get_indicator = function(doc) {


I have used this one but not working…
Anyone know about how to override

Hi there,

There’s no object called erpnext.selling.doctype.sales_order.

If you look at the source for the method you’re trying to override, you can see the object you’re trying to override:

The object is frappe.listview_settings['Sales Order'], and get_indicator is a property. So, it should work if you have code like:

frappe.listview_settings['Sales Order'].get_indicator = function(doc) {

If you give it a shot, please report back your results.

I want to change the status completed to Delivered in this function but in erpnext is working but in custom app it is not working::-

frappe.listview_settings['Sales Order'].get_indicator = function(doc) {
    if (doc.status === "Closed") {
        // Closed
        return [__("Closed"), "green", "status,=,Closed"];
    } else if (doc.status === "On Hold") {
        // on hold
        return [__("On Hold"), "orange", "status,=,On Hold"];
    } else if (doc.status === "Completed") {
        return [__("Delivered"), "green", "status,=,Completed"];
    } else if (!doc.skip_delivery_note && flt(doc.per_delivered, 6) < 100) {
        if (frappe.datetime.get_diff(doc.delivery_date) < 0) {
        // not delivered & overdue
            return [__("Overdue"), "red",
        } else if (flt(doc.grand_total) === 0) {
            // not delivered (zero-amount order)
            return [__("To Deliver"), "orange",
        } else if (flt(doc.per_billed, 6) < 100) {
            // not delivered & not billed
            return [__("To Deliver and Bill"), "orange",
        } else {
            // not billed
            return [__("To Deliver"), "orange",
    } else if ((flt(doc.per_delivered, 6) === 100) && flt(doc.grand_total) !== 0
        && flt(doc.per_billed, 6) < 100) {
        // to bill
        return [__("To Bill"), "orange",
    } else if (doc.skip_delivery_note && flt(doc.per_billed, 6) < 100){
        return [__("To Bill"), "orange", "per_billed,<,100|status,!=,Closed"];

    // console.log(":::::CUSTOM:::::me:::::",me);

Where have you put this code in your custom app?

To customize the list, you can make a new file in the doctype’s config folder and name it thedoctypename_list.js

True, though for an existing doctype like Sales Order, that customization would be wiped out on every update.

A better approach would be to include it in all desk js as a hook:

Ah ok… sorry, I thought it is for custom app doctype.
@peterg is correct.