Export document link as fixture

Hi all,

is there a way to export a new link (showing in the connections of a doctype) that I added via customize form, so that it gets imported on installing my app into another instance?

I am on frappe 14.

Thanks!!

You just have to add the new links in the linked document section of the customize form and click on export customizations.
This should create a json file with the modifications in the module you choose and will be installed in a new instance.

The customization are exported, but on running migrate command, the document links are not created.

Hello,

It should be enough to export from ‘custom’.
Select the app to associate, this will create a directory named ‘custom’ in your app’s directory.
image

Also, make sure to check the created directory named ‘custom’.

image

If you are using Git, make sure to apply the changes, and then run a bench migrate .

You can also do it with hook.py
Fixtures are defined in the hooks.py file of your application. To add a fixture, you need to edit this file and add an entry to the fixtures list. For example:

fixtures = ["Custom Field", "Property Setter", "Custom Script", {"dt": "DocType", "filters": [["name", "in", ["Sales Invoice", "Customer"]]]}]

This configuration will export custom fields, property setters, custom scripts, and specific document types “Sales Invoice” and “Customer”.

Exporting Fixtures: To export fixtures, use the console command bench export-fixtures. This command will look for the fixtures configuration in your hooks.py and export the corresponding data to JSON files within your application, in the fixtures directory.

Migrating Fixtures to Another Site: Once exported, these JSON files can be used to migrate data to another site. For this, you need to move your application with the fixtures to another Frappe site and then execute bench migrate. This will import the fixture data into the new site.

Version Control: It is advisable to keep the fixtures files under version control (such as Git) to track changes and facilitate deployment in different environments.