Allow print before pay in POS (#11590)

diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.json b/erpnext/accounts/doctype/pos_profile/pos_profile.json
index e2246bc..2740ef2 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.json
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.json
@@ -292,6 +292,36 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "allow_print_before_pay", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Allow Print Before Pay", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_4", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index 6b58033..558dd8d 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -1505,11 +1505,15 @@
 			me.make_menu_list()
 		}, "fa fa-plus")
 
-		if (this.frm.doc.docstatus == 1) {
+		if (this.frm.doc.docstatus == 1 || this.pos_profile_data["allow_print_before_pay"]) {
 			this.page.set_secondary_action(__("Print"), function () {
+				me.create_invoice();
 				var html = frappe.render(me.print_template_data, me.frm.doc)
 				me.print_document(html)
 			})
+		}
+		
+		if (this.frm.doc.docstatus == 1) {	
 			this.page.add_menu_item(__("Email"), function () {
 				me.email_prompt()
 			})