Hi,
I have doctype “MYDOCTYPE” it has child table “MYCHILD TABLE” and i submitted the doc and i want to update the child table of MYDOCTYPE when ever i submit payment entry.
in payment entry i wrote this code in payment entry on submit function
if self.references:
for reference in self.references:
if reference.reference_doctype == "MY DOCTYPE":
ohb = frappe.get_doc("MY DOCTYPE",reference.reference_name)
if not ohb.update_dueamount(reference.reference_name,reference.allocated_amount,self.paid_amount,self.name) :
frappe.throw("Paid Amount Is Greater Than Due Amount Of Hotel")
in MY doctype i wrote function update_dueamount
oph = frappe.get_doc("MY DOCTYPE",self.name)
oph.append("my_chidtable",{
'payment_no' :payment_no,
'date_of_payment' :today(),
'paid_amount' :amount_paid,
'out_standing_amount' :due_amount,
'reference_name' :"Payment Entry"
})
oph.insert()
oph.submit()
but when ever i submit payment entry i got this error
and i also tried this in update dueamount
oph = frappe.new_doc("Payment History")
oph.payment_no = payment_no
oph.parent = hotel_booking
oph.parentfield = "my_childtable"
oph.parenttype = "MY DOCTYPE"
oph.paid_amount = amount_paid
oph.out_standing_amount = due_amount
oph.date_of_payment = today()
oph.save()
but after submitting payment entry i get this
when ever i submit payment entry i get 1 for every row number instead of incrementing
can any one please help me