瀏覽代碼

Salutation and Gender in Contact (#3079)

version-14
KanchanChauhan 8 年之前
committed by Rushabh Mehta
父節點
當前提交
f52e389d4f
共有 46 個文件被更改,包括 518 次插入92 次删除
  1. +6
    -0
      frappe/config/desktop.py
  2. +0
    -0
      frappe/contacts/__init__.py
  3. +1
    -1
      frappe/contacts/address_and_contact.py
  4. +0
    -0
      frappe/contacts/doctype/__init__.py
  5. +0
    -0
      frappe/contacts/doctype/address/__init__.py
  6. +1
    -1
      frappe/contacts/doctype/address/address.js
  7. +3
    -2
      frappe/contacts/doctype/address/address.json
  8. +0
    -0
      frappe/contacts/doctype/address/address.py
  9. +33
    -0
      frappe/contacts/doctype/address/test_address.py
  10. +0
    -0
      frappe/contacts/doctype/address_template/__init__.py
  11. +1
    -1
      frappe/contacts/doctype/address_template/address_template.js
  12. +8
    -4
      frappe/contacts/doctype/address_template/address_template.json
  13. +0
    -0
      frappe/contacts/doctype/address_template/address_template.py
  14. +45
    -0
      frappe/contacts/doctype/address_template/test_address_template.py
  15. +0
    -0
      frappe/contacts/doctype/contact/__init__.py
  16. +1
    -1
      frappe/contacts/doctype/contact/contact.js
  17. +65
    -3
      frappe/contacts/doctype/contact/contact.json
  18. +0
    -0
      frappe/contacts/doctype/contact/contact.py
  19. +1
    -1
      frappe/contacts/doctype/contact/test_contact.py
  20. +0
    -0
      frappe/contacts/doctype/contact/test_records.json
  21. +0
    -0
      frappe/contacts/doctype/gender/__init__.py
  22. +8
    -0
      frappe/contacts/doctype/gender/gender.js
  23. +113
    -0
      frappe/contacts/doctype/gender/gender.json
  24. +9
    -0
      frappe/contacts/doctype/gender/gender.py
  25. +9
    -0
      frappe/contacts/doctype/gender/test_gender.py
  26. +0
    -0
      frappe/contacts/doctype/salutation/__init__.py
  27. +8
    -0
      frappe/contacts/doctype/salutation/salutation.js
  28. +132
    -0
      frappe/contacts/doctype/salutation/salutation.json
  29. +9
    -0
      frappe/contacts/doctype/salutation/salutation.py
  30. +9
    -0
      frappe/contacts/doctype/salutation/test_salutation.py
  31. +0
    -0
      frappe/contacts/report/__init__.py
  32. +0
    -0
      frappe/contacts/report/addresses_and_contacts/__init__.py
  33. +0
    -0
      frappe/contacts/report/addresses_and_contacts/addresses_and_contacts.js
  34. +2
    -2
      frappe/contacts/report/addresses_and_contacts/addresses_and_contacts.json
  35. +0
    -0
      frappe/contacts/report/addresses_and_contacts/addresses_and_contacts.py
  36. +31
    -0
      frappe/desk/page/setup_wizard/install_fixtures.py
  37. +2
    -0
      frappe/desk/page/setup_wizard/setup_wizard.py
  38. +0
    -18
      frappe/geo/doctype/address/test_address.py
  39. +0
    -13
      frappe/geo/doctype/address/test_records.json
  40. +0
    -24
      frappe/geo/doctype/address_template/test_address_template.py
  41. +0
    -13
      frappe/geo/doctype/address_template/test_records.json
  42. +4
    -4
      frappe/hooks.py
  43. +2
    -1
      frappe/modules.txt
  44. +2
    -1
      frappe/patches.txt
  45. +11
    -0
      frappe/patches/v8_0/update_gender_and_salutation.py
  46. +2
    -2
      frappe/public/js/frappe/misc/address_and_contact.js

+ 6
- 0
frappe/config/desktop.py 查看文件

@@ -64,4 +64,10 @@ def get_data():
"system_manager": 1,
"hidden": 1
},
{
"module_name": 'Contacts',
"type": 'module',
"icon": "octicon octicon-book",
"color": '#FFAEDB'
},
]

frappe/email/doctype/contact/__init__.py → frappe/contacts/__init__.py 查看文件


frappe/geo/address_and_contact.py → frappe/contacts/address_and_contact.py 查看文件

@@ -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],

frappe/geo/doctype/address/__init__.py → frappe/contacts/doctype/__init__.py 查看文件


frappe/geo/doctype/address_template/__init__.py → frappe/contacts/doctype/address/__init__.py 查看文件


