'If Customer created from Lead, update lead status to "Converted"
update Customer link in Quotation, Opportunity'

def update_lead_status(self):

    if self.lead_name:
        frappe.db.set_value(u'Lead', self.lead_name, u'status', u'Converted', update_modified=False)
        for doctype in (u'Opportunity', u'Quotation'):
            for d in frappe.get_all(doctype, {u'lead': self.lead_name}):
                frappe.db.set_value(doctype, d.name, u'customer', self.name, update_modified=False)
