List view not working

Hi ,
i gave the workflow my own doctype…it’s working properly and also i gave some states in list.js …it’s not working pls any one help me…thanks for advance

please share the code in list.js and somebody will be able to help you out. also if there are any errors post screenshots or traceback

frappe.listview_settings['Deviation'] = {
    add_fields: ["status", "over_all_feedback"],
    get_indicator: function(doc) {
        //        console.log(doc);
        console.log("out");
        if (doc.status === "Feedback Requested") {
            return [__("Feedback Requested"), "red", "status,=,Feedback Requested"];
        } else if (doc.over_all_feedback === "Completed") {
            return [__("Feedback Received"), "green", "status,=,Feedback Received"];
        }

    }
};

thanks for rly…i don’t know what is the pblm in my code pls any advice

Have you added a hook to this file?

If not, open hooks.py for your app and add:

doctype_list_js = {"Deviation" : "path/to/your/file.js"}
1 Like

Any solution on this?, I having the same Issue

your doctype “Is Submitable” checkbox enable?

yes it is enable

If ‘Is Submitable’ enable list view function working after submit the record.

I didn’t understand. Can you please explain it more?

you done hooks file and list.js it’s rgt? i trying to said the list.js function not called when ‘Is submitable’ check box enable, it’s working only after submit the record(it means docstatus = 1). If is submitable not checked it’s working fine pls try

in Hook.py:

doctype_list_js = {"test" : "hr/doctype/test/test_list.js"}
doctype_js = {"test" : "hr/doctype/test/test_list.js"}

in test_list.js:

frappe.listview_settings['test'] = {
 refresh: function(frm) { 
	 console.log("refresh");
 },
 	get_indicator: function(doc) {
 		console.log("get_indicator");
 		if(doc.docstatus==1) {
 			return [__("Approved By Employee", "green", "workflow_state,=,Approved By Employee")]
 		}
 }
};

the refresh console log is printed but console log get_indicator not print , why??

becoz ur record did not submit.when ur record reach docstatus == 1 then only inside get_indicator console, refresh console log to replace console.log(frm.doc.docstatus); and tell me what’s print in console

when I replace console.log(frm.doc.docstatus)

frappe.listview_settings['Test'] = {
 refresh: function(frm) { 
	 console.log(frm.doc.docstatus);
 },
}; 

I get error
TypeError: Cannot read property 'docstatus' of undefined

I replace it with
console.log(cur_frm.doc.docstatus);

and I get error
TypeError: Cannot read property 'doc' of null

pls try to change the args and check once again for submitted record
refresh: function(doc) {
console.log(doc.docstatus);
}

console.log(doc.docstatus);
Print undefined

console.log(frm.doc.docstatus);
get Error
ReferenceError: frm is not defined

i)console.log(doc.docstatus); this console pls see submitted records(it’s must print)
ii)console.log(frm.doc.docstatus); to remove frm like
console.log(doc.docstatus);
iii)ur function only call docstatus ==1 otherwise this function not working
get_indicator: function(doc) {
}

how can I solve it?

get_indicator trigger why is call in submitted doc??

becoz u r select is submitable check box tat y it’s not call function…if u want list view to remove is submitable check otherwise list view function (get_indicator: function(doc) {)working after submission records.

how frm.doc will work? it is only for single form. you are using this in list view page thats y u got “”“Cannot read property ‘docstatus’ of undefined”"".
just print console.log(frm) then you will get some idea based on result