There are many bugs and inconsistencies when it comes to Permissions.
Firstly, there are 2 different ways of defining Role Permissions,
1 In DocType > Settings > Permission Rules
2 In Role Permissions Manager
But, beware of this caveat, especially if you reference a custom Role Profile: Both are independent of one-another, ie a Permission set in the DocType does not reflect in the Role Permissions Manager, and vise versa.
However, I cannot for the life in me figure out which is ultimately in effect since it seems to depend on various conditions such as:
Is the DocType a custom doctype defined with Custom? : Y or N. If N, then the DocType definition is part of the app’s file collection on the File System. If Y, then the DocType definition is in the Database.
I normally only export fixtures for definitions in the Database, since any definition on the file system will migrate just fine.
I’d love to hear what you’ve learned about these inconsistencies and whether we can put heads together to figure out how this works.