Multiple Custom Scripts per DocType

Currently we can have only single Custom Script per DocType. It is fine for most of the cases.
Consider this- we extended a feature in erpnext that is a little bit big., and required by most of the customers., so instead of copying the modifications to each of the customer app, I think its best to save it as an app, so this feature can be deployed easily anywhere.

The custom scripts copied from app1 is overwritten by those from app2. This is because frappe is taking only single custom script per doctype. Currently the solution is to export customer specific code in fixtures, and manually copy paste app2’s custom script in a newline of the app1’s custom scripts, after deploying

Why didnt they do this ? development limitation ?
Or the way i am implementing the feature is wrong ?

Thanks :slight_smile:

1 Like

Instead of exporting custom script as fixture, try to create file for the custom script in the custom app.

Please check sample script and structure in the following repo.

hi @nabinhait
On looking the, i think it overwrites the script however I do it

Yes, you are right. Can you please fix this and send a pull request?

sure :slight_smile:


Is this issue fixed?

No actually, we found an alternate method to fix this.
We grouped features into multiple apps.,
in each apps, we used doctype_js hook to plug in our own custom code just like Custom Scripts.

1 Like