[Mod] Removed the Dependency on Frappe PR
[Fix] Fixed a possible bug
diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json
index affe387..ecc1462 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 b8b2ee3..f19173e 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -20,6 +20,7 @@
"""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 @@
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 @@
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', "<br>" + 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: