How to add Work Order List (work_order_list.js) from Custom app hook

I have created custom app for production, and wanted to add Work Order List (work_order_list.js) file using hooks.py but this not working.

Note: work_order_list.js file is in template/pages folder.

doctype_list_js = {
  "Work Order" : [ 
    "appname/templates/pages/word_order_list.js"
  ]
}

Did anyone came to the scenario.

Hello @avaiskhatri
First, is your js file placed correctly?
Second, do you have application named appname?
And third, what’s your js supposed to do? It is change the value of some field? Does the hook is right?

Hope this will help :slight_smile:

**edit
also did you typo on word it’s supposed to be work?

@antzforwork thansk for the input. Yes, I made a typo mistake here.

The code work perfectly fine when I override the existing file inside erpnext/manufacturing/doctype/work_order/

Since this folder is managed by erpnext repo, it will be override everytime when ever I update the erpnext. To make my changes intact I want to run work_order_list.js file from my app (as its managed by my repo).

Modified work_order_list.js file contains list based events.

So it is possible to run list.js file to manage other app’s doctype list based event from another app (file placed at custom location) ?

doctype_list_js = {
  "Work Order" : [ 
    "appname/templates/pages/work_order_list.js"
  ]
}

Yeps, it’s possible. Just add it in the hooks of your apps.
And also check if the trigger of your js is correct.

Here some documentation about from frappe about scripting custom js.
https://frappeframework.com/docs/user/en/api/form

What do you mean by trigger?

P.S: When the same js file is placed inside work_order insider erpnext repo, it works fine.

Store the work_order_list.js in custom_app/custom_app/public/js directory and modify the hooks as:

doctype_list_js = {"Work Order": "public/js/work_order_list.js"}

and don’t forget to bench restart