Patches should run after importing fields


I had just created some custom fields and made a file for those fields in fixtures. But the problem is that if I have a custom patch which calls those custom fields then the system fails to update on bench update.

This is primarily due to the reason that the patches are applied before importing the fixtures.

I would like to know whether it would not be good to first import the fixtures and then apply the patches. Kindly please let me know how should I resolve this problem when a patch would refer to the custom fields.

1 Like

Aditya you can do this in your patch:

from frappe.utils.fixtures import sync_fixtures
1 Like

Thanks Alot, works like charm.