Add js file in view

Hello,

could someone explain me steps to include js file in some view?
If i need to write app with doctype could you please provide me steps from the console line.

The tutorial explains lots for eg this Not Found

Another discussion that may help on embedded javascript for event handlers Learning Javascript for ERPNext

Thanks for reply @clarkej , this help me to understand many things but not what i wan’t. I need i custom script option for pos. I didn’t find thllmlerpnext. Second solution is acording to that what i read is creating app(doctype). Creating app for one script is not what i wan’t. Third solution is to work in core what is not good. There is also missing hooks for pos.
Conclution: too complicated for one.js integration. If you know some other way that i did’t mention please let me know.

Better informed folks have replied to you here [POS] Custom script in point of sale - #3 by vladucoju

I am somewhat of a novice and know only enough to be dangerous, so I will defer to those experts…

So … basically I know the partial answer to your question if you have a custom app .

Assume that you want to include … a JQuery plugin.

  1. To create the folder: myapp/myapp/public/js/whatevername.js

  2. Update hook.py , app_include_js = “/assets/newmatik/js/whatevername.js”

  3. Paste the code from the plug into whatevername.js

  4. bench build and BOOMMM , plugin is now available to to desk …

3 Likes

How can i make that sales order load myfile.js without using custom script in backend, or to add buton without using custom script?

Please create myfile.js in public->js->myfile.js and add that file to
doctype_js = {“Sales Order” : “public/js/myfile.js”} in hooks.py
you can write javascript code in myfile.js

1 Like