diff --git a/config.json b/config.json index d30c6976e0f..e0f98d8daaa 100644 --- a/config.json +++ b/config.json @@ -103,7 +103,12 @@ "no_cache": true, "template": "app/website/templates/pages/sale", "args_method": "website.helpers.transaction.get_order_args", - "for_doctype": "Sales Order" + "portal": { + "doctype": "Sales Order", + "conditions": { + "docstatus": 1 + } + } }, "orders": { "no_cache": true, @@ -114,7 +119,12 @@ "no_cache": true, "template": "app/website/templates/pages/sale", "args_method": "website.helpers.transaction.get_invoice_args", - "for_doctype": "Sales Invoice" + "portal": { + "doctype": "Sales Invoice", + "conditions": { + "docstatus": 1 + } + } }, "invoices": { "no_cache": true, @@ -125,7 +135,12 @@ "no_cache": true, "template": "app/website/templates/pages/sale", "args_method": "website.helpers.transaction.get_shipment_args", - "for_doctype": "Delivery Note" + "portal": { + "doctype": "Delivery Note", + "conditions": { + "docstatus": 1 + } + } }, "shipments": { "no_cache": true, @@ -139,7 +154,9 @@ "no_cache": true, "template": "app/website/templates/pages/ticket", "args_method": "support.doctype.support_ticket.support_ticket.get_website_args", - "for_doctype": "Support Ticket" + "portal": { + "doctype": "Support Ticket" + } }, "tickets": { "template": "app/website/templates/pages/tickets", diff --git a/public/js/website_utils.js b/public/js/website_utils.js index 1b7f0f728dc..9b7832678a5 100644 --- a/public/js/website_utils.js +++ b/public/js/website_utils.js @@ -1,7 +1,6 @@ // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. // License: GNU General Public License v3. See license.txt - if(!window.erpnext) erpnext = {}; if(!window.wn) wn = {}; @@ -200,7 +199,7 @@ $.extend(wn.cart, { update_cart: function(opts) { if(!full_name) { if(localStorage) { - localStorage.setItem("last_visited", window.location.pathname.slice(1)); + localStorage.setItem("last_visited", window.location.href.split("/").slice(-1)[0]); localStorage.setItem("pending_add_to_cart", opts.item_code); } window.location.href = "login"; @@ -242,4 +241,13 @@ function is_html(txt) { return false; } return true; +} + +function ask_to_login() { + if(!full_name) { + if(localStorage) { + localStorage.setItem("last_visited", window.location.href.split("/").slice(-1)[0]); + } + window.location.href = "login"; + } } \ No newline at end of file diff --git a/website/templates/pages/sale.html b/website/templates/pages/sale.html index 669a3807f88..1c03da261a2 100644 --- a/website/templates/pages/sale.html +++ b/website/templates/pages/sale.html @@ -11,6 +11,9 @@
{{ webnotes.utils.is_html(comm.content) and comm.content or
comm.content.replace("\n", "
")}}