[document & fixes] document and test case rewrite
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.json b/erpnext/accounts/doctype/payment_request/payment_request.json
index a0dd9f4..0c0afdc 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.json
+++ b/erpnext/accounts/doctype/payment_request/payment_request.json
@@ -329,7 +329,7 @@
    "unique": 0
   }, 
   {
-   "allow_on_submit": 1, 
+   "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
    "fieldname": "message", 
@@ -484,7 +484,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2015-12-23 23:49:22.755235", 
+ "modified": "2015-12-29 12:56:45.456546", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Payment Request", 
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py
index 6fa3afd..207872a 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.py
+++ b/erpnext/accounts/doctype/payment_request/payment_request.py
@@ -132,6 +132,9 @@
 		"reference_name": args.dn
 	})
 	
+	if args.return_doc:
+		return pr
+		
 	if args.submit_doc:
 		pr.insert(ignore_permissions=True)
 		pr.submit()
@@ -146,14 +149,14 @@
 def get_amount(ref_doc, dt):
 	"""get amount based on doctype"""
 	if dt == "Sales Order":
-		party_account = get_party_account("Customer", ref_doc.get('customer'), ref_doc.company)
-		party_account_currency = get_account_currency(party_account)
-		
-		if party_account_currency == ref_doc.company_currency:
-			amount = flt(ref_doc.base_grand_total) - flt(ref_doc.advance_paid)
-		else:
-			amount = flt(ref_doc.grand_total) - flt(ref_doc.advance_paid)
-	
+		# party_account = get_party_account("Customer", ref_doc.get('customer'), ref_doc.company)
+# 		party_account_currency = get_account_currency(party_account)
+
+		# if party_account_currency == ref_doc.company_currency:
+		amount = flt(ref_doc.base_grand_total) - flt(ref_doc.advance_paid)
+		# else:
+# 			amount = flt(ref_doc.grand_total) - flt(ref_doc.advance_paid)
+#
 	if dt == "Sales Invoice":
 		amount = abs(ref_doc.outstanding_amount)
 	
diff --git a/erpnext/accounts/doctype/payment_request/test_payment_request.py b/erpnext/accounts/doctype/payment_request/test_payment_request.py
index a2008cc..c9d1705 100644
--- a/erpnext/accounts/doctype/payment_request/test_payment_request.py
+++ b/erpnext/accounts/doctype/payment_request/test_payment_request.py
@@ -72,9 +72,8 @@
 			currency="USD", conversion_rate=50)
 
 		pr = make_payment_request(dt="Sales Invoice", dn=SI_USD.name, recipient_id="saurabh@erpnext.com",
-			mute_email=1, submit_doc=1, payemnt_gateway="_Test Gateway - USD")
-		jv = pr.set_paid()
-
-		self.assertEquals(jv.accounts[0].account, "_Test Receivable USD - _TC")
-		self.assertEquals(jv.accounts[0].account_currency, "USD")
-		self.assertEquals(jv.accounts[1].account, pr.payment_account)
+			mute_email=1, return_doc=1, payemnt_gateway="_Test Gateway - USD")
+		
+		self.assertRaises(frappe.ValidationError, pr.save)
+		
+		
diff --git a/erpnext/docs/assets/img/accounts/pr-details-1.png b/erpnext/docs/assets/img/accounts/pr-details-1.png
new file mode 100644
index 0000000..12e40a6
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/pr-details-1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/accounts/pr-details-2.png b/erpnext/docs/assets/img/accounts/pr-details-2.png
new file mode 100644
index 0000000..43122e3
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/pr-details-2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/accounts/pr-email.png b/erpnext/docs/assets/img/accounts/pr-email.png
new file mode 100644
index 0000000..de1a868
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/pr-email.png
Binary files differ
diff --git a/erpnext/docs/assets/img/accounts/pr-from-si.png b/erpnext/docs/assets/img/accounts/pr-from-si.png
new file mode 100644
index 0000000..c9e654a
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/pr-from-si.png
Binary files differ
diff --git a/erpnext/docs/assets/img/accounts/pr-from-so.png b/erpnext/docs/assets/img/accounts/pr-from-so.png
new file mode 100644
index 0000000..b41ea4f
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/pr-from-so.png
Binary files differ
diff --git a/erpnext/docs/user/manual/en/accounts/index.txt b/erpnext/docs/user/manual/en/accounts/index.txt
index 391a185..5f1b5d5 100644
--- a/erpnext/docs/user/manual/en/accounts/index.txt
+++ b/erpnext/docs/user/manual/en/accounts/index.txt
@@ -1,6 +1,7 @@
 journal-entry
 sales-invoice
 purchase-invoice
+payment-request
 chart-of-accounts
 making-payments
 advance-payment-entry
diff --git a/erpnext/docs/user/manual/en/accounts/pyament-request.md b/erpnext/docs/user/manual/en/accounts/pyament-request.md
new file mode 100644
index 0000000..de97470
--- /dev/null
+++ b/erpnext/docs/user/manual/en/accounts/pyament-request.md
@@ -0,0 +1,28 @@
+Payment Request is mediator between payment gateway and erpnext. From Sales Order or Sales Invoice you can initiate Payment Request. 
+
+- Create Payment Request via Sales Order
+<img class="screenshot" alt="Payment Request" src="{{docs_base_url}}/assets/img/accounts/pr-from-so.png">
+
+- Create payment Request via Sales Invoice
+<img class="screenshot" alt="Payment Request" src="{{docs_base_url}}/assets/img/accounts/pr-from-si.png">
+
+---
+
+Select appropriate Payment Gateway Account on Payment Request. Account head specified on payment gateway will 
+considered to create journal entry. 
+
+Note: Invoice/Order Currency and Payment Gateway Account corruncy should be same.
+
+<img class="screenshot" alt="Payment Request" src="{{docs_base_url}}/assets/img/accounts/pr-details-1.png">
+
+---
+
+##### Notify Customer
+You can notify customer from Payment Request with print format. If customer contact email is mentioned, it will automatically fetch email. If not so you can set email id on Payment Request. 
+
+<img class="screenshot" alt="Payment Request" src="{{docs_base_url}}/assets/img/accounts/pr-details-2.png">
+
+##### Request Mail
+<img class="screenshot" alt="Payment Request" src="{{docs_base_url}}/assets/img/accounts/pr-email.png">
+
+
diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json
index db8cb81..ee97334 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.json
+++ b/erpnext/selling/doctype/sales_order/sales_order.json
@@ -2802,7 +2802,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2015-12-17 16:19:40.324514", 
+ "modified": "2015-12-29 12:32:45.649349", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Sales Order",