[minor] [customer login] renamed order template to sale and use it for order, invoice and delivery note

This commit is contained in:
Anand Doshi
2013-09-04 15:07:00 +05:30
parent 0e23929740
commit d5c18d46d0
5 changed files with 131 additions and 19 deletions

View File

@@ -117,3 +117,29 @@ def message_list_args():
"icon": "icon-comments",
"empty_list_message": "No Messages Found",
}
def get_transaction_args(doctype, name):
customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user},
"customer")
bean = webnotes.bean(doctype, name)
if bean.doc.customer != customer:
return {
"doc": {"name": "Not Allowed"}
}
else:
return {
"doc": bean.doc,
"doclist": bean.doclist,
"webnotes": webnotes,
"utils": webnotes.utils
}
def get_order_args():
return get_transaction_args("Sales Order", webnotes.form_dict.name)
def get_invoice_args():
return get_transaction_args("Sales Invoice", webnotes.form_dict.name)
def get_shipment_args():
return get_transaction_args("Delivery Note", webnotes.form_dict.name)