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?
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?
Create new app e.g. - bench get-app library_management
Install new app into your site e.g. - bench --site erpnext.vm install-app library_management
Customize your form and ensure that the module name is changed to your app name e.g. - library_management
Open file hooks.py using a text editor, such as “vi” from the location e.g. - ~/frappe-bench/apps/library_management/library_management/hooks.py
At the end of the hooks.py 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.
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.
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.
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.
You then run the command to export-fixtures:
if you have single site
if you are multi-tenant
bench --site <> export-fixtures
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