def create_primary_contact(self): from erpnext.selling.doctype.customer.customer import make_contact if not self.supplier_primary_contact: if self.mobile_no or self.email_id: contact = make_contact(self) self.db_set("supplier_primary_contact", contact.name) self.db_set("mobile_no", self.mobile_no) self.db_set("email_id", self.email_id)
def make_contact_and_address(self, args, is_primary_contact=1): if any(field in args.keys() for field in ["email_id", "mobile_no"]): contact = make_contact(self) frappe.db.set_value("Contact", contact.name, "first_name", self.member_name) self.db_set("notification_contact", contact.name) self.db_set("notification_number", contact.mobile_no) if all(field in args.keys() for field in ["address_line1", "city"]): address = make_address(self) frappe.db.set_value("Address", address.name, "address_type", "Personal")
def create_contact(doc): if doc.get('mobile_no') or doc.get('email_id'): make_contact(doc)