original_docstring: If no Contact, create a new contact against Supplier. If Contact exists, check if email and user id set.
docstring: If no Contact, create a new contact against Supplier. If Contact exists, check if email and user id set.
docstring_tokens: If no Contact create a new contact against Supplier . If Contact exists check if email and user id set .
code: def link_supplier_contact(self, rfq_supplier, user):
  		"""If no Contact, create a new contact against Supplier. If Contact exists, check if email and user id set."""
  		if rfq_supplier.contact:
  			contact = frappe.get_doc("Contact", rfq_supplier.contact)
  		else:
  			contact = frappe.new_doc("Contact")
  			contact.first_name = rfq_supplier.supplier_name or rfq_supplier.supplier
  			contact.append('links', {
  				'link_doctype': 'Supplier',
  				'link_name': rfq_supplier.supplier
  			})
  			contact.append('email_ids', {
  				'email_id': user.name,
  				'is_primary': 1
  			})
  
  		if not contact.email_id and not contact.user:
  			contact.email_id = user.name
  			contact.user = user.name
  
  		contact.save(ignore_permissions=True)
  
  		if not rfq_supplier.contact:
  			# return contact to later update, RFQ supplier row's contact
  			return contact.name
code_tokens: def link_supplier_contact ( self , rfq_supplier , user ) : if rfq_supplier . contact : contact = frappe . get_doc ( "Contact" , rfq_supplier . contact ) else : contact = frappe . new_doc ( "Contact" ) contact . first_name = rfq_supplier . supplier_name or rfq_supplier . supplier contact . append ( 'links' , { 'link_doctype' : 'Supplier' , 'link_name' : rfq_supplier . supplier } ) contact . append ( 'email_ids' , { 'email_id' : user . name , 'is_primary' : 1 } ) if not contact . email_id and not contact . user : contact . email_id = user . name contact . user = user . name contact . save ( ignore_permissions = True ) if not rfq_supplier . contact : return contact . name
short_docstring: If no Contact, create a new contact against Supplier.
short_docstring_tokens: If no Contact create a new contact against Supplier .
comment: """If no Contact, create a new contact against Supplier. If Contact exists, check if email and user id set."""$SEP$# return contact to later update, RFQ supplier row's contact