Salutation and Gender in Contact (#3079)
This commit is contained in:
parent
9b8d020ace
commit
f52e389d4f
46 changed files with 518 additions and 92 deletions
|
|
@ -64,4 +64,10 @@ def get_data():
|
|||
"system_manager": 1,
|
||||
"hidden": 1
|
||||
},
|
||||
{
|
||||
"module_name": 'Contacts',
|
||||
"type": 'module',
|
||||
"icon": "octicon octicon-book",
|
||||
"color": '#FFAEDB'
|
||||
},
|
||||
]
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import frappe
|
|||
|
||||
def load_address_and_contact(doc, key=None):
|
||||
"""Loads address list and contact list in `__onload`"""
|
||||
from frappe.geo.doctype.address.address import get_address_display
|
||||
from frappe.contacts.doctype.address.address import get_address_display
|
||||
|
||||
filters = [
|
||||
["Dynamic Link", "link_doctype", "=", doc.doctype],
|
||||
|
|
@ -15,7 +15,7 @@ frappe.ui.form.on("Address", {
|
|||
}
|
||||
frm.set_query('link_doctype', "links", function() {
|
||||
return {
|
||||
query: "frappe.geo.address_and_contact.filter_dynamic_link_doctypes",
|
||||
query: "frappe.contacts.address_and_contact.filter_dynamic_link_doctypes",
|
||||
filters: {
|
||||
fieldtype: "HTML",
|
||||
fieldname: "address_html",
|
||||
|
|
@ -569,10 +569,11 @@
|
|||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-03-29 12:36:56.013624",
|
||||
"modified": "2017-04-10 13:09:45.030542",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Geo",
|
||||
"module": "Contacts",
|
||||
"name": "Address",
|
||||
"name_case": "Title Case",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
33
frappe/contacts/doctype/address/test_address.py
Normal file
33
frappe/contacts/doctype/address/test_address.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe, unittest
|
||||
from frappe.contacts.doctype.address.address import get_address_display
|
||||
|
||||
class TestAddress(unittest.TestCase):
|
||||
def test_template_works(self):
|
||||
if not frappe.db.exists('Address Template', 'India'):
|
||||
frappe.get_doc({
|
||||
"doctype": "Address Template",
|
||||
"country": 'India',
|
||||
"is_default": 1
|
||||
}).insert()
|
||||
|
||||
if not frappe.db.exists('Address', '_Test Address-Office'):
|
||||
frappe.get_doc({
|
||||
"address_line1": "_Test Address Line 1",
|
||||
"address_title": "_Test Address",
|
||||
"address_type": "Office",
|
||||
"city": "_Test City",
|
||||
"state": "Test State",
|
||||
"country": "India",
|
||||
"doctype": "Address",
|
||||
"is_primary_address": 1,
|
||||
"phone": "+91 0000000000"
|
||||
}).insert()
|
||||
|
||||
address = frappe.get_list("Address")[0].name
|
||||
display = get_address_display(frappe.get_doc("Address", address).as_dict())
|
||||
self.assertTrue(display)
|
||||
|
|
@ -6,7 +6,7 @@ frappe.ui.form.on('Address Template', {
|
|||
if(frm.is_new() && !frm.doc.template) {
|
||||
// set default template via js so that it is translated
|
||||
frappe.call({
|
||||
method: 'frappe.geo.doctype.address_template.address_template.get_default_address_template',
|
||||
method: 'frappe.contacts.doctype.address_template.address_template.get_default_address_template',
|
||||
callback: function(r) {
|
||||
frm.set_value('template', r.message);
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:country",
|
||||
|
|
@ -23,6 +24,7 @@
|
|||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Country",
|
||||
|
|
@ -52,6 +54,7 @@
|
|||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Is Default",
|
||||
|
|
@ -81,6 +84,7 @@
|
|||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Template",
|
||||
|
|
@ -98,20 +102,20 @@
|
|||
"unique": 0
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "fa fa-map-marker",
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-01-13 05:11:37.499528",
|
||||
"modified": "2017-04-10 13:09:53.761009",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Geo",
|
||||
"module": "Contacts",
|
||||
"name": "Address Template",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
|
|
@ -126,7 +130,6 @@
|
|||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 0,
|
||||
"read": 1,
|
||||
|
|
@ -141,6 +144,7 @@
|
|||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 0,
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe, unittest
|
||||
|
||||
class TestAddressTemplate(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.make_default_address_template()
|
||||
|
||||
def test_default_is_unset(self):
|
||||
a = frappe.get_doc("Address Template", "India")
|
||||
a.is_default = 1
|
||||
a.save()
|
||||
|
||||
b = frappe.get_doc("Address Template", "Brazil")
|
||||
b.is_default = 1
|
||||
b.save()
|
||||
|
||||
self.assertEqual(frappe.db.get_value("Address Template", "India", "is_default"), 0)
|
||||
|
||||
def tearDown(self):
|
||||
a = frappe.get_doc("Address Template", "India")
|
||||
a.is_default = 1
|
||||
a.save()
|
||||
|
||||
@classmethod
|
||||
def make_default_address_template(self):
|
||||
template = """{{ address_line1 }}<br>{% if address_line2 %}{{ address_line2 }}<br>{% endif -%}{{ city }}<br>{% if state %}{{ state }}<br>{% endif -%}{% if pincode %}{{ pincode }}<br>{% endif -%}{{ country }}<br>{% if phone %}Phone: {{ phone }}<br>{% endif -%}{% if fax %}Fax: {{ fax }}<br>{% endif -%}{% if email_id %}Email: {{ email_id }}<br>{% endif -%}"""
|
||||
|
||||
if not frappe.db.exists('Address Template', 'India'):
|
||||
frappe.get_doc({
|
||||
"doctype": "Address Template",
|
||||
"country": 'India',
|
||||
"is_default": 1,
|
||||
"template": template
|
||||
}).insert()
|
||||
|
||||
if not frappe.db.exists('Address Template', 'Brazil'):
|
||||
frappe.get_doc({
|
||||
"doctype": "Address Template",
|
||||
"country": 'Brazil',
|
||||
"template": template
|
||||
}).insert()
|
||||
0
frappe/contacts/doctype/contact/__init__.py
Normal file
0
frappe/contacts/doctype/contact/__init__.py
Normal file
|
|
@ -31,7 +31,7 @@ frappe.ui.form.on("Contact", {
|
|||
}
|
||||
frm.set_query('link_doctype', "links", function() {
|
||||
return {
|
||||
query: "frappe.geo.address_and_contact.filter_dynamic_link_doctypes",
|
||||
query: "frappe.contacts.address_and_contact.filter_dynamic_link_doctypes",
|
||||
filters: {
|
||||
fieldtype: "HTML",
|
||||
fieldname: "contact_html",
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"beta": 0,
|
||||
|
|
@ -40,6 +41,36 @@
|
|||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "salutation",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Salutation",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Salutation",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
|
|
@ -218,6 +249,36 @@
|
|||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "gender",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Gender",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Gender",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
|
|
@ -542,6 +603,7 @@
|
|||
"unique": 0
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "fa fa-user",
|
||||
|
|
@ -549,15 +611,15 @@
|
|||
"image_field": "image",
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-02-20 14:54:33.723052",
|
||||
"modified": "2017-04-10 13:09:27.880530",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Email",
|
||||
"module": "Contacts",
|
||||
"name": "Contact",
|
||||
"name_case": "Title Case",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies and Contributors
|
||||
# Copyright (c) 2017, Frappe Technologies and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
0
frappe/contacts/doctype/gender/__init__.py
Normal file
0
frappe/contacts/doctype/gender/__init__.py
Normal file
8
frappe/contacts/doctype/gender/gender.js
Normal file
8
frappe/contacts/doctype/gender/gender.js
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) 2017, Frappe Technologies and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Gender', {
|
||||
refresh: function() {
|
||||
|
||||
}
|
||||
});
|
||||
113
frappe/contacts/doctype/gender/gender.json
Normal file
113
frappe/contacts/doctype/gender/gender.json
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"autoname": "field:gender",
|
||||
"beta": 0,
|
||||
"creation": "2017-04-10 12:11:36.526508",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "gender",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Gender",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-04-10 12:17:04.848338",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Contacts",
|
||||
"name": "Gender",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"email": 0,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 0,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"role": "All",
|
||||
"set_user_permissions": 0,
|
||||
"share": 0,
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
}
|
||||
],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
}
|
||||
9
frappe/contacts/doctype/gender/gender.py
Normal file
9
frappe/contacts/doctype/gender/gender.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, Frappe Technologies and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from frappe.model.document import Document
|
||||
|
||||
class Gender(Document):
|
||||
pass
|
||||
9
frappe/contacts/doctype/gender/test_gender.py
Normal file
9
frappe/contacts/doctype/gender/test_gender.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, Frappe Technologies and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import unittest
|
||||
|
||||
class TestGender(unittest.TestCase):
|
||||
pass
|
||||
0
frappe/contacts/doctype/salutation/__init__.py
Normal file
0
frappe/contacts/doctype/salutation/__init__.py
Normal file
8
frappe/contacts/doctype/salutation/salutation.js
Normal file
8
frappe/contacts/doctype/salutation/salutation.js
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) 2017, Frappe Technologies and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Salutation', {
|
||||
refresh: function() {
|
||||
|
||||
}
|
||||
});
|
||||
132
frappe/contacts/doctype/salutation/salutation.json
Normal file
132
frappe/contacts/doctype/salutation/salutation.json
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"autoname": "field:salutation",
|
||||
"beta": 0,
|
||||
"creation": "2017-04-10 12:17:58.071915",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "salutation",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Salutation",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-04-10 12:55:18.855578",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Contacts",
|
||||
"name": "Salutation",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"email": 0,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 0,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"role": "All",
|
||||
"set_user_permissions": 0,
|
||||
"share": 0,
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Administrator",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
}
|
||||
9
frappe/contacts/doctype/salutation/salutation.py
Normal file
9
frappe/contacts/doctype/salutation/salutation.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, Frappe Technologies and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from frappe.model.document import Document
|
||||
|
||||
class Salutation(Document):
|
||||
pass
|
||||
9
frappe/contacts/doctype/salutation/test_salutation.py
Normal file
9
frappe/contacts/doctype/salutation/test_salutation.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, Frappe Technologies and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import unittest
|
||||
|
||||
class TestSalutation(unittest.TestCase):
|
||||
pass
|
||||
0
frappe/contacts/report/__init__.py
Normal file
0
frappe/contacts/report/__init__.py
Normal file
|
|
@ -7,9 +7,9 @@
|
|||
"doctype": "Report",
|
||||
"idx": 2,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2017-02-24 19:57:37.368498",
|
||||
"modified": "2017-04-10 15:04:12.498920",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Geo",
|
||||
"module": "Contacts",
|
||||
"name": "Addresses And Contacts",
|
||||
"owner": "Administrator",
|
||||
"ref_doctype": "Address",
|
||||
31
frappe/desk/page/setup_wizard/install_fixtures.py
Normal file
31
frappe/desk/page/setup_wizard/install_fixtures.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
|
||||
from frappe import _
|
||||
|
||||
def install():
|
||||
update_genders_and_salutations()
|
||||
|
||||
@frappe.whitelist()
|
||||
def update_genders_and_salutations():
|
||||
default_genders = [_("Male"), _("Female"), _("Other")]
|
||||
default_salutations = [_("Mr"), _("Ms"), _('Mx'), _("Dr"), _("Mrs"), _("Madam"), _("Miss"), _("Master"), _("Prof")]
|
||||
records = [{'doctype': 'Gender', 'gender': d} for d in default_genders]
|
||||
records += [{'doctype': 'Salutation', 'salutation': d} for d in default_salutations]
|
||||
for record in records:
|
||||
doc = frappe.new_doc(record.get("doctype"))
|
||||
doc.update(record)
|
||||
|
||||
try:
|
||||
doc.insert(ignore_permissions=True)
|
||||
except frappe.DuplicateEntryError, e:
|
||||
# pass DuplicateEntryError and continue
|
||||
if e.args and e.args[0]==doc.doctype and e.args[1]==doc.name:
|
||||
# make sure DuplicateEntryError is for the exact same doc and not a related doc
|
||||
pass
|
||||
else:
|
||||
raise
|
||||
|
|
@ -10,6 +10,7 @@ from frappe.geo.country_info import get_country_info
|
|||
from frappe.utils.file_manager import save_file
|
||||
from frappe.utils.password import update_password
|
||||
from werkzeug.useragents import UserAgent
|
||||
import install_fixtures
|
||||
|
||||
@frappe.whitelist()
|
||||
def setup_complete(args):
|
||||
|
|
@ -53,6 +54,7 @@ def setup_complete(args):
|
|||
else:
|
||||
for hook in frappe.get_hooks("setup_wizard_success"):
|
||||
frappe.get_attr(hook)(args)
|
||||
install_fixtures.install()
|
||||
|
||||
|
||||
def update_system_settings(args):
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe, unittest
|
||||
test_records = frappe.get_test_records('Address')
|
||||
|
||||
from frappe.geo.doctype.address.address import get_address_display
|
||||
|
||||
class TestAddress(unittest.TestCase):
|
||||
def test_template_works(self):
|
||||
address = frappe.get_list("Address")[0].name
|
||||
display = get_address_display(frappe.get_doc("Address", address).as_dict())
|
||||
self.assertTrue(display)
|
||||
|
||||
|
||||
test_dependencies = ["Address Template"]
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
[
|
||||
{
|
||||
"address_line1": "_Test Address Line 1",
|
||||
"address_title": "_Test Address",
|
||||
"address_type": "Office",
|
||||
"city": "_Test City",
|
||||
"state": "Test State",
|
||||
"country": "India",
|
||||
"doctype": "Address",
|
||||
"is_primary_address": 1,
|
||||
"phone": "+91 0000000000"
|
||||
}
|
||||
]
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe, unittest
|
||||
test_records = frappe.get_test_records('Address Template')
|
||||
|
||||
class TestAddressTemplate(unittest.TestCase):
|
||||
def test_default_is_unset(self):
|
||||
a = frappe.get_doc("Address Template", "India")
|
||||
a.is_default = 1
|
||||
a.save()
|
||||
|
||||
b = frappe.get_doc("Address Template", "Brazil")
|
||||
b.is_default = 1
|
||||
b.save()
|
||||
|
||||
self.assertEqual(frappe.db.get_value("Address Template", "India", "is_default"), 0)
|
||||
|
||||
def tearDown(self):
|
||||
a = frappe.get_doc("Address Template", "India")
|
||||
a.is_default = 1
|
||||
a.save()
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
[
|
||||
{
|
||||
"country": "India",
|
||||
"is_default": 1,
|
||||
"template": "{{ address_title }}<br>\n{{ address_line1 }}<br>\n{% if address_line2 %}{{ address_line2 }}<br>{% endif %}\n{{ city }}<br>\n{% if state %}{{ state }}<br>{% endif %}\n{% if pincode %} PIN / ZIP: {{ pincode }}<br>{% endif %}\n{{ country }}<br>\n{% if phone %}Phone: {{ phone }}<br>{% endif %}\n{% if fax %}Fax: {{ fax }}<br>{% endif %}\n{% if email_id %}Email: {{ email_id }}<br>{% endif %}\n"
|
||||
},
|
||||
{
|
||||
"country": "Brazil",
|
||||
"is_default": 0,
|
||||
"template": "{{ address_title }}<br>\n{{ address_line1 }}<br>\n{% if address_line2 %}{{ address_line2 }}<br>{% endif %}\n{{ city }}<br>\n{% if state %}{{ state }}<br>{% endif %}\n{% if pincode %} PIN / ZIP: {{ pincode }}<br>{% endif %}\n{{ country }}<br>\n{% if phone %}Phone: {{ phone }}<br>{% endif %}\n{% if fax %}Fax: {{ fax }}<br>{% endif %}\n{% if email_id %}Email: {{ email_id }}<br>{% endif %}\n"
|
||||
}
|
||||
]
|
||||
|
||||
|
|
@ -79,8 +79,8 @@ permission_query_conditions = {
|
|||
"User": "frappe.core.doctype.user.user.get_permission_query_conditions",
|
||||
"Note": "frappe.desk.doctype.note.note.get_permission_query_conditions",
|
||||
"Kanban Board": "frappe.desk.doctype.kanban_board.kanban_board.get_permission_query_conditions",
|
||||
"Contact": "frappe.geo.address_and_contact.get_permission_query_conditions_for_contact",
|
||||
"Address": "frappe.geo.address_and_contact.get_permission_query_conditions_for_address",
|
||||
"Contact": "frappe.contacts.address_and_contact.get_permission_query_conditions_for_contact",
|
||||
"Address": "frappe.contacts.address_and_contact.get_permission_query_conditions_for_address",
|
||||
"Communication": "frappe.core.doctype.communication.communication.get_permission_query_conditions_for_communication"
|
||||
}
|
||||
|
||||
|
|
@ -90,8 +90,8 @@ has_permission = {
|
|||
"User": "frappe.core.doctype.user.user.has_permission",
|
||||
"Note": "frappe.desk.doctype.note.note.has_permission",
|
||||
"Kanban Board": "frappe.desk.doctype.kanban_board.kanban_board.has_permission",
|
||||
"Contact": "frappe.geo.address_and_contact.has_permission",
|
||||
"Address": "frappe.geo.address_and_contact.has_permission",
|
||||
"Contact": "frappe.contacts.address_and_contact.has_permission",
|
||||
"Address": "frappe.contacts.address_and_contact.has_permission",
|
||||
"Communication": "frappe.core.doctype.communication.communication.has_permission",
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,4 +6,5 @@ Custom
|
|||
Geo
|
||||
Desk
|
||||
Integrations
|
||||
Printing
|
||||
Printing
|
||||
Contacts
|
||||
|
|
|
|||
|
|
@ -182,4 +182,5 @@ frappe.patches.v8_0.install_new_build_system_requirements
|
|||
frappe.patches.v8_0.set_currency_field_precision # 2017-05-09
|
||||
frappe.patches.v8_0.rename_print_to_printing
|
||||
frappe.patches.v7_1.disabled_print_settings_for_custom_print_format
|
||||
frappe.patches.v8_0.update_desktop_icons
|
||||
frappe.patches.v8_0.update_desktop_icons
|
||||
frappe.patches.v8_0.update_gender_and_salutation
|
||||
11
frappe/patches/v8_0/update_gender_and_salutation.py
Normal file
11
frappe/patches/v8_0/update_gender_and_salutation.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.desk.page.setup_wizard.install_fixtures import update_genders_and_salutations
|
||||
|
||||
def execute():
|
||||
frappe.db.set_value("DocType", "Contact", "module", "Contacts")
|
||||
frappe.db.set_value("DocType", "Address", "module", "Contacts")
|
||||
frappe.db.set_value("DocType", "Address Template", "module", "Contacts")
|
||||
update_genders_and_salutations()
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
frappe.provide('frappe.geo')
|
||||
frappe.provide('frappe.contacts')
|
||||
|
||||
$.extend(frappe.geo, {
|
||||
$.extend(frappe.contacts, {
|
||||
clear_address_and_contact: function(frm) {
|
||||
$(frm.fields_dict['address_html'].wrapper).html("");
|
||||
frm.fields_dict['contact_html'] && $(frm.fields_dict['contact_html'].wrapper).html("");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue