Hi dear ,
iam facing error in this line pe.insert(ignore_permissions=True) , i want guest to insert payment entry this is for payment gateway purpose.
sales_invoice = "SINV-00055"
doc = frappe.get_doc('Sales Invoice', sales_invoice)
pe = frappe.new_doc("Payment Entry")
pe.flags.ignore_permissions = True
pe.payment_type = "Receive"
pe.posting_date = doc.posting_date
pe.mode_of_payment = "Credit Card"
pe.paid_to = frappe.db.get_value("Mode of Payment Account", {"parent": "Credit Card"}, "default_account")
pe.party_type = "Customer"
pe.party = doc.customer
pe.paid_amount = doc.outstanding_amount
pe.allocate_payment_amount = 1
pe.letter_head = doc.get("letter_head")
pe.received_amount = doc.outstanding_amount
pe.append("references", {
'reference_doctype': "Sales Invoice",
'reference_name': doc.name,
"due_date": doc.posting_date,
'total_amount': doc.outstanding_amount,
'outstanding_amount': 0,
'allocated_amount': doc.outstanding_amount
})
pe.reference_no = "123123"
pe.reference_date = frappe.utils.today()
pe.setup_party_account_field()
pe.set_missing_values()
pe.insert(ignore_permissions=True)
# frappe.db.commit()
# pe_doc = frappe.get_doc('Payment Entry', pe.name)
# pe_doc.submit()
# frappe.db.commit()
return pe.name
thanks in advance
best regards,