diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.py b/erpnext/accounts/doctype/tax_rule/tax_rule.py index 606d067335..36f4221ce1 100644 --- a/erpnext/accounts/doctype/tax_rule/tax_rule.py +++ b/erpnext/accounts/doctype/tax_rule/tax_rule.py @@ -7,7 +7,7 @@ import frappe from frappe import _ from frappe.model.document import Document from frappe.utils import cstr, cint -from frappe.geo.doctype.address.address import get_default_address +from frappe.contacts.doctype.address.address import get_default_address class IncorrectCustomerGroup(frappe.ValidationError): pass class IncorrectSupplierType(frappe.ValidationError): pass diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index a6ca3b6061..5c6a6df6a2 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -9,8 +9,8 @@ from frappe import _, msgprint, scrub from frappe.defaults import get_user_permissions from frappe.utils import add_days, getdate, formatdate, get_first_day, date_diff, \ add_years, get_timestamp, nowdate, flt -from frappe.geo.doctype.address.address import get_address_display, get_default_address -from frappe.email.doctype.contact.contact import get_contact_details, get_default_contact +from frappe.contacts.doctype.address.address import get_address_display, get_default_address +from frappe.contacts.doctype.contact.contact import get_contact_details, get_default_contact from erpnext.exceptions import PartyFrozen, InvalidCurrency, PartyDisabled, InvalidAccountCurrency from erpnext.accounts.utils import get_fiscal_year from erpnext import get_default_currency diff --git a/erpnext/buying/doctype/supplier/supplier.js b/erpnext/buying/doctype/supplier/supplier.js index c7df33d9f1..7fae7b9fb1 100644 --- a/erpnext/buying/doctype/supplier/supplier.js +++ b/erpnext/buying/doctype/supplier/supplier.js @@ -25,12 +25,12 @@ frappe.ui.form.on("Supplier", { } if (frm.doc.__islocal) { - hide_field(['address_html', 'contact_html']); - frappe.geo.clear_address_and_contact(frm); + hide_field(['address_html','contact_html']); + frappe.contacts.clear_address_and_contact(frm); } else { - unhide_field(['address_html', 'contact_html']); - frappe.geo.render_address_and_contact(frm); + unhide_field(['address_html','contact_html']); + frappe.contacts.render_address_and_contact(frm); // custom buttons frm.add_custom_button(__('Accounting Ledger'), function () { diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py index 3b6ae620d1..b2b90637b6 100644 --- a/erpnext/buying/doctype/supplier/supplier.py +++ b/erpnext/buying/doctype/supplier/supplier.py @@ -6,7 +6,7 @@ import frappe import frappe.defaults from frappe import msgprint, _ from frappe.model.naming import make_autoname -from frappe.geo.address_and_contact import load_address_and_contact, delete_contact_and_address +from frappe.contacts.address_and_contact import load_address_and_contact, delete_contact_and_address from erpnext.utilities.transaction_base import TransactionBase from erpnext.accounts.party import validate_party_accounts, get_dashboard_info, get_timeline_data # keep this diff --git a/erpnext/crm/doctype/lead/lead.js b/erpnext/crm/doctype/lead/lead.js index 36aa18677f..f2f393763f 100644 --- a/erpnext/crm/doctype/lead/lead.js +++ b/erpnext/crm/doctype/lead/lead.js @@ -35,10 +35,10 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({ cur_frm.page.set_inner_btn_group_as_primary(__("Make")); } - if(!doc.__islocal) { - frappe.geo.render_address_and_contact(cur_frm); + if(!this.frm.doc.__islocal) { + frappe.contacts.render_address_and_contact(cur_frm); } else { - frappe.geo.clear_address_and_contact(cur_frm); + frappe.contacts.clear_address_and_contact(cur_frm); } }, diff --git a/erpnext/crm/doctype/lead/lead.json b/erpnext/crm/doctype/lead/lead.json index 17c4022ef0..21d1024dfe 100644 --- a/erpnext/crm/doctype/lead/lead.json +++ b/erpnext/crm/doctype/lead/lead.json @@ -1,5 +1,6 @@ { "allow_copy": 0, + "allow_guest_to_view": 0, "allow_import": 1, "allow_rename": 0, "autoname": "naming_series:", @@ -71,6 +72,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, @@ -106,21 +137,21 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "company_name", - "fieldtype": "Data", + "fieldname": "gender", + "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_global_search": 0, - "in_list_view": 1, + "in_list_view": 0, "in_standard_filter": 0, - "label": "Organization Name", + "label": "Gender", "length": 0, "no_copy": 0, - "oldfieldname": "company_name", - "oldfieldtype": "Data", + "options": "Gender", "permlevel": 0, + "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, @@ -254,6 +285,36 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "company_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Organization Name", + "length": 0, + "no_copy": 0, + "oldfieldname": "company_name", + "oldfieldtype": "Data", + "permlevel": 0, + "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, @@ -1037,6 +1098,7 @@ "unique": 0 } ], + "has_web_view": 0, "hide_heading": 0, "hide_toolbar": 0, "icon": "fa fa-user", @@ -1044,15 +1106,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-22 18:53:16.231035", + "modified": "2017-04-10 13:06:36.324439", "modified_by": "Administrator", "module": "CRM", "name": "Lead", + "name_case": "Title Case", "owner": "Administrator", "permissions": [ { diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py index aafc128e91..256e3a82cd 100644 --- a/erpnext/crm/doctype/lead/lead.py +++ b/erpnext/crm/doctype/lead/lead.py @@ -8,7 +8,7 @@ from frappe.utils import (cstr, validate_email_add, cint, comma_and, has_gravata from frappe.model.mapper import get_mapped_doc from erpnext.controllers.selling_controller import SellingController -from frappe.geo.address_and_contact import load_address_and_contact +from frappe.contacts.address_and_contact import load_address_and_contact from erpnext.accounts.party import set_taxes sender_field = "email_id" diff --git a/erpnext/hooks.py b/erpnext/hooks.py index d64409d956..b8abd8a90c 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -146,7 +146,7 @@ doc_events = { "on_cancel": "erpnext.stock.doctype.material_request.material_request.update_completed_and_requested_qty" }, "User": { - "after_insert": "frappe.email.doctype.contact.contact.update_contact", + "after_insert": "frappe.contacts.doctype.contact.contact.update_contact", "validate": "erpnext.hr.doctype.employee.employee.validate_employee_role", "on_update": ["erpnext.hr.doctype.employee.employee.update_user_permissions", "erpnext.portal.utils.set_default_role"] diff --git a/erpnext/hr/doctype/employee/employee.json b/erpnext/hr/doctype/employee/employee.json index c53e497f2e..f32a056cfb 100644 --- a/erpnext/hr/doctype/employee/employee.json +++ b/erpnext/hr/doctype/employee/employee.json @@ -106,7 +106,7 @@ "collapsible": 0, "columns": 0, "fieldname": "salutation", - "fieldtype": "Select", + "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -119,7 +119,7 @@ "no_copy": 0, "oldfieldname": "salutation", "oldfieldtype": "Select", - "options": "\nMr\nMs", + "options": "Salutation", "permlevel": 0, "print_hide": 0, "print_hide_if_no_value": 0, @@ -404,7 +404,7 @@ "collapsible": 0, "columns": 0, "fieldname": "gender", - "fieldtype": "Select", + "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -417,7 +417,7 @@ "no_copy": 0, "oldfieldname": "gender", "oldfieldtype": "Select", - "options": "\nMale\nFemale\nOther", + "options": "Gender", "permlevel": 0, "print_hide": 0, "print_hide_if_no_value": 0, @@ -2353,10 +2353,11 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-03-14 17:04:27.247238", + "modified": "2017-07-10 13:08:15.826832", "modified_by": "Administrator", "module": "HR", "name": "Employee", + "name_case": "Title Case", "owner": "Administrator", "permissions": [ { diff --git a/erpnext/public/js/controllers/buying.js b/erpnext/public/js/controllers/buying.js index 06e759f985..d46e9da2a1 100644 --- a/erpnext/public/js/controllers/buying.js +++ b/erpnext/public/js/controllers/buying.js @@ -24,7 +24,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ this.frm.set_query("shipping_address", function() { if(me.frm.doc.customer) { return { - query: 'frappe.geo.doctype.address.address.address_query', + query: 'frappe.contacts.doctype.address.address.address_query', filters: { link_doctype: 'Customer', link_name: me.frm.doc.customer } }; } else diff --git a/erpnext/public/js/queries.js b/erpnext/public/js/queries.js index bf7143a10e..38f89a4d44 100644 --- a/erpnext/public/js/queries.js +++ b/erpnext/public/js/queries.js @@ -50,7 +50,7 @@ $.extend(erpnext.queries, { } return { - query: 'frappe.email.doctype.contact.contact.contact_query', + query: 'frappe.contacts.doctype.contact.contact.contact_query', filters: { link_doctype: frappe.dynamic_link.doctype, link_name: doc[frappe.dynamic_link.fieldname] } }; } }, @@ -63,14 +63,14 @@ $.extend(erpnext.queries, { } return { - query: 'frappe.geo.doctype.address.address.address_query', + query: 'frappe.contacts.doctype.address.address.address_query', filters: { link_doctype: frappe.dynamic_link.doctype, link_name: doc[frappe.dynamic_link.fieldname] } }; } }, company_address_query: function(doc) { return { - query: 'frappe.geo.doctype.address.address.address_query', + query: 'frappe.contacts.doctype.address.address.address_query', filters: { is_your_company_address: 1, link_doctype: 'Company', link_name: doc.company || '' } }; }, diff --git a/erpnext/public/js/utils/party.js b/erpnext/public/js/utils/party.js index 751d93c4ea..cc19a11034 100644 --- a/erpnext/public/js/utils/party.js +++ b/erpnext/public/js/utils/party.js @@ -80,7 +80,7 @@ erpnext.utils.get_address_display = function(frm, address_field, display_field, if(!display_field) display_field = "address_display"; if(frm.doc[address_field]) { frappe.call({ - method: "frappe.geo.doctype.address.address.get_address_display", + method: "frappe.contacts.doctype.address.address.get_address_display", args: {"address_dict": frm.doc[address_field] }, callback: function(r) { if(r.message) { @@ -144,7 +144,7 @@ erpnext.utils.get_contact_details = function(frm) { if(frm.doc["contact_person"]) { frappe.call({ - method: "frappe.email.doctype.contact.contact.get_contact_details", + method: "frappe.contacts.doctype.contact.contact.get_contact_details", args: {contact: frm.doc.contact_person }, callback: function(r) { if(r.message) @@ -166,7 +166,7 @@ erpnext.utils.validate_mandatory = function(frm, label, value, trigger_on) { erpnext.utils.get_shipping_address = function(frm, callback){ frappe.call({ - method: "frappe.geo.doctype.address.address.get_shipping_address", + method: "frappe.contacts.doctype.address.address.get_shipping_address", args: {company: frm.doc.company}, callback: function(r){ if(r.message){ diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index 540ec28c94..d85f5c1e86 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -37,7 +37,7 @@ frappe.ui.form.on("Customer", { frm.toggle_display(['address_html','contact_html'], !frm.doc.__islocal); if(!frm.doc.__islocal) { - frappe.geo.render_address_and_contact(frm); + frappe.contacts.render_address_and_contact(frm); // custom buttons frm.add_custom_button(__('Accounting Ledger'), function() { @@ -53,7 +53,7 @@ frappe.ui.form.on("Customer", { erpnext.utils.set_party_dashboard_indicators(frm); } else { - frappe.geo.clear_address_and_contact(frm); + frappe.contacts.clear_address_and_contact(frm); } var grid = cur_frm.get_field("sales_team").grid; diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json index 81570138a0..b2d4021ba3 100644 --- a/erpnext/selling/doctype/customer/customer.json +++ b/erpnext/selling/doctype/customer/customer.json @@ -77,6 +77,36 @@ }, { "allow_bulk_edit": 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": 1, "collapsible": 0, @@ -108,6 +138,36 @@ }, { "allow_bulk_edit": 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": 0, "collapsible": 0, diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index c0b3b84775..3b9d6756fc 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -9,8 +9,8 @@ import frappe.defaults from frappe.utils import flt, cint, cstr from frappe.desk.reportview import build_match_conditions from erpnext.utilities.transaction_base import TransactionBase -from frappe.geo.address_and_contact import load_address_and_contact, delete_contact_and_address -from erpnext.accounts.party import validate_party_accounts, get_dashboard_info, get_timeline_data # keep this +from erpnext.accounts.party import validate_party_accounts, get_dashboard_info # keep this +from frappe.contacts.address_and_contact import load_address_and_contact, delete_contact_and_address class Customer(TransactionBase): def get_feed(self): @@ -88,11 +88,18 @@ class Customer(TransactionBase): address.append('links', dict(link_doctype='Customer', link_name=self.name)) address.save() - lead = frappe.db.get_value("Lead", self.lead_name, ["lead_name", "email_id", "phone", "mobile_no"], as_dict=True) + lead = frappe.db.get_value("Lead", self.lead_name, ["lead_name", "email_id", "phone", "mobile_no", "gender", "salutation"], as_dict=True) + + lead.lead_name = lead.lead_name.split(" ") + lead.first_name = lead.lead_name[0] + lead.last_name = " ".join(lead.lead_name[1:]) # create contact from lead contact = frappe.new_doc('Contact') - contact.first_name = lead.lead_name + contact.first_name = lead.first_name + contact.last_name = lead.last_name + contact.gender = lead.gender + contact.salutation = lead.salutation contact.email_id = lead.email_id contact.phone = lead.phone contact.mobile_no = lead.mobile_no diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.js b/erpnext/setup/doctype/sales_partner/sales_partner.js index 84cf749524..b1c18d67c7 100644 --- a/erpnext/setup/doctype/sales_partner/sales_partner.js +++ b/erpnext/setup/doctype/sales_partner/sales_partner.js @@ -7,11 +7,11 @@ frappe.ui.form.on('Sales Partner', { if(frm.doc.__islocal){ hide_field(['address_html', 'contact_html', 'address_contacts']); - frappe.geo.clear_address_and_contact(frm); + frappe.contacts.clear_address_and_contact(frm); } else{ unhide_field(['address_html', 'contact_html', 'address_contacts']); - frappe.geo.render_address_and_contact(frm); + frappe.contacts.render_address_and_contact(frm); } } }); diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.py b/erpnext/setup/doctype/sales_partner/sales_partner.py index 96211afa4d..e6b26eee55 100644 --- a/erpnext/setup/doctype/sales_partner/sales_partner.py +++ b/erpnext/setup/doctype/sales_partner/sales_partner.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import cstr, filter_strip_join from frappe.website.website_generator import WebsiteGenerator -from frappe.geo.address_and_contact import load_address_and_contact +from frappe.contacts.address_and_contact import load_address_and_contact class SalesPartner(WebsiteGenerator): website = frappe._dict( diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index 66e9f4ce24..e73734e63a 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -6,7 +6,7 @@ import frappe from frappe import throw, _ import frappe.defaults from frappe.utils import cint, flt, get_fullname, cstr -from frappe.geo.doctype.address.address import get_address_display +from frappe.contacts.doctype.address.address import get_address_display from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import get_shopping_cart_settings from frappe.utils.nestedset import get_root_of from erpnext.accounts.utils import get_account_name