frappe/geo/doctype/address/address.js → frappe/contacts/doctype/address/address.js 查看文件

@@ -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",

frappe/geo/doctype/address/address.json → frappe/contacts/doctype/address/address.json 查看文件

@@ -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": [
{

frappe/geo/doctype/address/address.py → frappe/contacts/doctype/address/address.py 查看文件


+ 33
- 0
frappe/contacts/doctype/address/test_address.py 查看文件

@@ -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)

frappe/geo/report/addresses_and_contacts/__init__.py → frappe/contacts/doctype/address_template/__init__.py 查看文件


frappe/geo/doctype/address_template/address_template.js → frappe/contacts/doctype/address_template/address_template.js 查看文件

@@ -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);
}

frappe/geo/doctype/address_template/address_template.json → frappe/contacts/doctype/address_template/address_template.json 查看文件

@@ -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,

frappe/geo/doctype/address_template/address_template.py → frappe/contacts/doctype/address_template/address_template.py 查看文件


+ 45
- 0
frappe/contacts/doctype/address_template/test_address_template.py 查看文件

@@ -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
- 0
frappe/contacts/doctype/contact/__init__.py 查看文件


frappe/email/doctype/contact/contact.js → frappe/contacts/doctype/contact/contact.js 查看文件

@@ -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",

frappe/email/doctype/contact/contact.json → frappe/contacts/doctype/contact/contact.json 查看文件

@@ -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": [
{

frappe/email/doctype/contact/contact.py → frappe/contacts/doctype/contact/contact.py 查看文件


frappe/email/doctype/contact/test_contact.py → frappe/contacts/doctype/contact/test_contact.py 查看文件

@@ -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


frappe/email/doctype/contact/test_records.json → frappe/contacts/doctype/contact/test_records.json 查看文件


+ 0
- 0
frappe/contacts/doctype/gender/__init__.py 查看文件


+ 8
- 0
frappe/contacts/doctype/gender/gender.js 查看文件

@@ -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
- 0
frappe/contacts/doctype/gender/gender.json 查看文件

@@ -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
- 0
frappe/contacts/doctype/gender/gender.py 查看文件

@@ -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
- 0
frappe/contacts/doctype/gender/test_gender.py 查看文件

@@ -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
- 0
frappe/contacts/doctype/salutation/__init__.py 查看文件


+ 8
- 0
frappe/contacts/doctype/salutation/salutation.js 查看文件

@@ -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
- 0
frappe/contacts/doctype/salutation/salutation.json 查看文件

@@ -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
- 0
frappe/contacts/doctype/salutation/salutation.py 查看文件

@@ -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
- 0
frappe/contacts/doctype/salutation/test_salutation.py 查看文件

@@ -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
- 0
frappe/contacts/report/__init__.py 查看文件


+ 0
- 0
frappe/contacts/report/addresses_and_contacts/__init__.py 查看文件


frappe/geo/report/addresses_and_contacts/addresses_and_contacts.js → frappe/contacts/report/addresses_and_contacts/addresses_and_contacts.js 查看文件


frappe/geo/report/addresses_and_contacts/addresses_and_contacts.json → frappe/contacts/report/addresses_and_contacts/addresses_and_contacts.json 查看文件

@@ -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",

frappe/geo/report/addresses_and_contacts/addresses_and_contacts.py → frappe/contacts/report/addresses_and_contacts/addresses_and_contacts.py 查看文件


+ 31
- 0
frappe/desk/page/setup_wizard/install_fixtures.py 查看文件

@@ -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

+ 2
- 0
frappe/desk/page/setup_wizard/setup_wizard.py 查看文件

@@ -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):


+ 0
- 18
frappe/geo/doctype/address/test_address.py 查看文件

@@ -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"]

+ 0
- 13
frappe/geo/doctype/address/test_records.json 查看文件

@@ -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"
}
]

+ 0
- 24
frappe/geo/doctype/address_template/test_address_template.py 查看文件

@@ -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()

+ 0
- 13
frappe/geo/doctype/address_template/test_records.json 查看文件

@@ -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"
}
]


+ 4
- 4
frappe/hooks.py 查看文件

@@ -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",
}



+ 2
- 1
frappe/modules.txt 查看文件

@@ -6,4 +6,5 @@ Custom
Geo
Desk
Integrations
Printing
Printing
Contacts

+ 2
- 1
frappe/patches.txt 查看文件

@@ -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
- 0
frappe/patches/v8_0/update_gender_and_salutation.py 查看文件

@@ -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()

+ 2
- 2
frappe/public/js/frappe/misc/address_and_contact.js 查看文件

@@ -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…
取消
儲存