Fetch value of parent doctype to custom doctype in Table format

@Tanuj A nice approach for this is

add a Python Hook event to the Customer based on “before_insert”, and the function will be this.

def before_insert_customer(doc, method=None): 
    if doc.lead_name:
        for contact in frappe.get_all("Contact", {"lead": doc.lead_name}): 
            frappe.db.set_value("Contact", contact["name"], "lead", self.lead_name)

Every time that you convert a lead to a customer it will track the contacts.

Do you can replace the event to “on_update” for every time too.

2 Likes