DocType and custom "Link" field

I have a custom app with DocType My Doc and a custom field on a standard DocTypes, linking to My Doc. Custom fields are stored in the app as fixtures. When installing the app, fixtures get imported first, so it produces an error like “options for Link field must be a valid DocType”. Well, it is a valid DocType but it was not imported yet.

What can I do about this?

Hello,

Maybe, try to rename custom fields so it doesn’t get migrated. Let the new DocTypes get loaded first, and then get the custom fields back and migrate again.

Regards,

Ivan

1 Like

Hi,

Create the custom field in after_install hook of the Custom App.

Regards
@hrwx

1 Like

Thanks for your suggestions. Meanwhile i noticed that it works fine on a fresh site. It’s only a problem on a “polluted” existing site.