Fixtures...don't know what it is

As a user I’ve seen the word Fixtures as part of installation process of ERPNext but also as a command on some forms of the application itself. I asumme after some changes on forms “Fixtures”, will apply (fix) them…

Is this relevant and if yes, is there some documentation about?

Many thanks

Camilo Correa
Happy implementing ERPNext


Fixtures are to migrate data / settings for new apps.

Edit: fixed link

edit: fix link again


Thank you so much Rushabh!

Allways happy learnig more every day about ERPNext.

broken link, please can you proivide the new one?

1 Like

How To Create Custom Fields During App Installation

edit: fix link again


Link broken again!

@aakvatech For your Reference:


Have gone through the link posted, and I see a need to have a more step by step document for a newbie. Should I post what I experienced as a user right here or is there a more appropriate place to share steps as per my experience?

Hi @aakvatech, it should be okay to post it here, I’ve found this thread through a simple search. And I think many others will find your experience useful if you’d be able to post it here. :slight_smile:

Probably the most canonical way would be to fork the frappe repo and submit a pull request :building_construction:

  1. Create new app e.g. - bench get-app library_management
  2. Install new app into your site e.g. - bench --site erpnext.vm install-app library_management
  3. Customize your form and ensure that the module name is changed to your app name e.g. - library_management
  4. Open file using a text editor, such as “vi” from the location e.g. - ~/frappe-bench/apps/library_management/library_management/
  5. At the end of the file you can add line
    fixtures = [“Custom Field”]
    I would also add other usual customizations such as “DocType”, “Custom Script”, “Property Setter”, “Print Format”.
    I can also use the same technique to add all setups that are done so that migrating setups from test to production and vice versa is easy.
  6. Run command “bench --site mysite export-fixtures” to export all mysite customizations where you have selected Module name as your app name e.g. - library_management. The *.json files will be stored in the location ~/frappe-bench/apps/library_management/library_management/fixtures.

I haven’t tried using github yet but have read that one could upload the changes on github, or as I did, you can download those json files and put it into another system that has the same app created, into the same fixtures folder and use bench --migrate to apply the customization onto those sites that has the application installed.



Hello @avinash_upadhya28

This should be bench new-app library_management

This is not clear, can you please explain?
For example, I need to customize the Task doctype which is existed in erpnext application, so how to change the module name to be same as the created application name which is in your example is library_management?

You need to add DocType to be part of the fixtures that need to be exported because you need to include the changes that was made directly to the DocType and not through the Customize Form?


Yes, this could be required depending, whether you are getting ready app or making a new one.

Customizing a doctype form is recommended. Changing base doctype will break the updates and will require you to do bench update --reset that will undo all your work directly done on base doctypes. I have done this mistake too many a times already. Export the customized form to your “library_management” app.

Like above, better customize the form, and export form to your cutom app.

Doctype of customized apps automatically get stored in the custom app/custom module/doctype directory and you have to git push it to your repository thereafter.

Hello @aakvatech

Thanks a lot for your kindly reply and help.

How? Can u explain the steps?
Do you mean export the fixtures or something else?
Where to be exported at the “library_management” app? At which directory?


  1. Set the developer_mode to 1 on server

  2. Customize the form for the doctype:

  3. Select your custom app you created, in this example it’s called Recharge

If you don’t have a custom export then you need to make a new one like you indicated earlier.

  1. You then run the command to export-fixtures:

if you have single site

bench export-fixtures

if you are multi-tenant

bench --site <> export-fixtures

  1. The file will be stored in the apps/recharge/recharge/recharge/custom/
    frappe@:~/frappe-bench$ ls apps/recharge/recharge/recharge/custom/
    journal_entry.json purchase_receipt_item.json sales_taxes_and_charges.json
    payment_entry.json purchase_receipt.json stock_entry_detail.json
    purchase_invoice_item.json sales_invoice_item.json
    purchase_invoice.json sales_invoice.json



Further to this, I have realized that having filters defined helps to maintain only specific fixtures to be exported e.g.:

fixtures = [“Custom Field”, “Custom Script”, “Property Setter”, {“doctype”:“Naming Series”, “filters”: [{“doctype”:“Daily Checklist”}]}, {“doctype”:“Notification”, “filters”: [{“is_standard”:0}]}, ‘Auto Email Report’, “Translation”, {“doctype”:“Print Format”, “filters”: [{“module”:“Oil Management Solution”}]}, {“doctype”:“Report”, “filters”: [{“module”:“Oil Management Solution”}]} ]


The data structure for fixtures is loosely defined by me as follows:
fixtures is a list of dictionary_objects:

fixtures = [object1, object2, objectN]

Each dictionary_object with filters contains:

*dictionary_object* = { "doctype":"*doctype_name*", "filters":"*list_of_filters*" }

doctype is self-explanatory, it is the DocType name you wish to export.

Each list_of_filters contains itself, a list_of_filter_criteria
The list_or_filter_criteria itself is a list containing:

*fieldname*, *operator*, (*value*)

Note that value is a Tuple!

*list_of_filter_criteria* = ["fieldname", "operator", ("Value1","Value2","ValueN", )]

So that:
“filters”: [list_of_filter_criteria]

For your convenience, these are the allowed operators:

Side note: I stumbled upon the operators during a traceback while running bench export-fixtures by using “not” and this was the message returned:

Operator must be one of =, !=, >, <, >=, <=, like, not like, in, not in, between, descendants of, ancestors of, not descendants of, not ancestors of, is```

This is a much needed explanation for filters. If anybody is using with filters, please bookmark this reply by @Tropicalrambler, it will be very helpful.