blob: b7be74cdcd0a665249fe1b8bb1fbdd402eb6496c [file] [log] [blame]
Anand Doshib0d996f2013-09-10 18:29:39 +05301# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
2# License: GNU General Public License v3. See license.txt
3
4from __future__ import unicode_literals
5import webnotes
6from webnotes.utils import cstr
7
8no_cache = True
9
10def get_context():
11 from selling.utils.cart import get_lead_or_customer
12 party = get_lead_or_customer()
13 if party.doctype == "Lead":
14 mobile_no = party.mobile_no
15 phone = party.phone
16 else:
17 mobile_no, phone = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user,
18 "customer": party.name}, ["mobile_no", "phone"])
19
20 return {
21 "company_name": cstr(party.customer_name if party.doctype == "Customer" else party.company_name),
22 "mobile_no": cstr(mobile_no),
23 "phone": cstr(phone)
24 }
25
26@webnotes.whitelist()
27def update_profile(fullname, password=None, company_name=None, mobile_no=None, phone=None):
28 from selling.utils.cart import update_party
29 update_party(fullname, company_name, mobile_no, phone)
30
31 from core.doctype.profile import profile
32 return profile.update_profile(fullname, password)