bohlian
February 19, 2017, 4:33pm
1
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
bohlian
February 20, 2017, 3:11am
3
@makarand_b I think it is possible, seems like a few of us could do it. Here is one:
I created a custom app to print Payin Slips from JV’s list view. To do so i needed to alter list js for JV.
Is there an existing way to add to list js of a doctype with out altering original/erpnext app files?
If not, can i raise a PR to add to list js via map in hooks.py?
eg usage for hooks approch.
doctype_list_js = {
"Journal Voucher": ["c_scripts/journal_voucher_list.js"]
}
jof2jc
April 14, 2017, 11:20am
4
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