Custom DocPerms Removed After Migration - Need Assistance

Hello Frappe/ERPNext community,

I’m facing an issue where custom DocPerms are unexpectedly being removed after a migration process.

  • Frappe Version: 14
  • ERPNext Version: 14

In Role Permission Manager i have added permission for vehicle doctype

Permission has been added to Custom DocPerm

i did fixtures next as you can see below its added

next i run bench --site [SiteName] migrate

the permission has been removed from Custom DocPerm

What could be the problem?

1 Like

Dear @Masky ,
The correct way to solve this is adding permision inside doctype settings. If that is not possible for you then you add customdocperms inside your hooks. For Ref…

The “Vehicle” doctype is part of the ERPNext > Setup module, and I don’t want to modify the core files. Consequently, I attempted to add it to the Custom DocPerm. However, after each migration, the permission for it was consistently being removed.

I have successfully resolved the problem, and I would like to share the solution for the benefit of others encountering a similar issue.

The root cause of the problem was identified in some customizations of the vehicle doctype. It turns out that in a previously exported file, the new permissions were missing. During the migration process, Frappe checked this file for permissions and removed the missing ones, leading to the observed behavior.

I revisited the exported file, ensured that it included the necessary permissions for the vehicle doctype, and then re-ran the migration. This resolved the issue, and the custom DocPerms are now retained as expected.

Hey @ErpnextRaja ,
Just wanted to drop a quick thank you for your advice on handling custom DocPerms during migration.

1 Like