Anand Doshi | b0d996f | 2013-09-10 18:29:39 +0530 | [diff] [blame] | 1 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. |
| 2 | # License: GNU General Public License v3. See license.txt |
| 3 | |
| 4 | from __future__ import unicode_literals |
| 5 | import webnotes |
| 6 | from webnotes.utils import cstr |
| 7 | |
| 8 | no_cache = True |
| 9 | |
| 10 | def 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() |
| 27 | def 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) |