[webshop] Place Order - submits Quotation, creates Customer if required, creates and submits Sales Order
diff --git a/startup/event_handlers.py b/startup/event_handlers.py
index f0c73a5..cd5cebf 100644
--- a/startup/event_handlers.py
+++ b/startup/event_handlers.py
@@ -6,7 +6,6 @@
import webnotes
import home
-
def on_login_post_session(login_manager):
"""
called after login
@@ -30,7 +29,14 @@
'%s logged in at %s' % (get_user_fullname(login_manager.user), nowtime()),
login_manager.user=='Administrator' and '#8CA2B3' or '#1B750D')
webnotes.conn.commit()
-
+
+ if webnotes.cookies.get("full_name"):
+ from website.helpers.cart import set_cart_count
+ set_cart_count()
+
+def on_logout(login_manager):
+ webnotes.add_cookies["cart_count"] = ""
+
def check_if_expired():
"""check if account is expired. If expired, do not allow login"""
import conf
diff --git a/startup/website.py b/startup/webutils.py
similarity index 69%
rename from startup/website.py
rename to startup/webutils.py
index dfaba02..4c1f528 100644
--- a/startup/website.py
+++ b/startup/webutils.py
@@ -62,6 +62,30 @@
args.url = quote(str(get_request_site_address(full_address=True)), str(""))
args.encoded_title = quote(encode(args.title or ""), str(""))
+ args.shopping_cart_enabled = cint(webnotes.conn.get_default("shopping_cart_enabled"))
return args
-
\ No newline at end of file
+
+@webnotes.whitelist()
+def update_profile(fullname, password=None, company_name=None, mobile_no=None, phone=None):
+ from website.helpers.cart import update_party
+ update_party(fullname, company_name, mobile_no, phone)
+
+ from core.doctype.profile import profile
+ return profile.update_profile(fullname, password)
+
+def get_profile_args():
+ from website.helpers.cart import get_lead_or_customer
+ party = get_lead_or_customer()
+ if party.doctype == "Lead":
+ mobile_no = party.mobile_no
+ phone = party.phone
+ else:
+ mobile_no, phone = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user,
+ "customer": party.name})
+
+ return {
+ "company_name": party.customer_name if party.doctype == "Customer" else party.company_name,
+ "mobile_no": mobile_no,
+ "phone": phone
+ }
\ No newline at end of file