View Attachments in portal (#8830)

* View Attachments in portal

* HTML beautify correction

* Move option to shopping cart settings

* new field in shopping cart settings for public attachments display in portal
diff --git a/erpnext/templates/pages/order.py b/erpnext/templates/pages/order.py
index 296b907..b453c7e 100644
--- a/erpnext/templates/pages/order.py
+++ b/erpnext/templates/pages/order.py
@@ -5,6 +5,7 @@
 import frappe
 
 from frappe import _
+from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import show_attachments
 
 def get_context(context):
 	context.no_cache = 1
@@ -13,6 +14,9 @@
 	if hasattr(context.doc, "set_indicator"):
 		context.doc.set_indicator()
 
+	if show_attachments():
+                context.attachments = get_attachments(frappe.form_dict.doctype, frappe.form_dict.name)
+
 	context.parents = frappe.form_dict.parents
 	context.payment_ref = frappe.db.get_value("Payment Request",
 		{"reference_name": frappe.form_dict.name}, "name")
@@ -21,3 +25,7 @@
 
 	if not frappe.has_website_permission(context.doc):
 		frappe.throw(_("Not Permitted"), frappe.PermissionError)
+
+def get_attachments(dt, dn):
+        return frappe.get_all("File", fields=["name", "file_name", "file_url", "is_private"],
+                              filters = {"attached_to_name": dn, "attached_to_doctype": dt, "is_private":0})