Doctype list Hook not Running

Am trying to hook to the Sales Order doctype list to modify the layout of the listview.

Modified my hooks.py in my custom app and added:

doctype_list_js = {
  "Sales Order": ["assets/myapp/js/sales_order_list.js"]
}

then I added a file in /apps/myapp/myapp/public/js.

Ran bench build and ran supervisorctl reload but the list view remains the same. Its as though the js didnt get hooked. Any ideas? Did i miss something?

@bohlian,

Currently, this is not possible, Although you can change the listview fields using In List View property.

doctype_list_js is not a valid hook to include your js files. If you wish to include the js file please use app_include_js.

Thanks,
Makarand

1 Like

@makarand_b I think it is possible, seems like a few of us could do it. Here is one:

run bench migrate or bench restart first if you’re in production mode

The solution to this problem is to specify the public folder for the JS file location. For example, if your list.js is located in custom_app/custom_app/public/js directory.
Write it as

doctype_list_js = {"Sales Order": "public/js/list.js"}

instead of

doctype_list_js = {"Sales Order": "/assets/custom_app/js/list.js"}

and do bench restart too