order preview through customer login

This commit is contained in:
Nabin Hait 2014-01-23 13:25:26 +05:30
parent c7676797e1
commit 557abdebe0
4 changed files with 18 additions and 14 deletions

View File

@ -10,9 +10,9 @@
<li class="active"><i class="icon-file icon-fixed-width"></i> {{ doc.name }}</li> <li class="active"><i class="icon-file icon-fixed-width"></i> {{ doc.name }}</li>
</ul> </ul>
<h3><i class="icon-file icon-fixed-width"></i> {{ doc.name }}</h3> <h3><i class="icon-file icon-fixed-width"></i> {{ doc.name }}</h3>
{% if doc.name == "Not Allowed" -%} {% if session_user == "Guest" -%}
<script>ask_to_login();</script> <script>ask_to_login();</script>
{% else %} {% elif doc.name != "Not Allowed"%}
<hr> <hr>
<div> <div>
<div class="row"> <div class="row">

View File

@ -41,21 +41,23 @@ def get_currency_context():
} }
def get_transaction_context(doctype, name): def get_transaction_context(doctype, name):
context = {"session_user": webnotes.session.user}
customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user}, customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user},
"customer") "customer")
bean = webnotes.bean(doctype, name) bean = webnotes.bean(doctype, name)
if bean.doc.customer != customer: if bean.doc.customer != customer:
return { context.update({"doc": {"name": "Not Allowed"}})
"doc": {"name": "Not Allowed"}
}
else: else:
return { context.update({
"doc": bean.doc, "doc": bean.doc,
"doclist": bean.doclist, "doclist": bean.doclist,
"webnotes": webnotes, "webnotes": webnotes,
"utils": webnotes.utils "utils": webnotes.utils
} })
return context
@webnotes.whitelist(allow_guest=True) @webnotes.whitelist(allow_guest=True)
def send_message(subject="Website Query", message="", sender="", status="Open"): def send_message(subject="Website Query", message="", sender="", status="Open"):

View File

@ -10,11 +10,12 @@ no_cache = True
def get_context(): def get_context():
from portal.utils import get_transaction_context from portal.utils import get_transaction_context
context = get_transaction_context("Sales Order", webnotes.form_dict.name) context = get_transaction_context("Sales Order", webnotes.form_dict.name)
modify_status(context.get("doc")) if context.get("doc").get("name") != "Not Allowed":
context.update({ modify_status(context.get("doc"))
"parent_link": "orders", context.update({
"parent_title": "My Orders" "parent_link": "orders",
}) "parent_title": "My Orders"
})
return context return context
def modify_status(doc): def modify_status(doc):

View File

@ -282,7 +282,7 @@ def apply_cart_settings(party=None, quotation=None):
party = get_lead_or_customer() party = get_lead_or_customer()
if not quotation: if not quotation:
quotation = _get_cart_quotation(party) quotation = _get_cart_quotation(party)
cart_settings = webnotes.get_obj("Shopping Cart Settings") cart_settings = webnotes.get_obj("Shopping Cart Settings")
billing_territory = get_address_territory(quotation.doc.customer_address) or \ billing_territory = get_address_territory(quotation.doc.customer_address) or \
@ -310,7 +310,8 @@ def set_price_list_and_rate(quotation, cart_settings, billing_territory):
quotation.run_method("set_price_list_and_item_details") quotation.run_method("set_price_list_and_item_details")
# set it in cookies for using in product page # set it in cookies for using in product page
webnotes.local._response.set_cookie("selling_price_list", quotation.doc.selling_price_list) if quotation.doc.selling_price_list:
webnotes.local._response.set_cookie("selling_price_list", quotation.doc.selling_price_list)
def set_taxes(quotation, cart_settings, billing_territory): def set_taxes(quotation, cart_settings, billing_territory):
"""set taxes based on billing territory""" """set taxes based on billing territory"""