ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

How to add custom script files in custom app?

customization

#1

I have make some custom script under fixture folder in custom app.
Like
fixtures/Purchase Receipt.js
fixtures/Purchase Order.js

But it’s not working. How can i add the custom script files with my custom application? I have seen https://github.com/frappe-apps/rigpl-erpnext . Here he didn’t add anything in hooks.py file.

So how is this custom script working?


Overwriting Student Attendance Tool
Custom app to change core frappe files
#2

Have you tried to bench migrate ?


#3

Sorry, @munim

Your issue that you dont have the correct file structure… Assume that you app in called “MYAPP”

myapp/myapp/fixtures/custom_scripts/

You are missing the custom_scripts folder.
Also after any change you need to run bench migrate

47


#4

Hi munim

edit hooks.py of your app

   doctype_js = {
        "Purchase Receipt": "custom_scripts/purchase_receipts_custom.js",
        "Purchase Order": "custom_scripts/purchase_order_custom.js"
    }

If not edit hooks.py

You must copy these scripts into custom script page

/desk#List/Custom Script/List


#5

Thanks, after giving bench migrate, it’s working now.

Finally i have done

  1. In hooks.py i have added
    doctype_js = {
    “Purchase Receipt” : “custom_scripts/Purchase Receipt.js”,
    }
  2. I have made the file path myapp/myapp/fixtures/custom_scripts/ Assume that my app in called “MYAPP”
  3. At last bench migrate.

Thanks @kickapoo and @vinhnguyent090


#6

@munim I just want note (and for others that will check this setup), It is not necessary to have anything to hooks.py if you use the correct path “myapp/myapp/fixtures/custom_scripts/.js”


#7

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)