blob: 16ecd5180b2bb98f2cc79603c272983d5d0096f7 [file] [log] [blame]
Rushabh Mehta982be9f2017-01-17 17:57:19 +05301# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
2# License: GNU General Public License v3. See license.txt
3
4from __future__ import unicode_literals
5
6import frappe
7
8def create_test_contact_and_address():
Rushabh Mehtaa0c41b72017-01-18 14:14:20 +05309 frappe.db.sql('delete from tabContact')
Nabin Hait1aa8c2e2020-03-26 13:15:31 +053010 frappe.db.sql('delete from `tabContact Email`')
11 frappe.db.sql('delete from `tabContact Phone`')
Rushabh Mehtaa0c41b72017-01-18 14:14:20 +053012 frappe.db.sql('delete from tabAddress')
13 frappe.db.sql('delete from `tabDynamic Link`')
Rushabh Mehta982be9f2017-01-17 17:57:19 +053014
Himanshu25ab1e42019-09-30 10:08:15 +053015 frappe.get_doc({
16 "doctype": "Address",
17 "address_title": "_Test Address for Customer",
18 "address_type": "Office",
19 "address_line1": "Station Road",
20 "city": "_Test City",
21 "state": "Test State",
22 "country": "India",
23 "links": [
24 {
25 "link_doctype": "Customer",
26 "link_name": "_Test Customer"
27 }
28 ]
29 }).insert()
Rushabh Mehtaa0c41b72017-01-18 14:14:20 +053030
Himanshu25ab1e42019-09-30 10:08:15 +053031 contact = frappe.get_doc({
32 "doctype": 'Contact',
33 "first_name": "_Test Contact for _Test Customer",
34 "links": [
35 {
36 "link_doctype": "Customer",
37 "link_name": "_Test Customer"
38 }
39 ]
40 })
41 contact.add_email("test_contact_customer@example.com", is_primary=True)
42 contact.add_phone("+91 0000000000", is_primary_phone=True)
43 contact.insert()