Mode of Payment added to POS Profile
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.json b/erpnext/accounts/doctype/pos_profile/pos_profile.json
index ad224f1..0c5a4bb 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.json
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.json
@@ -78,6 +78,51 @@
    "reqd": 1
   }, 
   {
+   "fieldname": "warehouse", 
+   "fieldtype": "Link", 
+   "label": "Warehouse", 
+   "oldfieldname": "warehouse", 
+   "oldfieldtype": "Link", 
+   "options": "Warehouse", 
+   "permlevel": 0, 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "allow_on_submit": 1, 
+   "fieldname": "letter_head", 
+   "fieldtype": "Link", 
+   "label": "Letter Head", 
+   "oldfieldname": "letter_head", 
+   "oldfieldtype": "Select", 
+   "options": "Letter Head", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0
+  }, 
+  {
+   "fieldname": "tc_name", 
+   "fieldtype": "Link", 
+   "label": "Terms and Conditions", 
+   "oldfieldname": "tc_name", 
+   "oldfieldtype": "Link", 
+   "options": "Terms and Conditions", 
+   "permlevel": 0, 
+   "read_only": 0
+  }, 
+  {
+   "allow_on_submit": 1, 
+   "fieldname": "select_print_heading", 
+   "fieldtype": "Link", 
+   "in_filter": 0, 
+   "label": "Print Heading", 
+   "oldfieldname": "select_print_heading", 
+   "oldfieldtype": "Select", 
+   "options": "Print Heading", 
+   "permlevel": 0, 
+   "read_only": 0
+  }, 
+  {
    "fieldname": "column_break0", 
    "fieldtype": "Column Break", 
    "oldfieldtype": "Column Break", 
@@ -106,6 +151,14 @@
    "reqd": 0
   }, 
   {
+   "fieldname": "mode_of_payment", 
+   "fieldtype": "Link", 
+   "label": "Mode of Payment", 
+   "options": "Mode of Payment", 
+   "permlevel": 0, 
+   "precision": ""
+  }, 
+  {
    "fieldname": "cash_bank_account", 
    "fieldtype": "Link", 
    "label": "Cash/Bank Account", 
@@ -140,17 +193,6 @@
    "reqd": 0
   }, 
   {
-   "fieldname": "warehouse", 
-   "fieldtype": "Link", 
-   "label": "Warehouse", 
-   "oldfieldname": "warehouse", 
-   "oldfieldtype": "Link", 
-   "options": "Warehouse", 
-   "permlevel": 0, 
-   "read_only": 0, 
-   "reqd": 0
-  }, 
-  {
    "fieldname": "cost_center", 
    "fieldtype": "Link", 
    "label": "Cost Center", 
@@ -162,16 +204,6 @@
    "reqd": 1
   }, 
   {
-   "fieldname": "taxes_and_charges", 
-   "fieldtype": "Link", 
-   "label": "Taxes and Charges", 
-   "oldfieldname": "charge", 
-   "oldfieldtype": "Link", 
-   "options": "Sales Taxes and Charges Template", 
-   "permlevel": 0, 
-   "read_only": 0
-  }, 
-  {
    "fieldname": "write_off_account", 
    "fieldtype": "Link", 
    "label": "Write Off Account", 
@@ -190,43 +222,19 @@
    "reqd": 1
   }, 
   {
-   "allow_on_submit": 1, 
-   "fieldname": "letter_head", 
+   "fieldname": "taxes_and_charges", 
    "fieldtype": "Link", 
-   "label": "Letter Head", 
-   "oldfieldname": "letter_head", 
-   "oldfieldtype": "Select", 
-   "options": "Letter Head", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0
-  }, 
-  {
-   "fieldname": "tc_name", 
-   "fieldtype": "Link", 
-   "label": "Terms and Conditions", 
-   "oldfieldname": "tc_name", 
+   "label": "Taxes and Charges", 
+   "oldfieldname": "charge", 
    "oldfieldtype": "Link", 
-   "options": "Terms and Conditions", 
-   "permlevel": 0, 
-   "read_only": 0
-  }, 
-  {
-   "allow_on_submit": 1, 
-   "fieldname": "select_print_heading", 
-   "fieldtype": "Link", 
-   "in_filter": 0, 
-   "label": "Print Heading", 
-   "oldfieldname": "select_print_heading", 
-   "oldfieldtype": "Select", 
-   "options": "Print Heading", 
+   "options": "Sales Taxes and Charges Template", 
    "permlevel": 0, 
    "read_only": 0
   }
  ], 
  "icon": "icon-cog", 
  "idx": 1, 
- "modified": "2015-05-20 05:38:44.482696", 
+ "modified": "2015-07-07 08:56:04.381471", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "POS Profile", 
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 604370b..c620ff7 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -169,6 +169,7 @@
 		if pos:
 			if not for_validate and not self.customer:
 				self.customer = pos.customer
+				self.mode_of_payment = pos.mode_of_payment
 				# self.set_customer_defaults()
 
 			for fieldname in ('territory', 'naming_series', 'currency', 'taxes_and_charges', 'letter_head', 'tc_name',
diff --git a/erpnext/public/js/pos/pos.js b/erpnext/public/js/pos/pos.js
index 164e883..70f3023 100644
--- a/erpnext/public/js/pos/pos.js
+++ b/erpnext/public/js/pos/pos.js
@@ -401,7 +401,8 @@
 
 			this.with_modes_of_payment(function() {
 				// prefer cash payment!
-				var default_mode = me.modes_of_payment.indexOf(__("Cash"))!==-1 ? __("Cash") : undefined;
+				var default_mode = me.frm.doc.mode_of_payment ? me.frm.doc.mode_of_payment : 
+					me.modes_of_payment.indexOf(__("Cash"))!==-1 ? __("Cash") : undefined;
 
 				// show payment wizard
 				var dialog = new frappe.ui.Dialog({