Rushabh Mehta | 982be9f | 2017-01-17 17:57:19 +0530 | [diff] [blame] | 1 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors |
| 2 | # License: GNU General Public License v3. See license.txt |
| 3 | |
| 4 | from __future__ import unicode_literals |
| 5 | |
| 6 | import frappe |
| 7 | |
| 8 | def create_test_contact_and_address(): |
Rushabh Mehta | a0c41b7 | 2017-01-18 14:14:20 +0530 | [diff] [blame] | 9 | frappe.db.sql('delete from tabContact') |
Nabin Hait | 1aa8c2e | 2020-03-26 13:15:31 +0530 | [diff] [blame] | 10 | frappe.db.sql('delete from `tabContact Email`') |
| 11 | frappe.db.sql('delete from `tabContact Phone`') |
Rushabh Mehta | a0c41b7 | 2017-01-18 14:14:20 +0530 | [diff] [blame] | 12 | frappe.db.sql('delete from tabAddress') |
| 13 | frappe.db.sql('delete from `tabDynamic Link`') |
Rushabh Mehta | 982be9f | 2017-01-17 17:57:19 +0530 | [diff] [blame] | 14 | |
Himanshu | 25ab1e4 | 2019-09-30 10:08:15 +0530 | [diff] [blame] | 15 | 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 Mehta | a0c41b7 | 2017-01-18 14:14:20 +0530 | [diff] [blame] | 30 | |
Himanshu | 25ab1e4 | 2019-09-30 10:08:15 +0530 | [diff] [blame] | 31 | 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() |