@@ -539,15 +539,16 @@ def _allocate_payment_request_to_pe_references(self, references):
539539def make_payment_request (** args ):
540540 """Make payment request"""
541541
542- frappe .has_permission (doctype = "Payment Request" , ptype = "write" , throw = True )
543-
544542 args = frappe ._dict (args )
545543 if args .dt not in ALLOWED_DOCTYPES_FOR_PAYMENT_REQUEST :
546544 frappe .throw (_ ("Payment Requests cannot be created against: {0}" ).format (frappe .bold (args .dt )))
547545
548546 if args .dn and not isinstance (args .dn , str ):
549547 frappe .throw (_ ("Invalid parameter. 'dn' should be of type str" ))
550548
549+ frappe .has_permission ("Payment Request" , "create" , throw = True )
550+ frappe .has_permission (args .dt , "read" , args .dn , throw = True )
551+
551552 ref_doc = args .ref_doc or frappe .get_doc (args .dt , args .dn )
552553 if not args .get ("company" ):
553554 args .company = ref_doc .company
@@ -821,7 +822,7 @@ def get_print_format_list(ref_doctype):
821822 return {"print_format" : print_format_list }
822823
823824
824- @frappe .whitelist (allow_guest = True )
825+ @frappe .whitelist ()
825826def resend_payment_email (docname ):
826827 return frappe .get_doc ("Payment Request" , docname ).send_email ()
827828
0 commit comments