From d743583bf43d6e059c3402760e74a88359d5d2e5 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Wed, 6 Nov 2019 18:03:03 +0530 Subject: [PATCH] fix: contact creation and fetching for shopping cart (#19510) --- erpnext/shopping_cart/cart.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index a4c10cfb7d6..a0ac7916196 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -11,6 +11,7 @@ from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings from frappe.utils.nestedset import get_root_of from erpnext.accounts.utils import get_account_name from erpnext.utilities.product import get_qty_in_stock +from frappe.contacts.doctype.contact.contact import get_contact_name class WebsitePriceListMissingError(frappe.ValidationError): @@ -371,7 +372,7 @@ def get_party(user=None): if not user: user = frappe.session.user - contact_name = frappe.db.get_value("Contact", {"email_id": user}) + contact_name = get_contact_name(user) party = None if contact_name: @@ -417,7 +418,7 @@ def get_party(user=None): contact = frappe.new_doc("Contact") contact.update({ "first_name": fullname, - "email_id": user + "email_ids": [{"email_id": user, "is_primary": 1}] }) contact.append('links', dict(link_doctype='Customer', link_name=customer.name)) contact.flags.ignore_mandatory = True