How to put all the customization into a new application.Easier when erpNext needs to be updated later

How to put all the customization into a new application.Easier when erpNext needs to be updated later.

Create a custom app “my_company”

bench new-app my_company

Edit the file hooks.py in your app to specify everything you want to export. For example, “Custom Field” will export all additional fields yo added to any DocType.

# hooks.py
# ...
fixtures = [
    "Custom Field",
    # add more here
]
# ...

Now, run the following to be actually export the fixtures.

bench export-fixtures --app my_company

This will write your customisations into files in your custom app. Now all that’s left is to add the files to version control. In your app’s directory, run the following:

# initialize a git repo, if you didn't already
git init
# add and commit changes
git add .
git commit -m "feat: bench export-fixtures"


Can I add fields, forms, doctypes here?Can I add anything I want

You can only add DocTypes, but in ERPNext almost everything is a DocType, even custom fields.

1 Like

Thank you for your help

Is there any documentation on this?I can look it up myself

I dug into this issue quite deeply a few months ago.

Possibly this will help:

So if i wrote custom script on sales invoice in my custom app then I added ‘Custom Script’ To fixture dictionary in my custom app hooks, then it will be exported to my site also?

Yes you can add it like this

{ “doctype”: “Custom Script”, “filters”: [ [“name” , “in” , ( “Sales Invoice-Client” )] ] }

1 Like

Great Thank you

Custom Script is not recommended to be exported as a fixture if you already have a custom app, as mentioned here: