Convert Lead to Supplier

I’m in a business where I buy and sell bulk material from businesses and the general public. The people that I sell to are a small number and generally don’t change. What I’m interested in is how I can go about tracking relationships with the people/businesses that I buy from. I have a list of what I’ll call leads, because they’re people that I want to reach out to, build a relationship, and do business with. But I’m buying from these people. I can’t convert leads to suppliers.

Is there an easy way to modify erpnext to allow a lead to be converted to a supplier?

It’s doable. The easiest way is a client script that creates the supplier before save the lead …

Something like this:

frappe.ui.form.on('Lead', {
	before_save(frm) {
	    if (!frappe.db.exists('Supplier', 'cur_frm.doc.first_name'))
			frappe.db.insert({
                doctype: 'Supplier',
                supplier_name: cur_frm.doc.first_name,
                supplier_group: 'Distributor'
            });
	    }
    })

This will need some adjusts to assign proper data from lead in the proper fields of the new supplier record … The script checks if supplier exists before create it again …

Hope this helps.

The poster mention “to convert” so maybe he wants is change later on, not when creating Lead.
For this, in the Lead doctype, you can use a button (to run the script to create the supplier) or a check fieldtype (“this Lead is Supplier” and save with the same code - add condition).

1 Like

Yeah! Thanks for the point. The meaning of “convert” is the question!