Merge pull request #5646 from saurabh6790/V7_cheque_print_and_doc_flow_fixes

V7 cheque print and documnet flow fixes
diff --git a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
index 14543c4..a6cc8ba 100644
--- a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
+++ b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
@@ -15,7 +15,7 @@
 	if not frappe.db.exists("Print Format", template_name):
 		cheque_print = frappe.new_doc("Print Format")
 		cheque_print.update({
-			"doc_type": "Journal Entry",
+			"doc_type": "Payment Entry",
 			"standard": "No",
 			"custom_format": 1,
 			"print_format_type": "Server",
@@ -35,24 +35,24 @@
 		</span>
 		<span style="top:%(date_dist_from_top_edge)s cm; left:%(date_dist_from_left_edge)scm;
 			position: absolute;">
-			{{doc.cheque_date or '' }}
+			{{doc.reference_date or '' }}
 		</span>
 		<span style="top:%(acc_no_dist_from_top_edge)scm;left:%(acc_no_dist_from_left_edge)scm;
 			position: absolute;">
-			{{ doc.account_no }}
+			{{ doc.account_no or '' }}
 		</span>
 		<span style="top:%(payer_name_from_top_edge)scm;left: %(payer_name_from_left_edge)scm;
 			position: absolute;">
-			{{doc.pay_to_recd_from}}
+			{{doc.party}}
 		</span>
 		<span style="top:%(amt_in_words_from_top_edge)scm; left:%(amt_in_words_from_left_edge)scm;
 			position: absolute; display: block; width: %(amt_in_word_width)scm;
 			line-height:%(amt_in_words_line_spacing)scm; word-wrap: break-word;">
-				{{doc.total_amount_in_words}}
+				{{frappe.utils.money_in_words(doc.base_paid_amount or doc.base_received_amount)}}
 		</span>
 		<span style="top:%(amt_in_figures_from_top_edge)scm;left: %(amt_in_figures_from_left_edge)scm;
 			position: absolute;">
-			{{doc.get_formatted("total_amount")}}
+			{{doc.get_formatted("base_paid_amount") or doc.get_formatted("base_received_amount")}}
 		</span>
 		<span style="top:%(signatory_from_top_edge)scm;left: %(signatory_from_left_edge)scm;
 			position: absolute;">
diff --git a/erpnext/config/accounts.py b/erpnext/config/accounts.py
index e93f017..4bb65e8 100644
--- a/erpnext/config/accounts.py
+++ b/erpnext/config/accounts.py
@@ -236,6 +236,11 @@
 					"name": "Asset Movement",
 					"description": _("Transfer an asset from one warehouse to another")
 				},
+				{
+					"type": "doctype",
+					"name": "Cheque Print Template",
+					"description": _("Setup cheque dimensions for printing")
+				},
 			]
 		},
 		{
diff --git a/erpnext/public/js/utils/document_flow.js b/erpnext/public/js/utils/document_flow.js
index eaad6f8..d453c68 100644
--- a/erpnext/public/js/utils/document_flow.js
+++ b/erpnext/public/js/utils/document_flow.js
@@ -5,23 +5,23 @@
 
 $.extend(frappe.document_flow, {
 	"Selling": {
-		"Sales Order": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"],
-		"Quotation": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"]
+		"Sales Order": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Payment Entry"],
+		"Quotation": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Payment Entry"]
 	},
 	"Accounts": {
-		"Sales Invoice": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"],
+		"Sales Invoice": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Payment Entry"],
 		"Purchase Invoice": ["Supplier Quotation", "Purchase Order", "Purchase Receipt",
-			"Purchase Invoice", "Journal Entry"]
+			"Purchase Invoice", "Payment Entry"]
 	},
 	"Buying": {
 		"Purchase Order": ["Supplier Quotation", "Purchase Order", "Purchase Receipt",
-			"Purchase Invoice", "Journal Entry"],
+			"Purchase Invoice", "Payment Entry"],
 		"Supplier Quotation": ["Supplier Quotation", "Purchase Order", "Purchase Receipt",
-			"Purchase Invoice", "Journal Entry"]
+			"Purchase Invoice", "Payment Entry"]
 	},
 	"Stock": {
-		"Delivery Note": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"],
+		"Delivery Note": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Payment Entry"],
 		"Purchase Receipt": ["Supplier Quotation", "Purchase Order", "Purchase Receipt",
-			"Purchase Invoice", "Journal Entry"]
+			"Purchase Invoice", "Payment Entry"]
 	}
 });