From 09a66c4201298507d8c04d5f32aad28518eeaf36 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 7 Jul 2015 16:41:37 +0530 Subject: [PATCH] Fixed issue with Customer Contacts in Transaction Documents --- erpnext/accounts/party.py | 9 +++++++++ .../buying/doctype/purchase_common/purchase_common.js | 4 ---- erpnext/public/js/controllers/transaction.js | 4 ++++ erpnext/selling/sales_common.js | 4 ---- erpnext/utilities/doctype/contact/contact.py | 1 - 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 5de43a093cc..7c338cda53e 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -74,6 +74,15 @@ def set_contact_details(out, party, party_type): {party_type.lower(): party.name, "is_primary_contact":1}, "name") if not out.contact_person: + out.update({ + "contact_person": None, + "contact_display": None, + "contact_email": None, + "contact_mobile": None, + "contact_phone": None, + "contact_designation": None, + "contact_department": None + }) return out.update(get_contact_details(out.contact_person)) diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index 6e274012835..1b7d20ae822 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -70,10 +70,6 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ erpnext.utils.get_address_display(this.frm); }, - contact_person: function() { - erpnext.utils.get_contact_details(this.frm); - }, - buying_price_list: function() { this.apply_price_list(); }, diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 953800dd08f..0a75dad09eb 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -282,6 +282,10 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ get_company_currency: function() { return erpnext.get_currency(this.frm.doc.company); }, + + contact_person: function() { + erpnext.utils.get_contact_details(this.frm); + }, currency: function() { var me = this; diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index 88ef61e29d3..f3cd8a78338 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -112,10 +112,6 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ erpnext.utils.get_address_display(this.frm, "shipping_address_name", "shipping_address"); }, - contact_person: function() { - erpnext.utils.get_contact_details(this.frm); - }, - sales_partner: function() { this.apply_pricing_rule(); }, diff --git a/erpnext/utilities/doctype/contact/contact.py b/erpnext/utilities/doctype/contact/contact.py index 4158d75193d..314014f5184 100644 --- a/erpnext/utilities/doctype/contact/contact.py +++ b/erpnext/utilities/doctype/contact/contact.py @@ -66,5 +66,4 @@ def get_contact_details(contact): "contact_designation": contact.get("designation"), "contact_department": contact.get("department") } - return out