Try ERPNext Buy Support Partners Foundation

How to limit exported "custom field" to specific app

Does somebody know how to define the app a custom field belongs to?
Problem is in my case, on export-fixtures, I export all existing custom fields to my custom app. I’d like to limit these to only the app specific custom fields.

Any ideas how to do it?

Thank you

If you don’t mind editing the Custom Field doctype, you could in principle set something like this up using the filter parameter on the export fixtures command.

In practice, though, that’s a lot of work (maintaining the fork, etc.). A more typical workflow would just use an app-specific development site, without non-app custom fields. Alternately, you could export the customizations from the Customize Form tool and then just manually edit out the fields you don’t want included.

I see, thanks for the confirmation.

The solution with a pure developer instance can be cumbersome, because in order to do development and testing, often other modules are required. …

Probably I’ll add a custom field, something like the “Module” field in doctypes. That’ll be the cleanest way.


Bummer, “Custom Field” cannot be extended with custom fields.

I’ll misuse the description field for that purpose.

However, wouldn’t it be nice to have the discussed function in the Core?

This would also help with removing custom fields on app uninstall (right now we always need to update the system for that) …

You can write filters for which particular doctype you want to export for.

Yea, you’re right.
But in this case the problem is that I want to collect all custom fields belonging to a particular app.
These can create fields in various standard/custom doctypes. So the doctype in this case gives no clue to which app the custom field or script belongs.

Actually I think this would be a very helpful extension for the Core function (similar to doctype module field).

Here an example:
App 1:
|__ custom_field “field_A” in “Purchase Order”
|__ custom_script to evaluate in Purchase Order

App 2:
|__ custom_field “field_B” in “Purchase Order”

When I now call "bench --site export-fixtures
All custom_fields (from App1 AND App2) will be exported to App1, because in the I cannot distinguish which custom_field belongs to App1 or not. The doctype is the same.

When I deploy App1 on a production server, all custom_fields will be deployed there: field_A and fieldB. Even though field_B is not related to App1.