Does not have doctype access via role permission for document Print Format

i have add print button then add this code to it


but when i print by any user have permission to this doctype the black print run but the red print not

i get this error

User *** does not have doctype access via role permission for document Print Format
User *** does not have access to this document

use it in print_payment_voucher and check it.

ignore_permissions=True
1 Like


this is my code
add it in line 18 ?!
@NCP

doc.save(ignore_permissions=True)

it worked
after restart the service in production mode
thx for your help @NCP
or i solved it by this