From 4f0a4a1a2dc5452eb6c3c26afc856201607f0fa6 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Wed, 10 Apr 2019 16:04:22 +0530 Subject: [PATCH] fix: Customer dashboard fixes --- erpnext/selling/doctype/customer/customer_dashboard.py | 3 +++ erpnext/selling/doctype/quotation/quotation.py | 10 +++++----- erpnext/shopping_cart/test_shopping_cart.py | 1 - 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/erpnext/selling/doctype/customer/customer_dashboard.py b/erpnext/selling/doctype/customer/customer_dashboard.py index f2f430a61e2..b7175c9675d 100644 --- a/erpnext/selling/doctype/customer/customer_dashboard.py +++ b/erpnext/selling/doctype/customer/customer_dashboard.py @@ -6,6 +6,9 @@ def get_data(): 'heatmap': True, 'heatmap_message': _('This is based on transactions against this Customer. See timeline below for details'), 'fieldname': 'customer', + 'non_standard_fieldnames': { + 'Quotation': 'customer_lead' + }, 'transactions': [ { 'label': _('Pre Sales'), diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index 8feb3b9d5f4..e99b635af9b 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -122,8 +122,8 @@ def _make_sales_order(source_name, target_doc=None, ignore_permissions=False): def set_missing_values(source, target): if customer: - target.customer = customer - target.customer_name = customer + target.customer = customer.name + target.customer_name = customer.customer_name target.ignore_pricing_rule = 1 target.flags.ignore_permissions = ignore_permissions target.run_method("set_missing_values") @@ -169,8 +169,8 @@ def _make_sales_invoice(source_name, target_doc=None, ignore_permissions=False): def set_missing_values(source, target): if customer: - target.customer = customer - target.customer_name = customer + target.customer = customer.name + target.customer_name = customer.customer_name target.ignore_pricing_rule = 1 target.flags.ignore_permissions = ignore_permissions target.run_method("set_missing_values") @@ -235,4 +235,4 @@ def _make_customer(source_name, ignore_permissions=False): else: return customer_name else: - return quotation[2] + return frappe.get_doc("Customer",quotation[2]) diff --git a/erpnext/shopping_cart/test_shopping_cart.py b/erpnext/shopping_cart/test_shopping_cart.py index d1124a662b6..adf57b85cdf 100644 --- a/erpnext/shopping_cart/test_shopping_cart.py +++ b/erpnext/shopping_cart/test_shopping_cart.py @@ -33,7 +33,6 @@ class TestShoppingCart(unittest.TestCase): self.assertEqual(quotation.quotation_to, "Customer") self.assertEqual(quotation.contact_person, frappe.db.get_value("Contact", dict(email_id="test_cart_user@example.com"))) - self.assertEqual(quotation.customer_lead, None) self.assertEqual(quotation.contact_email, frappe.session.user) return quotation