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"]
}
Hi, are there any updates on this issue?
Or maybe some workaround?
Thanks.
@M_Tri_R, @BhupeshGupta, you can use in the client-side frappe.require
in the event onload
@max_morais_dmm ,Hi Max, thanks for reply,
can you give me simple example ?
Where is this frappe.require?
@M_Tri_R, in the javascript
frappe.require([
"assets/my_app/js/some_js.js",
"assets/my_app/css/some_css.js"
]);
dont forget for it work properly do you need create a public folder in your project with the “js” and “css” folders inside, and run the bench build
before the first run.
1 Like
@max_morais_dmm, and where is the part to hook the js to list view?
Ok, let me rephrase my question,
I need to add a new menu to Item List from ERPNext, in order to do so I need to add a new item_list.js,
but I want to do it without altering original/erpnext app files if possible.
Oh, nevermind, using
doctype_list_js = {
“Item”: [“custom_scripts/item_list.js”],
}
in hooks actually work
thanks.
@M_Tri_R, yes is possible but do you need do it in hooks.py of you app
add in hook something like this
doctype_js = {
"DocType": [
"path-to-file.js"
],
}
doctype_list_js = {
"DocType": [
"path-to-file.js"
]
}
2 Likes
This topic was automatically closed after 24 hours. New replies are no longer allowed.