Hi! I am trying to insert new record to a custom childtable in a custom doctype but I am having some trouble on inserting and submitting the child table through python. I tried different approaches like (doc.save() approach), still having the same error. Below is the code I am working with and also the error as image. Would really love to hear your thoughts on this.
def insertChildWWRS(doctype, parent_wwrs, customer, delivery_note_item, delivery_note, driver, date, vehicle):
checkWWRS = frappe.db.exists({
'doctype':'Warehouse Withdrawal and Return Slip',
'wwrs_driver':driver,
'wwrs_plate_number_placeh': vehicle,
'wwrs_date': date
})
for x in range(len(delivery_note_item)):
doc = frappe.get_doc("Warehouse Withdrawal and Return Slip", checkWWRS[0][0])
childDict = {
"outbound_customer": customer,
"outbound_item": delivery_note_item[x].item_name,
"outbound_qty":delivery_note_item[x].qty,
"outbound_delivery_note": delivery_note
}
doc.append("outbound_cylinders", childDict)
doc.insert()
doc.submit()
Error