How to make payment entry form user created doctype

I have a doctype name mydoctype i want to create a payment entry as draft when i submit mydoctype and payment type should be pay i have tried below code but when try to submitt mydoctype

i get this error Received Amount is mandatory

but my payment type is “pay”

what i have i tried is

in before save method is

hotel = frappe.db.sql(""" select name,hotel,total_amount,amount_paid,due_amount from`tabHotel Booking` where name='{0}'""".format(name))
ope = frappe.new_doc("Payment Entry")
ope.payment_type = "Pay"
ope.posting_date = today()
ope.party_type = "Supplier"
ope.mode_of_payment = "Cash"
ope.paid_from = "Cash - S"
ope.paid_to = "Creditors - S"
ope.paid_to_account_currency = "BHD" = "XXX"
ope.paid_amount = 1000 = "MY Party"
ope.party_name = "My Party"
ope.docstatus = 0
ope.party_account_field = "paid_to"
ope.party_account = "Creditors - S"
ope.recieved_amount = 1000

Both the amount (paid and received) are required. For reference, please check erpnext/ at develop · frappe/erpnext · GitHub

1 Like

@nabinhait thanks