diff --git a/config.json b/config.json
index 61df211d01..396905c590 100644
--- a/config.json
+++ b/config.json
@@ -101,19 +101,32 @@
},
"order": {
"no_cache": true,
- "template": "app/website/templates/pages/order",
- "args_method": "selling.doctype.sales_order.sales_order.get_website_args"
+ "template": "app/website/templates/pages/sale",
+ "args_method": "website.helpers.transaction.get_order_args",
+ "for_doctype": "Sales Order"
},
"orders": {
"no_cache": true,
"template": "app/website/templates/pages/sales_transactions",
"args_method": "website.helpers.transaction.order_list_args"
},
+ "invoice": {
+ "no_cache": true,
+ "template": "app/website/templates/pages/sale",
+ "args_method": "website.helpers.transaction.get_invoice_args",
+ "for_doctype": "Sales Invoice"
+ },
"invoices": {
"no_cache": true,
"template": "app/website/templates/pages/sales_transactions",
"args_method": "website.helpers.transaction.invoice_list_args"
},
+ "shipment": {
+ "no_cache": true,
+ "template": "app/website/templates/pages/sale",
+ "args_method": "website.helpers.transaction.get_shipment_args",
+ "for_doctype": "Delivery Note"
+ },
"shipments": {
"no_cache": true,
"template": "app/website/templates/pages/sales_transactions",
@@ -130,7 +143,8 @@
"ticket": {
"no_cache": true,
"template": "app/website/templates/pages/ticket",
- "args_method": "support.doctype.support_ticket.support_ticket.get_website_args"
+ "args_method": "support.doctype.support_ticket.support_ticket.get_website_args",
+ "for_doctype": "Support Ticket"
},
"tickets": {
"template": "app/website/templates/pages/tickets",
diff --git a/selling/doctype/sales_order/sales_order.py b/selling/doctype/sales_order/sales_order.py
index 604c5eb7c9..03530dce48 100644
--- a/selling/doctype/sales_order/sales_order.py
+++ b/selling/doctype/sales_order/sales_order.py
@@ -286,22 +286,6 @@ class DocType(SellingController):
def on_update(self):
pass
-def get_website_args():
- customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user},
- "customer")
- bean = webnotes.bean("Sales Order", webnotes.form_dict.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 set_missing_values(source, target):
bean = webnotes.bean(target)
bean.run_method("onload_post_render")
diff --git a/website/helpers/transaction.py b/website/helpers/transaction.py
index 1aded2efc5..900956b6f1 100644
--- a/website/helpers/transaction.py
+++ b/website/helpers/transaction.py
@@ -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)
diff --git a/website/templates/pages/invoice.html b/website/templates/pages/invoice.html
new file mode 100644
index 0000000000..26ddea43d2
--- /dev/null
+++ b/website/templates/pages/invoice.html
@@ -0,0 +1,88 @@
+{% extends "app/website/templates/html/page.html" %}
+
+{% set title=doc.name %}
+
+{% block content %}
+
+
+
{{ doc.name }}
+
+ {%- if doc.status -%}
+
+
+
+
+ {{ utils.formatdate(doc.transaction_date) }}
+
+
+
+
+
+
+
+
+ Sr |
+ Item Name |
+ Description |
+ Qty |
+ UoM |
+ Basic Rate |
+ Amount |
+
+ {%- for row in doclist.get({"doctype":"Sales Order Item"}) %}
+
+ {{ row.idx }} |
+ {{ row.item_name }} |
+ {{ row.description }} |
+ {{ row.qty }} |
+ {{ row.stock_uom }} |
+ {{ utils.fmt_money(row.export_rate, currency=doc.currency) }} |
+ {{ utils.fmt_money(row.export_amount, currency=doc.currency) }} |
+
+ {% endfor -%}
+
+
+
+
+
+
+
+
+
+
+ Net Total |
+ {{
+ utils.fmt_money(doc.net_total/doc.conversion_rate, currency=doc.currency)
+ }} |
+
+ {%- for charge in doclist.get({"doctype":"Sales Taxes and Charges"}) -%}
+ {%- if not charge.included_in_print_rate -%}
+
+ {{ charge.description }} |
+ {{ utils.fmt_money(charge.tax_amount / doc.conversion_rate, currency=doc.currency) }} |
+
+ {%- endif -%}
+ {%- endfor -%}
+
+ Grand Total |
+ {{ utils.fmt_money(doc.grand_total_export, currency=doc.currency) }} |
+
+
+ Rounded Total |
+ {{ utils.fmt_money(doc.rounded_total_export, currency=doc.currency) }} |
+
+
+
+
+
+
+ {%- endif -%}
+
+{% endblock %}
\ No newline at end of file
diff --git a/website/templates/pages/order.html b/website/templates/pages/sale.html
similarity index 100%
rename from website/templates/pages/order.html
rename to website/templates/pages/sale.html