[fixes] setup wizard and other fixes related to cart

This commit is contained in:
Anand Doshi
2015-09-23 12:46:59 +05:30
committed by Rushabh Mehta
parent 52dfc32eca
commit 06ad308ca1
17 changed files with 574 additions and 861 deletions

View File

@@ -5,36 +5,31 @@ from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import cstr
from erpnext.shopping_cart.cart import get_lead_or_customer
from erpnext.shopping_cart.cart import get_customer
no_cache = 1
no_sitemap = 1
def get_context(context):
party = get_lead_or_customer()
if party.doctype == "Lead":
mobile_no = party.mobile_no
phone = party.phone
else:
mobile_no, phone = frappe.db.get_value("Contact", {"email_id": frappe.session.user,
"customer": party.name}, ["mobile_no", "phone"])
party = get_customer()
mobile_no, phone = frappe.db.get_value("Contact", {"email_id": frappe.session.user,
"customer": party.name}, ["mobile_no", "phone"])
return {
"company_name": cstr(party.customer_name if party.doctype == "Customer" else party.company_name),
"mobile_no": cstr(mobile_no),
"phone": cstr(phone)
}
@frappe.whitelist()
def update_user(fullname, password=None, company_name=None, mobile_no=None, phone=None):
from erpnext.shopping_cart.cart import update_party
update_party(fullname, company_name, mobile_no, phone)
if not fullname:
return _("Name is required")
frappe.db.set_value("User", frappe.session.user, "first_name", fullname)
frappe.local.cookie_manager.set_cookie("full_name", fullname)
return _("Updated")