How to remove Contact HTML from Customer and replace with Table

Is there any way of removing the contact_html from the Customer doctype?

I tried hiding it, but it still shows up.

I’ve managed to make a contacts table in the Customer doctype, and link it to my Leads doctype. (My Leads are Organization-centric, and not people-centric).

@Tanuj, currently no, because a table have a single field named parent to archive the relation, in the Contact and Address doctype, if you take a look in the doctype Contact, do you will see that Contacts and Address have fields to share it, between customers, suppliers and Sales Partners

Hi @max_morais_dmm

Thanks so much for the insight!

Can you please help me out linking the table values to the contact then?

As far as I understand, this is the code to be edited:

lead = frappe.db.get_value("Lead", self.lead_name, ["lead_name", "email_id", "phone", "mobile_no"], as_dict=True)

		c = frappe.new_doc('Contact')
		c.first_name = lead.first_name
		c.email_id = lead.email_id
		c.phone = lead.phone
		c.mobile_no = lead.mobile_no
		c.customer = self.name
		c.customer_name = self.customer_name
		c.is_primary_contact = 1
		c.flags.ignore_permissions = self.flags.ignore_permissions
		c.autoname()
		if not frappe.db.exists("Contact", c.name):
			c.insert()

My table for the contacts in Lead is a Custom Doctype with name Lead Contact, an exact duplicate of the Contact Doctype

Could you please help me out with this? What do I need to change in the code to get the proper link between the two documents?

Thank You so much!

EDIT: I tried changing “Lead” to “Lead Contact”, and the “lead_name” to “first_name”, but it didn’t seem to work.

Seems like an issue. Hide / unhide should be honoured. I think the js directly appends it to the wrapper element without caring for hide/unhide

@rmehta,

As per @max_morais_dmm 's reply, my approach to my goal was flawed, so I don’t need to hide the contact HTML anymore. But thank you for the update.

Could you also help me out with the code mentioned above?

Thank you so much!

@rmehta,

Is there any client side scripting I can do to fetch the data from my custom Child DocType “Lead Contact” under Lead, and push it to Contact HTML under Customer?

Thanks a lot!

@Tanuj any custom script that you put in Contact will work :wink: but take a look about how the contact html is made

this is the javascript https://github.com/frappe/erpnext/blob/97426776bd36c4236ad8dec75e66c6d64241d902/erpnext/public/js/utils.js#L108

this is the template https://github.com/frappe/erpnext/blob/06a82d4e1f98ee607bb86ae788b3d377439753f9/erpnext/public/js/templates/contact_list.html

This topic was automatically closed after 36 hours. New replies are no longer allowed.