Suppose I have created two j’s files (production_or.js, sales_or.js) and we need sales_or.js include only ‘new sales order page’ and production_or.js include only Production order page.
Suppose I have written function (test_length) in ‘sales_order. js’ file and when we open “Production Order page” then test_length will call. How we can restrict js file load on a particular page.
Yea, thats why we have doctype_js hook.
If you specify a js file with that hook for Sales Order doctype, it will be run only when Sales Order document is open, and wont be executed when any other doctype is opened.
Pls refer the link I have given in my last answer.