From 24cae1cad662732d62e4214926df1fc854b343a0 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Sat, 20 Jan 2018 02:47:19 +0530 Subject: [PATCH 01/12] Made Primary address field searchable and is displayed in Customer Link field options --- erpnext/selling/doctype/customer/customer.js | 11 +- .../selling/doctype/customer/customer.json | 129 +++++++++++++----- erpnext/selling/doctype/customer/customer.py | 12 ++ 3 files changed, 118 insertions(+), 34 deletions(-) diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index 9603290998..54f974cc20 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -33,7 +33,16 @@ frappe.ui.form.on("Customer", { } } }) + frm.set_query('customer_primary_address', function(doc) { + return { + query: "erpnext.selling.doctype.customer.customer.get_customer_primary_address", + filters: { + 'customer': doc.name + } + } + }) }, + refresh: function(frm) { if(frappe.defaults.get_default("cust_master_name")!="Naming Series") { frm.toggle_display("naming_series", false); @@ -72,4 +81,4 @@ frappe.ui.form.on("Customer", { validate: function(frm) { if(frm.doc.lead_name) frappe.model.clear_doc("Lead", frm.doc.lead_name); }, -}); +}); \ No newline at end of file diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json index b618bf3fbc..7e2c658022 100644 --- a/erpnext/selling/doctype/customer/customer.json +++ b/erpnext/selling/doctype/customer/customer.json @@ -734,7 +734,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Primary Contact Detail", + "label": "Primary Address and Contact Detail", "length": 0, "no_copy": 0, "permlevel": 0, @@ -780,35 +780,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_26", - "fieldtype": "Column Break", - "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, - "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 - }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -824,7 +795,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Mobile Number", + "label": "Mobile No", "length": 0, "no_copy": 0, "options": "customer_primary_contact.mobile_no", @@ -871,6 +842,98 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_26", + "fieldtype": "Column Break", + "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, + "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 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "customer_primary_address", + "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": "Customer Primary Address", + "length": 0, + "no_copy": 0, + "options": "Address", + "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_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "", + "fieldname": "primary_address", + "fieldtype": "Read Only", + "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": "Primary Address", + "length": 0, + "no_copy": 0, + "options": "customer_primary_address.complete_address", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -1354,7 +1417,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-12-13 18:17:19.894331", + "modified": "2018-01-20 02:07:05.098742", "modified_by": "Administrator", "module": "Selling", "name": "Customer", @@ -1545,7 +1608,7 @@ "quick_entry": 1, "read_only": 0, "read_only_onload": 0, - "search_fields": "customer_name,customer_group,territory, mobile_no", + "search_fields": "customer_name,customer_group,territory, mobile_no,primary_address", "show_name_in_global_search": 1, "sort_order": "ASC", "title_field": "customer_name", diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index eaa82b3713..b8b2ee35cc 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -306,3 +306,15 @@ def get_customer_primary_contact(doctype, txt, searchfield, start, page_len, fil 'customer': customer, 'txt': '%%%s%%' % txt }) + +def get_customer_primary_address(doctype, txt, searchfield, start, page_len, filters): + customer = frappe.db.escape(filters.get('customer')) + return frappe.db.sql(""" + select `tabAddress`.name from `tabAddress`, `tabDynamic Link` + where `tabAddress`.name = `tabDynamic Link`.parent and `tabDynamic Link`.link_name = %(customer)s + and `tabDynamic Link`.link_doctype = 'Customer' and `tabAddress`.is_primary_address = 1 + and `tabAddress`.name like %(txt)s + """, { + 'customer': customer, + 'txt': '%%%s%%' % txt + }) \ No newline at end of file From b664488d9847f838544a9258667cec701a27c081 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Sat, 20 Jan 2018 03:12:45 +0530 Subject: [PATCH 02/12] [Fix] Clears off the read-only fields in 'Primary Address and Contact Details' Section on blank link fields --- erpnext/selling/doctype/customer/customer.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index 54f974cc20..0f8602a9be 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -42,6 +42,17 @@ frappe.ui.form.on("Customer", { } }) }, + customer_primary_address: function(frm){ + if(!frm.doc.customer_primary_address){ + frm.doc.primary_address = "" + } + }, + customer_primary_contact: function(frm){ + if(!frm.doc.customer_primary_contact){ + frm.doc.mobile_no = ""; + frm.doc.email_id = ""; + } + }, refresh: function(frm) { if(frappe.defaults.get_default("cust_master_name")!="Naming Series") { From 24946ee4e0d1e31b35a05d92df107c21b7d4bbf7 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Sat, 20 Jan 2018 04:28:35 +0530 Subject: [PATCH 03/12] Codacy fix --- erpnext/selling/doctype/customer/customer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index 0f8602a9be..2dbbdf1051 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -44,7 +44,7 @@ frappe.ui.form.on("Customer", { }, customer_primary_address: function(frm){ if(!frm.doc.customer_primary_address){ - frm.doc.primary_address = "" + frm.doc.primary_address = ""; } }, customer_primary_contact: function(frm){ From 6614d8aa014f2e12be77405426c559dd3cb68928 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Thu, 25 Jan 2018 12:27:00 +0530 Subject: [PATCH 04/12] Multiple changes: [Mod] Added 'primary_address_and_contact_detail' in toggle_display [Mod] Added a description for 'primary_address_and_contact_detail' --- erpnext/selling/doctype/customer/customer.js | 2 +- erpnext/selling/doctype/customer/customer.json | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index 2dbbdf1051..16f0fafc67 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -63,7 +63,7 @@ frappe.ui.form.on("Customer", { frappe.dynamic_link = {doc: frm.doc, fieldname: 'name', doctype: 'Customer'} - frm.toggle_display(['address_html','contact_html'], !frm.doc.__islocal); + frm.toggle_display(['address_html','contact_html','primary_address_and_contact_detail'], !frm.doc.__islocal); if(!frm.doc.__islocal) { frappe.contacts.render_address_and_contact(frm); diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json index 7e2c658022..1a104b543b 100644 --- a/erpnext/selling/doctype/customer/customer.json +++ b/erpnext/selling/doctype/customer/customer.json @@ -725,7 +725,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "primary_contact_detail", + "description": "Select, to make the customer searchable with these fields", + "fieldname": "primary_address_and_contact_detail", "fieldtype": "Section Break", "hidden": 0, "ignore_user_permissions": 0, @@ -1417,7 +1418,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-01-20 02:07:05.098742", + "modified": "2018-01-25 12:20:24.665219", "modified_by": "Administrator", "module": "Selling", "name": "Customer", From aaaf5c62b6a9c3ea0d116481aed60deb9dda35bf Mon Sep 17 00:00:00 2001 From: Saurabh Date: Thu, 25 Jan 2018 17:28:57 +0530 Subject: [PATCH 05/12] [Mod] Minor changes in 'primary_address' field's property --- erpnext/selling/doctype/customer/customer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json index 1a104b543b..affe387b55 100644 --- a/erpnext/selling/doctype/customer/customer.json +++ b/erpnext/selling/doctype/customer/customer.json @@ -927,7 +927,7 @@ "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, - "read_only": 1, + "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, @@ -1418,7 +1418,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-01-25 12:20:24.665219", + "modified": "2018-01-25 17:26:34.847775", "modified_by": "Administrator", "module": "Selling", "name": "Customer", From 2056ea6fb48d783a46248151c4c41a38e403eb72 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Wed, 31 Jan 2018 14:48:53 +0530 Subject: [PATCH 06/12] Update customer.js --- erpnext/selling/doctype/customer/customer.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index 16f0fafc67..55aaa02428 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -44,13 +44,13 @@ frappe.ui.form.on("Customer", { }, customer_primary_address: function(frm){ if(!frm.doc.customer_primary_address){ - frm.doc.primary_address = ""; + frm.set_value("primary_address", ""); } }, customer_primary_contact: function(frm){ if(!frm.doc.customer_primary_contact){ - frm.doc.mobile_no = ""; - frm.doc.email_id = ""; + frm.set_value("mobile_no", ""); + frm.set_value("email_id", ""); } }, @@ -92,4 +92,4 @@ frappe.ui.form.on("Customer", { validate: function(frm) { if(frm.doc.lead_name) frappe.model.clear_doc("Lead", frm.doc.lead_name); }, -}); \ No newline at end of file +}); From 9f5c2002ff46b7fd2c0e6ff9d12900ddffda4ce2 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 31 Jan 2018 17:43:58 +0530 Subject: [PATCH 07/12] [Mod] Removed the Dependency on Frappe PR [Fix] Fixed a possible bug --- erpnext/selling/doctype/customer/customer.json | 4 ++-- erpnext/selling/doctype/customer/customer.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json index affe387b55..ecc14624e5 100644 --- a/erpnext/selling/doctype/customer/customer.json +++ b/erpnext/selling/doctype/customer/customer.json @@ -922,7 +922,7 @@ "label": "Primary Address", "length": 0, "no_copy": 0, - "options": "customer_primary_address.complete_address", + "options": "", "permlevel": 0, "precision": "", "print_hide": 0, @@ -1418,7 +1418,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-01-25 17:26:34.847775", + "modified": "2018-01-31 16:44:52.191083", "modified_by": "Administrator", "module": "Selling", "name": "Customer", diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index b8b2ee35cc..f19173eaa9 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -20,6 +20,7 @@ class Customer(TransactionBase): """Load address and contacts in `__onload`""" load_address_and_contact(self) self.load_dashboard_info() + self.fetch_primary_address_and_contact_detail() def load_dashboard_info(self): info = get_dashboard_info(self.doctype, self.name) @@ -53,6 +54,7 @@ class Customer(TransactionBase): self.flags.old_lead = self.lead_name validate_party_accounts(self) self.validate_credit_limit_on_change() + self.fetch_primary_address_and_contact_detail() def on_update(self): self.validate_name_with_customer_group() @@ -65,6 +67,16 @@ class Customer(TransactionBase): if self.flags.is_new_doc: self.create_lead_address_contact() + def fetch_primary_address_and_contact_detail(self): + if(self.customer_primary_contact): + primary_contact_doc = frappe.get_doc("Contact",self.customer_primary_contact) + self.db_set('mobile_no', primary_contact_doc.mobile_no) + self.db_set('email_id', primary_contact_doc.email_id) + + if(self.customer_primary_address): + primary_address_doc = frappe.get_doc("Address",self.customer_primary_address) + self.db_set('primary_address', "
" + primary_address_doc.get_display()) + def create_primary_contact(self): if not self.customer_primary_contact and not self.lead_name: if self.mobile_no or self.email_id: From 7c8d508e28d693d54811f02b801a142821f20f29 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Thu, 1 Feb 2018 14:38:17 +0530 Subject: [PATCH 08/12] [Mod] Dependant on complete_address field and loads updated mobile_no,address in onload method --- erpnext/selling/doctype/customer/customer.json | 4 ++-- erpnext/selling/doctype/customer/customer.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json index 8a57f6d64d..0ab3b3b1bf 100644 --- a/erpnext/selling/doctype/customer/customer.json +++ b/erpnext/selling/doctype/customer/customer.json @@ -922,7 +922,7 @@ "label": "Primary Address", "length": 0, "no_copy": 0, - "options": "", + "options": "customer_primary_address.complete_address", "permlevel": 0, "precision": "", "print_hide": 0, @@ -1447,7 +1447,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-01-31 16:44:52.191083", + "modified": "2018-02-01 14:36:29.376438", "modified_by": "Administrator", "module": "Selling", "name": "Customer", diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index d0db648ba6..b0c04e601e 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -54,7 +54,6 @@ class Customer(TransactionBase): self.flags.old_lead = self.lead_name validate_party_accounts(self) self.validate_credit_limit_on_change() - self.fetch_primary_address_and_contact_detail() def on_update(self): self.validate_name_with_customer_group() @@ -75,7 +74,7 @@ class Customer(TransactionBase): if(self.customer_primary_address): primary_address_doc = frappe.get_doc("Address",self.customer_primary_address) - self.primary_address = "
" + primary_address_doc.get_display() + self.primary_address = primary_address_doc.complete_address def create_primary_contact(self): if not self.customer_primary_contact and not self.lead_name: From 70d972d92e37845006fae52924d4c2b6c1c414dd Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 2 Feb 2018 16:18:17 +0530 Subject: [PATCH 09/12] [Mod] Added descriptions to alert about reselecting the option in 'primary_address_and_contact_detail' --- erpnext/selling/doctype/customer/customer.json | 4 +++- erpnext/selling/doctype/customer/customer.py | 11 ----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json index 0ab3b3b1bf..2c846cf0c9 100644 --- a/erpnext/selling/doctype/customer/customer.json +++ b/erpnext/selling/doctype/customer/customer.json @@ -756,6 +756,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "description": "Reselect, if the chosen contact is edited after save", "fieldname": "customer_primary_contact", "fieldtype": "Link", "hidden": 0, @@ -878,6 +879,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "description": "Reselect, if the chosen address is edited after save", "fieldname": "customer_primary_address", "fieldtype": "Link", "hidden": 0, @@ -1447,7 +1449,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-02-01 14:36:29.376438", + "modified": "2018-02-02 16:07:11.052268", "modified_by": "Administrator", "module": "Selling", "name": "Customer", diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index b0c04e601e..6f25bf7fd6 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -20,7 +20,6 @@ class Customer(TransactionBase): """Load address and contacts in `__onload`""" load_address_and_contact(self) self.load_dashboard_info() - self.fetch_primary_address_and_contact_detail() def load_dashboard_info(self): info = get_dashboard_info(self.doctype, self.name) @@ -66,16 +65,6 @@ class Customer(TransactionBase): if self.flags.is_new_doc: self.create_lead_address_contact() - def fetch_primary_address_and_contact_detail(self): - if(self.customer_primary_contact): - primary_contact_doc = frappe.get_doc("Contact",self.customer_primary_contact) - self.mobile_no = primary_contact_doc.mobile_no - self.email_id = primary_contact_doc.email_id - - if(self.customer_primary_address): - primary_address_doc = frappe.get_doc("Address",self.customer_primary_address) - self.primary_address = primary_address_doc.complete_address - def create_primary_contact(self): if not self.customer_primary_contact and not self.lead_name: if self.mobile_no or self.email_id: From b4ab89e1dac3760e51634b7f14ca7def736215ee Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 9 Feb 2018 10:49:30 +0530 Subject: [PATCH 10/12] [Mod] Code refactored to remove dependency on 'complete_address' field --- erpnext/selling/doctype/customer/customer.js | 14 +++++++++++++- erpnext/selling/doctype/customer/customer.json | 4 ++-- erpnext/selling/doctype/customer/customer.py | 4 ++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index 55aaa02428..1994bd31e7 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -43,6 +43,18 @@ frappe.ui.form.on("Customer", { }) }, customer_primary_address: function(frm){ + if(frm.doc.customer_primary_address){ + frappe.call({ + doc: frm.doc, + args: { + "address_title":frm.doc.customer_primary_address + }, + method: 'get_display', + callback: function(r) { + frm.set_value("primary_address",r.message); + } + }); + } if(!frm.doc.customer_primary_address){ frm.set_value("primary_address", ""); } @@ -92,4 +104,4 @@ frappe.ui.form.on("Customer", { validate: function(frm) { if(frm.doc.lead_name) frappe.model.clear_doc("Lead", frm.doc.lead_name); }, -}); +}); \ No newline at end of file diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json index 2c846cf0c9..d43de100cf 100644 --- a/erpnext/selling/doctype/customer/customer.json +++ b/erpnext/selling/doctype/customer/customer.json @@ -924,7 +924,7 @@ "label": "Primary Address", "length": 0, "no_copy": 0, - "options": "customer_primary_address.complete_address", + "options": "", "permlevel": 0, "precision": "", "print_hide": 0, @@ -1449,7 +1449,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-02-02 16:07:11.052268", + "modified": "2018-02-09 10:44:35.801716", "modified_by": "Administrator", "module": "Selling", "name": "Customer", diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index 6f25bf7fd6..94aeed972c 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -77,6 +77,10 @@ class Customer(TransactionBase): if self.flags.is_new_doc and self.get('address_line1'): make_address(self) + def get_display(self,address_title): + from frappe.contacts.doctype.address.address import get_address_display + return get_address_display(address_title) + def update_lead_status(self): '''If Customer created from Lead, update lead status to "Converted" update Customer link in Quotation, Opportunity''' From 0f3c4fa7a7da82b1aa626a4faeac4cceb859afd6 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 9 Feb 2018 11:30:11 +0530 Subject: [PATCH 11/12] Codacy fix - used classmethod decorator --- erpnext/selling/doctype/customer/customer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index 94aeed972c..518952f424 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -77,6 +77,7 @@ class Customer(TransactionBase): if self.flags.is_new_doc and self.get('address_line1'): make_address(self) + @classmethod def get_display(self,address_title): from frappe.contacts.doctype.address.address import get_address_display return get_address_display(address_title) From 662b23ce570add7d7c5bbeadc0b6046fbfc98756 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 12 Feb 2018 19:25:00 +0530 Subject: [PATCH 12/12] get address display in customer --- erpnext/selling/doctype/customer/customer.js | 6 +++--- erpnext/selling/doctype/customer/customer.py | 5 ----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index 1994bd31e7..25c3cd22ec 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -47,11 +47,11 @@ frappe.ui.form.on("Customer", { frappe.call({ doc: frm.doc, args: { - "address_title":frm.doc.customer_primary_address + "address_title": frm.doc.customer_primary_address }, - method: 'get_display', + method: 'frappe.contacts.doctype.address.address.get_address_display', callback: function(r) { - frm.set_value("primary_address",r.message); + frm.set_value("primary_address", r.message); } }); } diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index 518952f424..6f25bf7fd6 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -77,11 +77,6 @@ class Customer(TransactionBase): if self.flags.is_new_doc and self.get('address_line1'): make_address(self) - @classmethod - def get_display(self,address_title): - from frappe.contacts.doctype.address.address import get_address_display - return get_address_display(address_title) - def update_lead_status(self): '''If Customer created from Lead, update lead status to "Converted" update Customer link in Quotation, Opportunity'''