Still running into a couple of issues with the Doctypes
The last script generates the following error on save
Which I think I’ve solved by adding tab infront of the child Doctype to give.
parent = doc.parent
child_table_data = frappe.db.sql("""SELECT expiry_date FROM `tabSupplier Certifications` WHERE parent = %s ORDER BY expiry_date ASC""", (parent), as_dict=1)
closest_date = None
closest_diff = None
today = frappe.utils.now_datetime().date()
for row in child_table_data:
date_column = row.get("expiry_date")
diff = abs((today - date_column).days)
if closest_date is None or diff < closest_diff:
closest_date = date_column
closest_diff = diff
parent_doc = frappe.get_doc("Supplier", parent)
parent_doc.set("iso_certification_expiry", closest_date)
parent_doc.save()
But on save I now get the following error
So have I not correctly specified the names of the Parent and Child DocTypes? Supplier None almost suggests that I have the right DocType but for some reason thinks I have not specified a record within that DocType.
Any ideas?

