Set Receivable/Payable account based on party
diff --git a/erpnext/accounts/doctype/account/test_account.py b/erpnext/accounts/doctype/account/test_account.py
index bb9102f..264c31c 100644
--- a/erpnext/accounts/doctype/account/test_account.py
+++ b/erpnext/accounts/doctype/account/test_account.py
@@ -6,21 +6,21 @@
 
 def _make_test_records(verbose):
 	from frappe.test_runner import make_test_objects
-		
+
 	accounts = [
 		# [account_name, parent_account, group_or_ledger]
 		["_Test Account Bank Account", "Bank Accounts", "Ledger", "Bank"],
-		
+
 		["_Test Account Stock Expenses", "Direct Expenses", "Group", None],
 		["_Test Account Shipping Charges", "_Test Account Stock Expenses", "Ledger", "Chargeable"],
 		["_Test Account Customs Duty", "_Test Account Stock Expenses", "Ledger", "Tax"],
 		["_Test Account Insurance Charges", "_Test Account Stock Expenses", "Ledger", "Chargeable"],
-		
-		
+
+
 		["_Test Account Tax Assets", "Current Assets", "Group", None],
 		["_Test Account VAT", "_Test Account Tax Assets", "Ledger", "Tax"],
 		["_Test Account Service Tax", "_Test Account Tax Assets", "Ledger", "Tax"],
-		
+
 		["_Test Account Reserves and Surplus", "Current Liabilities", "Ledger", None],
 
 		["_Test Account Cost for Goods Sold", "Expenses", "Ledger", None],
@@ -29,10 +29,14 @@
 		["_Test Account S&H Education Cess", "_Test Account Tax Assets", "Ledger", "Tax"],
 		["_Test Account CST", "Direct Expenses", "Ledger", "Tax"],
 		["_Test Account Discount", "Direct Expenses", "Ledger", None],
-		
+
 		# related to Account Inventory Integration
 		["_Test Account Stock In Hand", "Current Assets", "Ledger", None],
 		["_Test Account Fixed Assets", "Current Assets", "Ledger", None],
+
+		# Receivable / Payable Account
+		["_Test Receivable", "Current Assets", "Ledger", "Receivable"],
+		["_Test Payable", "Current Liabilities", "Ledger", "Payable"],
 	]
 
 	for company, abbr in [["_Test Company", "_TC"], ["_Test Company 1", "_TC1"]]:
@@ -44,5 +48,5 @@
 				"group_or_ledger": group_or_ledger,
 				"account_type": account_type
 			} for account_name, parent_account, group_or_ledger, account_type in accounts])
-	
-	return test_objects
\ No newline at end of file
+
+	return test_objects
diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.js b/erpnext/accounts/doctype/journal_voucher/journal_voucher.js
index 0a07b4d..fcadad0 100644
--- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.js
+++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.js
@@ -263,3 +263,22 @@
 		})
 	}
 }
+
+frappe.ui.form.on("Journal Voucher Detail", "party", function(frm, cdt, cdn) {
+	var d = locals[cdt][cdn];
+	if(!d.account && d.party_type && d.party) {
+		return frappe.call({
+			method: "erpnext.accounts.party.get_party_account",
+			args: {
+				company: frm.doc.company,
+				party_type: d.party_type,
+				party: d.party
+			},
+			callback: function(r) {
+				if(!r.exc && r.message) {
+					frappe.model.set_value(cdt, cdn, "account", r.message);
+				}
+			}
+		});
+	}
+})
diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py
index df26c35..0fe57e0 100644
--- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py
+++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py
@@ -152,38 +152,36 @@
 
 	def validate_account_in_against_voucher(self, against_field, doctype):
 		payment_against_voucher = frappe._dict()
-		field_dict = {'Sales Invoice': "Debit To",
-			'Purchase Invoice': "Credit To",
-			'Sales Order': "Customer",
-			'Purchase Order': "Supplier"
+		field_dict = {'Sales Invoice': ["Customer", "Debit To"],
+			'Purchase Invoice': ["Supplier", "Credit To"],
+			'Sales Order': ["Customer"],
+			'Purchase Order': ["Supplier"]
 			}
 
 		for d in self.get("entries"):
 			if d.get(against_field):
 				dr_or_cr = "credit" if against_field in ["against_invoice", "against_sales_order"] \
 					else "debit"
-				if against_field in ["against_invoice", "against_sales_order"] \
-					and flt(d.debit) > 0:
+				if against_field in ["against_invoice", "against_sales_order"] and flt(d.debit) > 0:
 					frappe.throw(_("Row {0}: Debit entry can not be linked with a {1}").format(d.idx, doctype))
 
-				if against_field in ["against_voucher", "against_purchase_order"] \
-					and flt(d.credit) > 0:
+				if against_field in ["against_voucher", "against_purchase_order"] and flt(d.credit) > 0:
 					frappe.throw(_("Row {0}: Credit entry can not be linked with a {1}").format(d.idx, doctype))
 
-				voucher_account = frappe.db.get_value(doctype, d.get(against_field), \
-					scrub(field_dict.get(doctype)))
+				against_voucher = frappe.db.get_value(doctype, d.get(against_field),
+					[scrub(d) for d in field_dict.get(doctype)])
 
-				account_master_name = frappe.db.get_value("Account", d.account, "master_name")
-
-				if against_field in ["against_invoice", "against_voucher"] \
-					and voucher_account != d.account:
-					frappe.throw(_("Row {0}: Account {1} does not match with {2} {3} account") \
-						.format(d.idx, d.account, doctype, field_dict.get(doctype)))
+				if against_field in ["against_invoice", "against_voucher"]:
+					if (against_voucher[0] !=d.party or against_voucher[1] != d.account):
+						frappe.throw(_("Row {0}: Party / Account does not match with \
+							Customer / Debit To in {1}").format(d.idx, doctype))
+					else:
+						payment_against_voucher.setdefault(d.get(against_field), []).append(flt(d.get(dr_or_cr)))
 
 				if against_field in ["against_sales_order", "against_purchase_order"]:
-					if voucher_account != account_master_name:
-						frappe.throw(_("Row {0}: Account {1} does not match with {2} {3} Name") \
-							.format(d.idx, d.account, doctype, field_dict.get(doctype)))
+					if against_voucher != d.party:
+						frappe.throw(_("Row {0}: {1} {2} does not match with {3}") \
+							.format(d.idx, d.party_type, d.party, doctype))
 					elif d.is_advance == "Yes":
 						payment_against_voucher.setdefault(d.get(against_field), []).append(flt(d.get(dr_or_cr)))
 
@@ -420,6 +418,8 @@
 
 	# credit customer
 	jv.get("entries")[0].account = si.debit_to
+	jv.get("entries")[0].party_type = "Customer"
+	jv.get("entries")[0].party = si.customer
 	jv.get("entries")[0].balance = get_balance_on(si.debit_to)
 	jv.get("entries")[0].credit = si.outstanding_amount
 	jv.get("entries")[0].against_invoice = si.name
@@ -438,6 +438,8 @@
 
 	# credit supplier
 	jv.get("entries")[0].account = pi.credit_to
+	jv.get("entries")[0].party_type = "Supplier"
+	jv.get("entries")[0].party = pi.supplier
 	jv.get("entries")[0].balance = get_balance_on(pi.credit_to)
 	jv.get("entries")[0].debit = pi.outstanding_amount
 	jv.get("entries")[0].against_voucher = pi.name
@@ -452,7 +454,6 @@
 
 	jv = frappe.new_doc('Journal Voucher')
 	jv.voucher_type = 'Bank Voucher'
-
 	jv.company = doc.company
 	jv.fiscal_year = doc.fiscal_year
 
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index b56351e..1f4218e 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -86,17 +86,13 @@
 				posting_date: this.frm.doc.posting_date,
 				party: this.frm.doc.supplier,
 				party_type: "Supplier",
-				account: this.frm.doc.debit_to,
+				account: this.frm.doc.credit_to,
 				price_list: this.frm.doc.buying_price_list,
 			}, function() {
 			me.apply_pricing_rule();
 		})
 	},
 
-	credit_to: function() {
-		this.supplier();
-	},
-
 	write_off_amount: function() {
 		this.calculate_outstanding_amount();
 		this.frm.refresh_fields();
@@ -169,7 +165,8 @@
 cur_frm.fields_dict['credit_to'].get_query = function(doc) {
 	return{
 		filters:{
-			'report_type': 'Balance Sheet',
+			'account_type': 'Payable',
+			'root_type': 'Liability',
 			'group_or_ledger': 'Ledger',
 			'company': doc.company
 		}
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
index d91c53c..dc48aab 100755
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
@@ -1,970 +1,970 @@
 {
- "allow_import": 1, 
- "autoname": "naming_series:", 
- "creation": "2013-05-21 16:16:39", 
- "docstatus": 0, 
- "doctype": "DocType", 
+ "allow_import": 1,
+ "autoname": "naming_series:",
+ "creation": "2013-05-21 16:16:39",
+ "docstatus": 0,
+ "doctype": "DocType",
  "fields": [
   {
-   "fieldname": "supplier_section", 
-   "fieldtype": "Section Break", 
-   "label": "Supplier", 
-   "options": "icon-user", 
+   "fieldname": "supplier_section",
+   "fieldtype": "Section Break",
+   "label": "Supplier",
+   "options": "icon-user",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "column_break0", 
-   "fieldtype": "Column Break", 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "read_only": 0, 
+   "fieldname": "column_break0",
+   "fieldtype": "Column Break",
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
+   "read_only": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "fieldname": "naming_series", 
-   "fieldtype": "Select", 
-   "label": "Series", 
-   "no_copy": 1, 
-   "oldfieldname": "naming_series", 
-   "oldfieldtype": "Select", 
-   "options": "PINV-", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
+   "fieldname": "naming_series",
+   "fieldtype": "Select",
+   "label": "Series",
+   "no_copy": 1,
+   "oldfieldname": "naming_series",
+   "oldfieldtype": "Select",
+   "options": "PINV-",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
    "reqd": 1
-  }, 
+  },
   {
-   "fieldname": "supplier", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "label": "Supplier", 
-   "oldfieldname": "supplier", 
-   "oldfieldtype": "Link", 
-   "options": "Supplier", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "supplier",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "label": "Supplier",
+   "oldfieldname": "supplier",
+   "oldfieldtype": "Link",
+   "options": "Supplier",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "depends_on": "supplier", 
-   "fieldname": "supplier_name", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "in_list_view": 1, 
-   "label": "Name", 
-   "oldfieldname": "supplier_name", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
+   "depends_on": "supplier",
+   "fieldname": "supplier_name",
+   "fieldtype": "Data",
+   "hidden": 0,
+   "in_list_view": 1,
+   "label": "Name",
+   "oldfieldname": "supplier_name",
+   "oldfieldtype": "Data",
+   "permlevel": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "address_display", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "label": "Address", 
-   "permlevel": 0, 
+   "fieldname": "address_display",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "label": "Address",
+   "permlevel": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "contact_display", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "label": "Contact", 
-   "permlevel": 0, 
+   "fieldname": "contact_display",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "label": "Contact",
+   "permlevel": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "contact_mobile", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "label": "Mobile No", 
-   "permlevel": 0, 
+   "fieldname": "contact_mobile",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "label": "Mobile No",
+   "permlevel": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "contact_email", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "label": "Contact Email", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "contact_email",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "label": "Contact Email",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "column_break1", 
-   "fieldtype": "Column Break", 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "read_only": 0, 
-   "reqd": 0, 
+   "fieldname": "column_break1",
+   "fieldtype": "Column Break",
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
+   "read_only": 0,
+   "reqd": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "default": "Today", 
-   "fieldname": "posting_date", 
-   "fieldtype": "Date", 
-   "in_filter": 1, 
-   "label": "Date", 
-   "no_copy": 0, 
-   "oldfieldname": "posting_date", 
-   "oldfieldtype": "Date", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "reqd": 1, 
+   "default": "Today",
+   "fieldname": "posting_date",
+   "fieldtype": "Date",
+   "in_filter": 1,
+   "label": "Date",
+   "no_copy": 0,
+   "oldfieldname": "posting_date",
+   "oldfieldtype": "Date",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "reqd": 1,
    "search_index": 1
-  }, 
+  },
   {
-   "description": "", 
-   "fieldname": "bill_no", 
-   "fieldtype": "Data", 
-   "in_filter": 1, 
-   "label": "Supplier Invoice No", 
-   "oldfieldname": "bill_no", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "reqd": 0, 
+   "description": "",
+   "fieldname": "bill_no",
+   "fieldtype": "Data",
+   "in_filter": 1,
+   "label": "Supplier Invoice No",
+   "oldfieldname": "bill_no",
+   "oldfieldtype": "Data",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "reqd": 0,
    "search_index": 1
-  }, 
+  },
   {
-   "fieldname": "bill_date", 
-   "fieldtype": "Date", 
-   "in_filter": 1, 
-   "label": "Supplier Invoice Date", 
-   "oldfieldname": "bill_date", 
-   "oldfieldtype": "Date", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "reqd": 0, 
+   "fieldname": "bill_date",
+   "fieldtype": "Date",
+   "in_filter": 1,
+   "label": "Supplier Invoice Date",
+   "oldfieldname": "bill_date",
+   "oldfieldtype": "Date",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "reqd": 0,
    "search_index": 1
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "description": "Start date of current invoice's period", 
-   "fieldname": "from_date", 
-   "fieldtype": "Date", 
-   "label": "From Date", 
-   "no_copy": 1, 
+   "allow_on_submit": 1,
+   "description": "Start date of current invoice's period",
+   "fieldname": "from_date",
+   "fieldtype": "Date",
+   "label": "From Date",
+   "no_copy": 1,
    "permlevel": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "description": "End date of current invoice's period", 
-   "fieldname": "to_date", 
-   "fieldtype": "Date", 
-   "label": "To Date", 
-   "no_copy": 1, 
+   "allow_on_submit": 1,
+   "description": "End date of current invoice's period",
+   "fieldname": "to_date",
+   "fieldtype": "Date",
+   "label": "To Date",
+   "no_copy": 1,
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "amended_from", 
-   "fieldtype": "Link", 
-   "ignore_user_permissions": 1, 
-   "label": "Amended From", 
-   "no_copy": 1, 
-   "oldfieldname": "amended_from", 
-   "oldfieldtype": "Link", 
-   "options": "Purchase Invoice", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "amended_from",
+   "fieldtype": "Link",
+   "ignore_user_permissions": 1,
+   "label": "Amended From",
+   "no_copy": 1,
+   "oldfieldname": "amended_from",
+   "oldfieldtype": "Link",
+   "options": "Purchase Invoice",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "company", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Company", 
-   "oldfieldname": "company", 
-   "oldfieldtype": "Link", 
-   "options": "Company", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "fieldname": "company",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Company",
+   "oldfieldname": "company",
+   "oldfieldtype": "Link",
+   "options": "Company",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "search_index": 1
-  }, 
+  },
   {
-   "fieldname": "currency_price_list", 
-   "fieldtype": "Section Break", 
-   "label": "Currency and Price List", 
-   "options": "icon-tag", 
-   "permlevel": 0, 
+   "fieldname": "currency_price_list",
+   "fieldtype": "Section Break",
+   "label": "Currency and Price List",
+   "options": "icon-tag",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "currency", 
-   "fieldtype": "Link", 
-   "label": "Currency", 
-   "oldfieldname": "currency", 
-   "oldfieldtype": "Select", 
-   "options": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "currency",
+   "fieldtype": "Link",
+   "label": "Currency",
+   "oldfieldname": "currency",
+   "oldfieldtype": "Select",
+   "options": "Currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "description": "The rate at which Bill Currency is converted into company's base currency", 
-   "fieldname": "conversion_rate", 
-   "fieldtype": "Float", 
-   "label": "Exchange Rate", 
-   "oldfieldname": "conversion_rate", 
-   "oldfieldtype": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "description": "The rate at which Bill Currency is converted into company's base currency",
+   "fieldname": "conversion_rate",
+   "fieldtype": "Float",
+   "label": "Exchange Rate",
+   "oldfieldname": "conversion_rate",
+   "oldfieldtype": "Currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "column_break2", 
-   "fieldtype": "Column Break", 
-   "permlevel": 0, 
+   "fieldname": "column_break2",
+   "fieldtype": "Column Break",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "buying_price_list", 
-   "fieldtype": "Link", 
-   "label": "Price List", 
-   "options": "Price List", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "buying_price_list",
+   "fieldtype": "Link",
+   "label": "Price List",
+   "options": "Price List",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "price_list_currency", 
-   "fieldtype": "Link", 
-   "label": "Price List Currency", 
-   "options": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "price_list_currency",
+   "fieldtype": "Link",
+   "label": "Price List Currency",
+   "options": "Currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "plc_conversion_rate", 
-   "fieldtype": "Float", 
-   "label": "Price List Exchange Rate", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "plc_conversion_rate",
+   "fieldtype": "Float",
+   "label": "Price List Exchange Rate",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "ignore_pricing_rule", 
-   "fieldtype": "Check", 
-   "label": "Ignore Pricing Rule", 
-   "no_copy": 1, 
-   "permlevel": 1, 
+   "fieldname": "ignore_pricing_rule",
+   "fieldtype": "Check",
+   "label": "Ignore Pricing Rule",
+   "no_copy": 1,
+   "permlevel": 1,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "items", 
-   "fieldtype": "Section Break", 
-   "label": "Items", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-shopping-cart", 
-   "permlevel": 0, 
+   "fieldname": "items",
+   "fieldtype": "Section Break",
+   "label": "Items",
+   "oldfieldtype": "Section Break",
+   "options": "icon-shopping-cart",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "fieldname": "entries", 
-   "fieldtype": "Table", 
-   "label": "Entries", 
-   "oldfieldname": "entries", 
-   "oldfieldtype": "Table", 
-   "options": "Purchase Invoice Item", 
-   "permlevel": 0, 
+   "allow_on_submit": 1,
+   "fieldname": "entries",
+   "fieldtype": "Table",
+   "label": "Entries",
+   "oldfieldname": "entries",
+   "oldfieldtype": "Table",
+   "options": "Purchase Invoice Item",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "section_break_26", 
-   "fieldtype": "Section Break", 
+   "fieldname": "section_break_26",
+   "fieldtype": "Section Break",
    "permlevel": 0
-  }, 
+  },
   {
-   "description": "Will be calculated automatically when you enter the details", 
-   "fieldname": "net_total", 
-   "fieldtype": "Currency", 
-   "label": "Net Total (Company Currency)", 
-   "oldfieldname": "net_total", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "description": "Will be calculated automatically when you enter the details",
+   "fieldname": "net_total",
+   "fieldtype": "Currency",
+   "label": "Net Total (Company Currency)",
+   "oldfieldname": "net_total",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "column_break_28", 
-   "fieldtype": "Column Break", 
+   "fieldname": "column_break_28",
+   "fieldtype": "Column Break",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "net_total_import", 
-   "fieldtype": "Currency", 
-   "label": "Net Total", 
-   "oldfieldname": "net_total_import", 
-   "oldfieldtype": "Currency", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 0, 
+   "fieldname": "net_total_import",
+   "fieldtype": "Currency",
+   "label": "Net Total",
+   "oldfieldname": "net_total_import",
+   "oldfieldtype": "Currency",
+   "options": "currency",
+   "permlevel": 0,
+   "print_hide": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "taxes", 
-   "fieldtype": "Section Break", 
-   "label": "Taxes and Charges", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-money", 
-   "permlevel": 0, 
+   "fieldname": "taxes",
+   "fieldtype": "Section Break",
+   "label": "Taxes and Charges",
+   "oldfieldtype": "Section Break",
+   "options": "icon-money",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "taxes_and_charges", 
-   "fieldtype": "Link", 
-   "label": "Taxes and Charges", 
-   "oldfieldname": "purchase_other_charges", 
-   "oldfieldtype": "Link", 
-   "options": "Purchase Taxes and Charges Master", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "taxes_and_charges",
+   "fieldtype": "Link",
+   "label": "Taxes and Charges",
+   "oldfieldname": "purchase_other_charges",
+   "oldfieldtype": "Link",
+   "options": "Purchase Taxes and Charges Master",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "other_charges", 
-   "fieldtype": "Table", 
-   "label": "Purchase Taxes and Charges", 
-   "oldfieldname": "purchase_tax_details", 
-   "oldfieldtype": "Table", 
-   "options": "Purchase Taxes and Charges", 
-   "permlevel": 0, 
+   "fieldname": "other_charges",
+   "fieldtype": "Table",
+   "label": "Purchase Taxes and Charges",
+   "oldfieldname": "purchase_tax_details",
+   "oldfieldtype": "Table",
+   "options": "Purchase Taxes and Charges",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "other_charges_calculation", 
-   "fieldtype": "HTML", 
-   "label": "Taxes and Charges Calculation", 
-   "oldfieldtype": "HTML", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "other_charges_calculation",
+   "fieldtype": "HTML",
+   "label": "Taxes and Charges Calculation",
+   "oldfieldtype": "HTML",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "totals", 
-   "fieldtype": "Section Break", 
-   "label": "Totals", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-money", 
-   "permlevel": 0, 
+   "fieldname": "totals",
+   "fieldtype": "Section Break",
+   "label": "Totals",
+   "oldfieldtype": "Section Break",
+   "options": "icon-money",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "other_charges_added", 
-   "fieldtype": "Currency", 
-   "label": "Taxes and Charges Added (Company Currency)", 
-   "oldfieldname": "other_charges_added", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "other_charges_added",
+   "fieldtype": "Currency",
+   "label": "Taxes and Charges Added (Company Currency)",
+   "oldfieldname": "other_charges_added",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "other_charges_deducted", 
-   "fieldtype": "Currency", 
-   "label": "Taxes and Charges Deducted (Company Currency)", 
-   "oldfieldname": "other_charges_deducted", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "other_charges_deducted",
+   "fieldtype": "Currency",
+   "label": "Taxes and Charges Deducted (Company Currency)",
+   "oldfieldname": "other_charges_deducted",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "grand_total", 
-   "fieldtype": "Currency", 
-   "label": "Grand Total (Company Currency)", 
-   "oldfieldname": "grand_total", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "grand_total",
+   "fieldtype": "Currency",
+   "label": "Grand Total (Company Currency)",
+   "oldfieldname": "grand_total",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "description": "In Words will be visible once you save the Purchase Invoice.", 
-   "fieldname": "in_words", 
-   "fieldtype": "Data", 
-   "label": "In Words (Company Currency)", 
-   "oldfieldname": "in_words", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "description": "In Words will be visible once you save the Purchase Invoice.",
+   "fieldname": "in_words",
+   "fieldtype": "Data",
+   "label": "In Words (Company Currency)",
+   "oldfieldname": "in_words",
+   "oldfieldtype": "Data",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "column_break8", 
-   "fieldtype": "Column Break", 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "fieldname": "column_break8",
+   "fieldtype": "Column Break",
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "fieldname": "other_charges_added_import", 
-   "fieldtype": "Currency", 
-   "label": "Taxes and Charges Added", 
-   "oldfieldname": "other_charges_added_import", 
-   "oldfieldtype": "Currency", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "other_charges_added_import",
+   "fieldtype": "Currency",
+   "label": "Taxes and Charges Added",
+   "oldfieldname": "other_charges_added_import",
+   "oldfieldtype": "Currency",
+   "options": "currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "other_charges_deducted_import", 
-   "fieldtype": "Currency", 
-   "label": "Taxes and Charges Deducted", 
-   "oldfieldname": "other_charges_deducted_import", 
-   "oldfieldtype": "Currency", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "other_charges_deducted_import",
+   "fieldtype": "Currency",
+   "label": "Taxes and Charges Deducted",
+   "oldfieldname": "other_charges_deducted_import",
+   "oldfieldtype": "Currency",
+   "options": "currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "grand_total_import", 
-   "fieldtype": "Currency", 
-   "in_list_view": 1, 
-   "label": "Grand Total", 
-   "oldfieldname": "grand_total_import", 
-   "oldfieldtype": "Currency", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 0, 
+   "fieldname": "grand_total_import",
+   "fieldtype": "Currency",
+   "in_list_view": 1,
+   "label": "Grand Total",
+   "oldfieldname": "grand_total_import",
+   "oldfieldtype": "Currency",
+   "options": "currency",
+   "permlevel": 0,
+   "print_hide": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "in_words_import", 
-   "fieldtype": "Data", 
-   "label": "In Words", 
-   "oldfieldname": "in_words_import", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
-   "print_hide": 0, 
+   "fieldname": "in_words_import",
+   "fieldtype": "Data",
+   "label": "In Words",
+   "oldfieldname": "in_words_import",
+   "oldfieldtype": "Data",
+   "permlevel": 0,
+   "print_hide": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "total_amount_to_pay", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "label": "Total Amount To Pay", 
-   "no_copy": 1, 
-   "oldfieldname": "total_amount_to_pay", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "total_amount_to_pay",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "label": "Total Amount To Pay",
+   "no_copy": 1,
+   "oldfieldname": "total_amount_to_pay",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "total_advance", 
-   "fieldtype": "Currency", 
-   "label": "Total Advance", 
-   "no_copy": 1, 
-   "oldfieldname": "total_advance", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "total_advance",
+   "fieldtype": "Currency",
+   "label": "Total Advance",
+   "no_copy": 1,
+   "oldfieldname": "total_advance",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "total_tax", 
-   "fieldtype": "Currency", 
-   "label": "Total Tax (Company Currency)", 
-   "oldfieldname": "total_tax", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "total_tax",
+   "fieldtype": "Currency",
+   "label": "Total Tax (Company Currency)",
+   "oldfieldname": "total_tax",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "outstanding_amount", 
-   "fieldtype": "Currency", 
-   "in_filter": 1, 
-   "in_list_view": 1, 
-   "label": "Outstanding Amount", 
-   "no_copy": 1, 
-   "oldfieldname": "outstanding_amount", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
+   "fieldname": "outstanding_amount",
+   "fieldtype": "Currency",
+   "in_filter": 1,
+   "in_list_view": 1,
+   "label": "Outstanding Amount",
+   "no_copy": 1,
+   "oldfieldname": "outstanding_amount",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
    "search_index": 1
-  }, 
+  },
   {
-   "fieldname": "write_off_amount", 
-   "fieldtype": "Currency", 
-   "label": "Write Off Amount", 
-   "no_copy": 1, 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "write_off_amount",
+   "fieldtype": "Currency",
+   "label": "Write Off Amount",
+   "no_copy": 1,
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "depends_on": "eval:flt(doc.write_off_amount)!=0", 
-   "fieldname": "write_off_account", 
-   "fieldtype": "Link", 
-   "label": "Write Off Account", 
-   "no_copy": 1, 
-   "options": "Account", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "depends_on": "eval:flt(doc.write_off_amount)!=0",
+   "fieldname": "write_off_account",
+   "fieldtype": "Link",
+   "label": "Write Off Account",
+   "no_copy": 1,
+   "options": "Account",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "depends_on": "eval:flt(doc.write_off_amount)!=0", 
-   "fieldname": "write_off_cost_center", 
-   "fieldtype": "Link", 
-   "label": "Write Off Cost Center", 
-   "no_copy": 1, 
-   "options": "Cost Center", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "depends_on": "eval:flt(doc.write_off_amount)!=0",
+   "fieldname": "write_off_cost_center",
+   "fieldtype": "Link",
+   "label": "Write Off Cost Center",
+   "no_copy": 1,
+   "options": "Cost Center",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "against_expense_account", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "label": "Against Expense Account", 
-   "no_copy": 1, 
-   "oldfieldname": "against_expense_account", 
-   "oldfieldtype": "Small Text", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "fieldname": "against_expense_account",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "label": "Against Expense Account",
+   "no_copy": 1,
+   "oldfieldname": "against_expense_account",
+   "oldfieldtype": "Small Text",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "report_hide": 0
-  }, 
+  },
   {
-   "fieldname": "fold", 
-   "fieldtype": "Fold", 
+   "fieldname": "fold",
+   "fieldtype": "Fold",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "advances", 
-   "fieldtype": "Section Break", 
-   "label": "Advances", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-money", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "advances",
+   "fieldtype": "Section Break",
+   "label": "Advances",
+   "oldfieldtype": "Section Break",
+   "options": "icon-money",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "get_advances_paid", 
-   "fieldtype": "Button", 
-   "label": "Get Advances Paid", 
-   "oldfieldtype": "Button", 
-   "options": "get_advances", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "get_advances_paid",
+   "fieldtype": "Button",
+   "label": "Get Advances Paid",
+   "oldfieldtype": "Button",
+   "options": "get_advances",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "advance_allocation_details", 
-   "fieldtype": "Table", 
-   "label": "Purchase Invoice Advances", 
-   "no_copy": 1, 
-   "oldfieldname": "advance_allocation_details", 
-   "oldfieldtype": "Table", 
-   "options": "Purchase Invoice Advance", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "advance_allocation_details",
+   "fieldtype": "Table",
+   "label": "Purchase Invoice Advances",
+   "no_copy": 1,
+   "oldfieldname": "advance_allocation_details",
+   "oldfieldtype": "Table",
+   "options": "Purchase Invoice Advance",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "terms_section_break", 
-   "fieldtype": "Section Break", 
-   "label": "Terms and Conditions", 
-   "options": "icon-legal", 
+   "fieldname": "terms_section_break",
+   "fieldtype": "Section Break",
+   "label": "Terms and Conditions",
+   "options": "icon-legal",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "tc_name", 
-   "fieldtype": "Link", 
-   "label": "Terms", 
-   "options": "Terms and Conditions", 
-   "permlevel": 0, 
+   "fieldname": "tc_name",
+   "fieldtype": "Link",
+   "label": "Terms",
+   "options": "Terms and Conditions",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "terms", 
-   "fieldtype": "Text Editor", 
-   "label": "Terms and Conditions1", 
+   "fieldname": "terms",
+   "fieldtype": "Text Editor",
+   "label": "Terms and Conditions1",
    "permlevel": 0
-  }, 
+  },
   {
-   "depends_on": "supplier", 
-   "fieldname": "contact_section", 
-   "fieldtype": "Section Break", 
-   "label": "Contact Info", 
-   "options": "icon-bullhorn", 
-   "permlevel": 0, 
+   "depends_on": "supplier",
+   "fieldname": "contact_section",
+   "fieldtype": "Section Break",
+   "label": "Contact Info",
+   "options": "icon-bullhorn",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "supplier_address", 
-   "fieldtype": "Link", 
-   "label": "Supplier Address", 
-   "options": "Address", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "supplier_address",
+   "fieldtype": "Link",
+   "label": "Supplier Address",
+   "options": "Address",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "col_break23", 
-   "fieldtype": "Column Break", 
-   "permlevel": 0, 
-   "read_only": 0, 
+   "fieldname": "col_break23",
+   "fieldtype": "Column Break",
+   "permlevel": 0,
+   "read_only": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "fieldname": "contact_person", 
-   "fieldtype": "Link", 
-   "label": "Contact Person", 
-   "options": "Contact", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "contact_person",
+   "fieldtype": "Link",
+   "label": "Contact Person",
+   "options": "Contact",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "more_info", 
-   "fieldtype": "Section Break", 
-   "label": "More Info", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-file-text", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "more_info",
+   "fieldtype": "Section Break",
+   "label": "More Info",
+   "oldfieldtype": "Section Break",
+   "options": "icon-file-text",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "description": "Supplier (Payable) Account", 
-   "fieldname": "credit_to", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Credit To", 
-   "oldfieldname": "credit_to", 
-   "oldfieldtype": "Link", 
-   "options": "Account", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "reqd": 1, 
+   "description": "Supplier (Payable) Account",
+   "fieldname": "credit_to",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Credit To",
+   "oldfieldname": "credit_to",
+   "oldfieldtype": "Link",
+   "options": "Account",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "reqd": 1,
    "search_index": 1
-  }, 
+  },
   {
-   "default": "No", 
-   "description": "Considered as Opening Balance", 
-   "fieldname": "is_opening", 
-   "fieldtype": "Select", 
-   "in_filter": 1, 
-   "label": "Is Opening", 
-   "oldfieldname": "is_opening", 
-   "oldfieldtype": "Select", 
-   "options": "No\nYes", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "default": "No",
+   "description": "Considered as Opening Balance",
+   "fieldname": "is_opening",
+   "fieldtype": "Select",
+   "in_filter": 1,
+   "label": "Is Opening",
+   "oldfieldname": "is_opening",
+   "oldfieldtype": "Select",
+   "options": "No\nYes",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "search_index": 1
-  }, 
+  },
   {
-   "description": "Actual Invoice Date", 
-   "fieldname": "aging_date", 
-   "fieldtype": "Date", 
-   "label": "Aging Date", 
-   "oldfieldname": "aging_date", 
-   "oldfieldtype": "Date", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "description": "Actual Invoice Date",
+   "fieldname": "aging_date",
+   "fieldtype": "Date",
+   "label": "Aging Date",
+   "oldfieldname": "aging_date",
+   "oldfieldtype": "Date",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "search_index": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "fieldname": "select_print_heading", 
-   "fieldtype": "Link", 
-   "label": "Print Heading", 
-   "no_copy": 1, 
-   "oldfieldname": "select_print_heading", 
-   "oldfieldtype": "Link", 
-   "options": "Print Heading", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "allow_on_submit": 1,
+   "fieldname": "select_print_heading",
+   "fieldtype": "Link",
+   "label": "Print Heading",
+   "no_copy": 1,
+   "oldfieldname": "select_print_heading",
+   "oldfieldtype": "Link",
+   "options": "Print Heading",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "report_hide": 1
-  }, 
+  },
   {
-   "fieldname": "due_date", 
-   "fieldtype": "Date", 
-   "in_filter": 1, 
-   "label": "Due Date", 
-   "no_copy": 0, 
-   "oldfieldname": "due_date", 
-   "oldfieldtype": "Date", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "fieldname": "due_date",
+   "fieldtype": "Date",
+   "in_filter": 1,
+   "label": "Due Date",
+   "no_copy": 0,
+   "oldfieldname": "due_date",
+   "oldfieldtype": "Date",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "search_index": 1
-  }, 
+  },
   {
-   "fieldname": "mode_of_payment", 
-   "fieldtype": "Link", 
-   "label": "Mode of Payment", 
-   "oldfieldname": "mode_of_payment", 
-   "oldfieldtype": "Select", 
-   "options": "Mode of Payment", 
-   "permlevel": 0, 
+   "fieldname": "mode_of_payment",
+   "fieldtype": "Link",
+   "label": "Mode of Payment",
+   "oldfieldname": "mode_of_payment",
+   "oldfieldtype": "Select",
+   "options": "Mode of Payment",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "column_break_63", 
-   "fieldtype": "Column Break", 
-   "permlevel": 0, 
+   "fieldname": "column_break_63",
+   "fieldtype": "Column Break",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "fieldname": "letter_head", 
-   "fieldtype": "Link", 
-   "label": "Letter Head", 
-   "options": "Letter Head", 
-   "permlevel": 0, 
+   "allow_on_submit": 1,
+   "fieldname": "letter_head",
+   "fieldtype": "Link",
+   "label": "Letter Head",
+   "options": "Letter Head",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "fiscal_year", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Fiscal Year", 
-   "oldfieldname": "fiscal_year", 
-   "oldfieldtype": "Select", 
-   "options": "Fiscal Year", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "fieldname": "fiscal_year",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Fiscal Year",
+   "oldfieldname": "fiscal_year",
+   "oldfieldtype": "Select",
+   "options": "Fiscal Year",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "search_index": 1
-  }, 
+  },
   {
-   "fieldname": "remarks", 
-   "fieldtype": "Small Text", 
-   "label": "Remarks", 
-   "no_copy": 1, 
-   "oldfieldname": "remarks", 
-   "oldfieldtype": "Text", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "fieldname": "remarks",
+   "fieldtype": "Small Text",
+   "label": "Remarks",
+   "no_copy": 1,
+   "oldfieldname": "remarks",
+   "oldfieldtype": "Text",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "reqd": 0
-  }, 
+  },
   {
-   "depends_on": "eval:doc.docstatus<2", 
-   "fieldname": "recurring_invoice", 
-   "fieldtype": "Section Break", 
-   "label": "Recurring Invoice", 
-   "options": "icon-time", 
-   "permlevel": 0, 
+   "depends_on": "eval:doc.docstatus<2",
+   "fieldname": "recurring_invoice",
+   "fieldtype": "Section Break",
+   "label": "Recurring Invoice",
+   "options": "icon-time",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "column_break_77", 
-   "fieldtype": "Column Break", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "column_break_77",
+   "fieldtype": "Column Break",
+   "permlevel": 0,
+   "print_hide": 1,
    "width": "50%"
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "depends_on": "eval:doc.docstatus<2", 
-   "description": "Check if recurring invoice, uncheck to stop recurring or put proper End Date", 
-   "fieldname": "is_recurring", 
-   "fieldtype": "Check", 
-   "label": "Is Recurring", 
-   "no_copy": 1, 
-   "permlevel": 0, 
+   "allow_on_submit": 1,
+   "depends_on": "eval:doc.docstatus<2",
+   "description": "Check if recurring invoice, uncheck to stop recurring or put proper End Date",
+   "fieldname": "is_recurring",
+   "fieldtype": "Check",
+   "label": "Is Recurring",
+   "no_copy": 1,
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "Select the period when the invoice will be generated automatically", 
-   "fieldname": "recurring_type", 
-   "fieldtype": "Select", 
-   "label": "Recurring Type", 
-   "no_copy": 1, 
-   "options": "Monthly\nQuarterly\nHalf-yearly\nYearly", 
-   "permlevel": 0, 
+   "allow_on_submit": 1,
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "Select the period when the invoice will be generated automatically",
+   "fieldname": "recurring_type",
+   "fieldtype": "Select",
+   "label": "Recurring Type",
+   "no_copy": 1,
+   "options": "Monthly\nQuarterly\nHalf-yearly\nYearly",
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "The day of the month on which auto invoice will be generated e.g. 05, 28 etc", 
-   "fieldname": "repeat_on_day_of_month", 
-   "fieldtype": "Int", 
-   "label": "Repeat on Day of Month", 
-   "no_copy": 1, 
-   "permlevel": 0, 
+   "allow_on_submit": 1,
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "The day of the month on which auto invoice will be generated e.g. 05, 28 etc",
+   "fieldname": "repeat_on_day_of_month",
+   "fieldtype": "Int",
+   "label": "Repeat on Day of Month",
+   "no_copy": 1,
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "The date on which next invoice will be generated. It is generated on submit.", 
-   "fieldname": "next_date", 
-   "fieldtype": "Date", 
-   "label": "Next Date", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "The date on which next invoice will be generated. It is generated on submit.",
+   "fieldname": "next_date",
+   "fieldtype": "Date",
+   "label": "Next Date",
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "The date on which recurring invoice will be stop", 
-   "fieldname": "end_date", 
-   "fieldtype": "Date", 
-   "label": "End Date", 
-   "no_copy": 1, 
-   "permlevel": 0, 
+   "allow_on_submit": 1,
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "The date on which recurring invoice will be stop",
+   "fieldname": "end_date",
+   "fieldtype": "Date",
+   "label": "End Date",
+   "no_copy": 1,
+   "permlevel": 0,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "column_break_82", 
-   "fieldtype": "Column Break", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "column_break_82",
+   "fieldtype": "Column Break",
+   "permlevel": 0,
+   "print_hide": 1,
    "width": "50%"
-  }, 
+  },
   {
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "The unique id for tracking all recurring invoices. It is generated on submit.", 
-   "fieldname": "recurring_id", 
-   "fieldtype": "Data", 
-   "label": "Recurring Id", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "The unique id for tracking all recurring invoices. It is generated on submit.",
+   "fieldname": "recurring_id",
+   "fieldtype": "Data",
+   "label": "Recurring Id",
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "Enter email id separated by commas, invoice will be mailed automatically on particular date", 
-   "fieldname": "notification_email_address", 
-   "fieldtype": "Small Text", 
-   "label": "Notification Email Address", 
-   "no_copy": 1, 
-   "permlevel": 0, 
+   "allow_on_submit": 1,
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "Enter email id separated by commas, invoice will be mailed automatically on particular date",
+   "fieldname": "notification_email_address",
+   "fieldtype": "Small Text",
+   "label": "Notification Email Address",
+   "no_copy": 1,
+   "permlevel": 0,
    "print_hide": 1
   }
- ], 
- "icon": "icon-file-text", 
- "idx": 1, 
- "is_submittable": 1, 
- "modified": "2014-09-18 03:12:51.994059", 
- "modified_by": "Administrator", 
- "module": "Accounts", 
- "name": "Purchase Invoice", 
- "owner": "Administrator", 
+ ],
+ "icon": "icon-file-text",
+ "idx": 1,
+ "is_submittable": 1,
+ "modified": "2014-09-18 03:12:51.994059",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Purchase Invoice",
+ "owner": "Administrator",
  "permissions": [
   {
-   "amend": 1, 
-   "apply_user_permissions": 1, 
-   "cancel": 1, 
-   "create": 1, 
-   "delete": 0, 
-   "email": 1, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Accounts User", 
-   "submit": 1, 
+   "amend": 1,
+   "apply_user_permissions": 1,
+   "cancel": 1,
+   "create": 1,
+   "delete": 0,
+   "email": 1,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Accounts User",
+   "submit": 1,
    "write": 1
-  }, 
+  },
   {
-   "amend": 0, 
-   "apply_user_permissions": 1, 
-   "cancel": 0, 
-   "create": 0, 
-   "delete": 0, 
-   "email": 1, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Purchase User", 
-   "submit": 0, 
+   "amend": 0,
+   "apply_user_permissions": 1,
+   "cancel": 0,
+   "create": 0,
+   "delete": 0,
+   "email": 1,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Purchase User",
+   "submit": 0,
    "write": 0
-  }, 
+  },
   {
-   "amend": 0, 
-   "apply_user_permissions": 1, 
-   "cancel": 0, 
-   "create": 0, 
-   "delete": 0, 
-   "email": 1, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Supplier", 
-   "submit": 0, 
+   "amend": 0,
+   "apply_user_permissions": 1,
+   "cancel": 0,
+   "create": 0,
+   "delete": 0,
+   "email": 1,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Supplier",
+   "submit": 0,
    "write": 0
-  }, 
+  },
   {
-   "amend": 1, 
-   "cancel": 1, 
-   "create": 1, 
-   "delete": 1, 
-   "email": 1, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Accounts Manager", 
-   "submit": 1, 
+   "amend": 1,
+   "cancel": 1,
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Accounts Manager",
+   "submit": 1,
    "write": 1
-  }, 
+  },
   {
-   "amend": 0, 
-   "apply_user_permissions": 1, 
-   "cancel": 0, 
-   "create": 0, 
-   "delete": 0, 
-   "email": 1, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Auditor", 
-   "submit": 0, 
+   "amend": 0,
+   "apply_user_permissions": 1,
+   "cancel": 0,
+   "create": 0,
+   "delete": 0,
+   "email": 1,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Auditor",
+   "submit": 0,
    "write": 0
-  }, 
+  },
   {
-   "permlevel": 1, 
-   "read": 1, 
-   "role": "Accounts Manager", 
+   "permlevel": 1,
+   "read": 1,
+   "role": "Accounts Manager",
    "write": 1
   }
- ], 
- "read_only_onload": 1, 
- "search_fields": "posting_date, credit_to, fiscal_year, bill_no, grand_total, outstanding_amount", 
- "sort_field": "modified", 
+ ],
+ "read_only_onload": 1,
+ "search_fields": "posting_date, supplier, fiscal_year, bill_no, grand_total, outstanding_amount",
+ "sort_field": "modified",
  "sort_order": "DESC"
-}
\ No newline at end of file
+}
diff --git a/erpnext/accounts/doctype/purchase_invoice/test_records.json b/erpnext/accounts/doctype/purchase_invoice/test_records.json
index 3ddbcc7..84a5440 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_records.json
+++ b/erpnext/accounts/doctype/purchase_invoice/test_records.json
@@ -4,7 +4,7 @@
   "buying_price_list": "_Test Price List",
   "company": "_Test Company",
   "conversion_rate": 1,
-  "credit_to": "_Test Supplier - _TC",
+  "credit_to": "_Test Payable - _TC",
   "currency": "INR",
   "doctype": "Purchase Invoice",
   "entries": [
@@ -146,7 +146,7 @@
   "buying_price_list": "_Test Price List",
   "company": "_Test Company",
   "conversion_rate": 1.0,
-  "credit_to": "_Test Supplier - _TC",
+  "credit_to": "_Test Payable - _TC",
   "currency": "INR",
   "doctype": "Purchase Invoice",
   "entries": [
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index cc841e2..743f7ee 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -172,10 +172,6 @@
 		})
 	},
 
-	debit_to: function() {
-		this.customer();
-	},
-
 	allocated_amount: function() {
 		this.calculate_total_advance("Sales Invoice", "advance_adjustment_details");
 		this.frm.refresh_fields();
@@ -306,7 +302,8 @@
 cur_frm.fields_dict.cash_bank_account.get_query = function(doc) {
 	return{
 		filters: {
-			'report_type': 'Balance Sheet',
+			'account_type': 'Receivable',
+			'root_type': 'Asset',
 			'group_or_ledger': 'Ledger',
 			'company': doc.company
 		}
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index 4462ac6..05c4cc8 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -1,1252 +1,1252 @@
 {
- "allow_import": 1, 
- "autoname": "naming_series:", 
- "creation": "2013-05-24 19:29:05", 
- "default_print_format": "Standard", 
- "docstatus": 0, 
- "doctype": "DocType", 
- "document_type": "Transaction", 
+ "allow_import": 1,
+ "autoname": "naming_series:",
+ "creation": "2013-05-24 19:29:05",
+ "default_print_format": "Standard",
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "Transaction",
  "fields": [
   {
-   "fieldname": "customer_section", 
-   "fieldtype": "Section Break", 
-   "label": "Customer", 
-   "options": "icon-user", 
+   "fieldname": "customer_section",
+   "fieldtype": "Section Break",
+   "label": "Customer",
+   "options": "icon-user",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "naming_series", 
-   "fieldtype": "Select", 
-   "label": "Series", 
-   "no_copy": 1, 
-   "oldfieldname": "naming_series", 
-   "oldfieldtype": "Select", 
-   "options": "SINV-", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "fieldname": "naming_series",
+   "fieldtype": "Select",
+   "label": "Series",
+   "no_copy": 1,
+   "oldfieldname": "naming_series",
+   "oldfieldtype": "Select",
+   "options": "SINV-",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "reqd": 1
-  }, 
+  },
   {
-   "fieldname": "customer", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "label": "Customer", 
-   "no_copy": 0, 
-   "oldfieldname": "customer", 
-   "oldfieldtype": "Link", 
-   "options": "Customer", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "customer",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "label": "Customer",
+   "no_copy": 0,
+   "oldfieldname": "customer",
+   "oldfieldtype": "Link",
+   "options": "Customer",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "depends_on": "customer", 
-   "fieldname": "customer_name", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "in_list_view": 1, 
-   "label": "Name", 
-   "oldfieldname": "customer_name", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
+   "depends_on": "customer",
+   "fieldname": "customer_name",
+   "fieldtype": "Data",
+   "hidden": 0,
+   "in_list_view": 1,
+   "label": "Name",
+   "oldfieldname": "customer_name",
+   "oldfieldtype": "Data",
+   "permlevel": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "address_display", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "label": "Address", 
-   "permlevel": 0, 
+   "fieldname": "address_display",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "label": "Address",
+   "permlevel": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "contact_display", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "label": "Contact", 
-   "permlevel": 0, 
+   "fieldname": "contact_display",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "label": "Contact",
+   "permlevel": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "contact_mobile", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "label": "Mobile No", 
-   "permlevel": 0, 
+   "fieldname": "contact_mobile",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "label": "Mobile No",
+   "permlevel": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "contact_email", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "label": "Contact Email", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "contact_email",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "label": "Contact Email",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "mode_of_payment", 
-   "fieldtype": "Link", 
-   "label": "Mode of Payment", 
-   "no_copy": 0, 
-   "oldfieldname": "mode_of_payment", 
-   "oldfieldtype": "Select", 
-   "options": "Mode of Payment", 
-   "permlevel": 0, 
+   "fieldname": "mode_of_payment",
+   "fieldtype": "Link",
+   "label": "Mode of Payment",
+   "no_copy": 0,
+   "oldfieldname": "mode_of_payment",
+   "oldfieldtype": "Select",
+   "options": "Mode of Payment",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "column_break1", 
-   "fieldtype": "Column Break", 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
+   "fieldname": "column_break1",
+   "fieldtype": "Column Break",
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "is_pos", 
-   "fieldtype": "Check", 
-   "label": "Is POS", 
-   "oldfieldname": "is_pos", 
-   "oldfieldtype": "Check", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "is_pos",
+   "fieldtype": "Check",
+   "label": "Is POS",
+   "oldfieldname": "is_pos",
+   "oldfieldtype": "Check",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "company", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Company", 
-   "oldfieldname": "company", 
-   "oldfieldtype": "Link", 
-   "options": "Company", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "reqd": 1, 
+   "fieldname": "company",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Company",
+   "oldfieldname": "company",
+   "oldfieldtype": "Link",
+   "options": "Company",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "reqd": 1,
    "search_index": 0
-  }, 
+  },
   {
-   "fieldname": "amended_from", 
-   "fieldtype": "Link", 
-   "ignore_user_permissions": 1, 
-   "label": "Amended From", 
-   "no_copy": 1, 
-   "oldfieldname": "amended_from", 
-   "oldfieldtype": "Link", 
-   "options": "Sales Invoice", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "amended_from",
+   "fieldtype": "Link",
+   "ignore_user_permissions": 1,
+   "label": "Amended From",
+   "no_copy": 1,
+   "oldfieldname": "amended_from",
+   "oldfieldtype": "Link",
+   "options": "Sales Invoice",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "default": "Today", 
-   "fieldname": "posting_date", 
-   "fieldtype": "Date", 
-   "in_filter": 1, 
-   "label": "Date", 
-   "no_copy": 1, 
-   "oldfieldname": "posting_date", 
-   "oldfieldtype": "Date", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "reqd": 1, 
+   "default": "Today",
+   "fieldname": "posting_date",
+   "fieldtype": "Date",
+   "in_filter": 1,
+   "label": "Date",
+   "no_copy": 1,
+   "oldfieldname": "posting_date",
+   "oldfieldtype": "Date",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "reqd": 1,
    "search_index": 1
-  }, 
+  },
   {
-   "fieldname": "due_date", 
-   "fieldtype": "Date", 
-   "in_filter": 1, 
-   "label": "Payment Due Date", 
-   "no_copy": 1, 
-   "oldfieldname": "due_date", 
-   "oldfieldtype": "Date", 
-   "permlevel": 0, 
-   "read_only": 0, 
-   "reqd": 1, 
+   "fieldname": "due_date",
+   "fieldtype": "Date",
+   "in_filter": 1,
+   "label": "Payment Due Date",
+   "no_copy": 1,
+   "oldfieldname": "due_date",
+   "oldfieldtype": "Date",
+   "permlevel": 0,
+   "read_only": 0,
+   "reqd": 1,
    "search_index": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "depends_on": "", 
-   "description": "Start date of current invoice's period", 
-   "fieldname": "from_date", 
-   "fieldtype": "Date", 
-   "label": "From Date", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 0, 
+   "allow_on_submit": 1,
+   "depends_on": "",
+   "description": "Start date of current invoice's period",
+   "fieldname": "from_date",
+   "fieldtype": "Date",
+   "label": "From Date",
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "depends_on": "", 
-   "description": "End date of current invoice's period", 
-   "fieldname": "to_date", 
-   "fieldtype": "Date", 
-   "label": "To Date", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 0, 
+   "allow_on_submit": 1,
+   "depends_on": "",
+   "description": "End date of current invoice's period",
+   "fieldname": "to_date",
+   "fieldtype": "Date",
+   "label": "To Date",
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "currency_section", 
-   "fieldtype": "Section Break", 
-   "label": "Currency and Price List", 
-   "options": "icon-tag", 
-   "permlevel": 0, 
+   "fieldname": "currency_section",
+   "fieldtype": "Section Break",
+   "label": "Currency and Price List",
+   "options": "icon-tag",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "currency", 
-   "fieldtype": "Link", 
-   "label": "Currency", 
-   "oldfieldname": "currency", 
-   "oldfieldtype": "Select", 
-   "options": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "fieldname": "currency",
+   "fieldtype": "Link",
+   "label": "Currency",
+   "oldfieldname": "currency",
+   "oldfieldtype": "Select",
+   "options": "Currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "reqd": 1
-  }, 
+  },
   {
-   "description": "Rate at which Customer Currency is converted to customer's base currency", 
-   "fieldname": "conversion_rate", 
-   "fieldtype": "Float", 
-   "label": "Exchange Rate", 
-   "oldfieldname": "conversion_rate", 
-   "oldfieldtype": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "description": "Rate at which Customer Currency is converted to customer's base currency",
+   "fieldname": "conversion_rate",
+   "fieldtype": "Float",
+   "label": "Exchange Rate",
+   "oldfieldname": "conversion_rate",
+   "oldfieldtype": "Currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "reqd": 1
-  }, 
+  },
   {
-   "fieldname": "column_break2", 
-   "fieldtype": "Column Break", 
-   "permlevel": 0, 
-   "read_only": 0, 
+   "fieldname": "column_break2",
+   "fieldtype": "Column Break",
+   "permlevel": 0,
+   "read_only": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "fieldname": "selling_price_list", 
-   "fieldtype": "Link", 
-   "label": "Price List", 
-   "oldfieldname": "price_list_name", 
-   "oldfieldtype": "Select", 
-   "options": "Price List", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "fieldname": "selling_price_list",
+   "fieldtype": "Link",
+   "label": "Price List",
+   "oldfieldname": "price_list_name",
+   "oldfieldtype": "Select",
+   "options": "Price List",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "reqd": 1
-  }, 
+  },
   {
-   "fieldname": "price_list_currency", 
-   "fieldtype": "Link", 
-   "label": "Price List Currency", 
-   "options": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
+   "fieldname": "price_list_currency",
+   "fieldtype": "Link",
+   "label": "Price List Currency",
+   "options": "Currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
    "reqd": 1
-  }, 
+  },
   {
-   "description": "Rate at which Price list currency is converted to customer's base currency", 
-   "fieldname": "plc_conversion_rate", 
-   "fieldtype": "Float", 
-   "label": "Price List Exchange Rate", 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "description": "Rate at which Price list currency is converted to customer's base currency",
+   "fieldname": "plc_conversion_rate",
+   "fieldtype": "Float",
+   "label": "Price List Exchange Rate",
+   "no_copy": 0,
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "reqd": 1
-  }, 
+  },
   {
-   "fieldname": "ignore_pricing_rule", 
-   "fieldtype": "Check", 
-   "label": "Ignore Pricing Rule", 
-   "no_copy": 1, 
-   "permlevel": 1, 
+   "fieldname": "ignore_pricing_rule",
+   "fieldtype": "Check",
+   "label": "Ignore Pricing Rule",
+   "no_copy": 1,
+   "permlevel": 1,
    "print_hide": 1
-  }, 
+  },
   {
-   "fieldname": "items", 
-   "fieldtype": "Section Break", 
-   "label": "Items", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-shopping-cart", 
-   "permlevel": 0, 
+   "fieldname": "items",
+   "fieldtype": "Section Break",
+   "label": "Items",
+   "oldfieldtype": "Section Break",
+   "options": "icon-shopping-cart",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "update_stock", 
-   "fieldtype": "Check", 
-   "label": "Update Stock", 
-   "oldfieldname": "update_stock", 
-   "oldfieldtype": "Check", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "update_stock",
+   "fieldtype": "Check",
+   "label": "Update Stock",
+   "oldfieldname": "update_stock",
+   "oldfieldtype": "Check",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "fieldname": "entries", 
-   "fieldtype": "Table", 
-   "label": "Sales Invoice Items", 
-   "oldfieldname": "entries", 
-   "oldfieldtype": "Table", 
-   "options": "Sales Invoice Item", 
-   "permlevel": 0, 
-   "read_only": 0, 
+   "allow_on_submit": 1,
+   "fieldname": "entries",
+   "fieldtype": "Table",
+   "label": "Sales Invoice Items",
+   "oldfieldname": "entries",
+   "oldfieldtype": "Table",
+   "options": "Sales Invoice Item",
+   "permlevel": 0,
+   "read_only": 0,
    "reqd": 1
-  }, 
+  },
   {
-   "fieldname": "packing_list", 
-   "fieldtype": "Section Break", 
-   "label": "Packing List", 
-   "options": "icon-suitcase", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "packing_list",
+   "fieldtype": "Section Break",
+   "label": "Packing List",
+   "options": "icon-suitcase",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "packing_details", 
-   "fieldtype": "Table", 
-   "label": "Packing Details", 
-   "options": "Packed Item", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "packing_details",
+   "fieldtype": "Table",
+   "label": "Packing Details",
+   "options": "Packed Item",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "sales_bom_help", 
-   "fieldtype": "HTML", 
-   "label": "Sales BOM Help", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "sales_bom_help",
+   "fieldtype": "HTML",
+   "label": "Sales BOM Help",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "section_break_30", 
-   "fieldtype": "Section Break", 
+   "fieldname": "section_break_30",
+   "fieldtype": "Section Break",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "net_total", 
-   "fieldtype": "Currency", 
-   "label": "Net Total (Company Currency)", 
-   "oldfieldname": "net_total", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
+   "fieldname": "net_total",
+   "fieldtype": "Currency",
+   "label": "Net Total (Company Currency)",
+   "oldfieldname": "net_total",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
    "reqd": 1
-  }, 
+  },
   {
-   "fieldname": "column_break_32", 
-   "fieldtype": "Column Break", 
+   "fieldname": "column_break_32",
+   "fieldtype": "Column Break",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "net_total_export", 
-   "fieldtype": "Currency", 
-   "label": "Net Total", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 0, 
+   "fieldname": "net_total_export",
+   "fieldtype": "Currency",
+   "label": "Net Total",
+   "options": "currency",
+   "permlevel": 0,
+   "print_hide": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "taxes", 
-   "fieldtype": "Section Break", 
-   "label": "Taxes and Charges", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-money", 
-   "permlevel": 0, 
+   "fieldname": "taxes",
+   "fieldtype": "Section Break",
+   "label": "Taxes and Charges",
+   "oldfieldtype": "Section Break",
+   "options": "icon-money",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "taxes_and_charges", 
-   "fieldtype": "Link", 
-   "label": "Taxes and Charges", 
-   "oldfieldname": "charge", 
-   "oldfieldtype": "Link", 
-   "options": "Sales Taxes and Charges Master", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "taxes_and_charges",
+   "fieldtype": "Link",
+   "label": "Taxes and Charges",
+   "oldfieldname": "charge",
+   "oldfieldtype": "Link",
+   "options": "Sales Taxes and Charges Master",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "column_break_38", 
-   "fieldtype": "Column Break", 
+   "fieldname": "column_break_38",
+   "fieldtype": "Column Break",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "shipping_rule", 
-   "fieldtype": "Link", 
-   "label": "Shipping Rule", 
-   "oldfieldtype": "Button", 
-   "options": "Shipping Rule", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "shipping_rule",
+   "fieldtype": "Link",
+   "label": "Shipping Rule",
+   "oldfieldtype": "Button",
+   "options": "Shipping Rule",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "section_break_40", 
-   "fieldtype": "Section Break", 
+   "fieldname": "section_break_40",
+   "fieldtype": "Section Break",
    "permlevel": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "fieldname": "other_charges", 
-   "fieldtype": "Table", 
-   "label": "Sales Taxes and Charges", 
-   "oldfieldname": "other_charges", 
-   "oldfieldtype": "Table", 
-   "options": "Sales Taxes and Charges", 
-   "permlevel": 0, 
+   "allow_on_submit": 1,
+   "fieldname": "other_charges",
+   "fieldtype": "Table",
+   "label": "Sales Taxes and Charges",
+   "oldfieldname": "other_charges",
+   "oldfieldtype": "Table",
+   "options": "Sales Taxes and Charges",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "other_charges_calculation", 
-   "fieldtype": "HTML", 
-   "label": "Taxes and Charges Calculation", 
-   "oldfieldtype": "HTML", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "other_charges_calculation",
+   "fieldtype": "HTML",
+   "label": "Taxes and Charges Calculation",
+   "oldfieldtype": "HTML",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "section_break_43", 
-   "fieldtype": "Section Break", 
+   "fieldname": "section_break_43",
+   "fieldtype": "Section Break",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "other_charges_total", 
-   "fieldtype": "Currency", 
-   "label": "Total Taxes and Charges (Company Currency)", 
-   "oldfieldname": "other_charges_total", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "other_charges_total",
+   "fieldtype": "Currency",
+   "label": "Total Taxes and Charges (Company Currency)",
+   "oldfieldname": "other_charges_total",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "column_break_45", 
-   "fieldtype": "Column Break", 
+   "fieldname": "column_break_45",
+   "fieldtype": "Column Break",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "other_charges_total_export", 
-   "fieldtype": "Currency", 
-   "label": "Total Taxes and Charges", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "other_charges_total_export",
+   "fieldtype": "Currency",
+   "label": "Total Taxes and Charges",
+   "options": "currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "discount_amount", 
-   "fieldtype": "Currency", 
-   "label": "Discount Amount", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
+   "fieldname": "discount_amount",
+   "fieldtype": "Currency",
+   "label": "Discount Amount",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
    "print_hide": 0
-  }, 
+  },
   {
-   "fieldname": "totals", 
-   "fieldtype": "Section Break", 
-   "label": "Totals", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-money", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "totals",
+   "fieldtype": "Section Break",
+   "label": "Totals",
+   "oldfieldtype": "Section Break",
+   "options": "icon-money",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "grand_total", 
-   "fieldtype": "Currency", 
-   "in_filter": 1, 
-   "label": "Grand Total (Company Currency)", 
-   "oldfieldname": "grand_total", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "reqd": 1, 
+   "fieldname": "grand_total",
+   "fieldtype": "Currency",
+   "in_filter": 1,
+   "label": "Grand Total (Company Currency)",
+   "oldfieldname": "grand_total",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "reqd": 1,
    "search_index": 0
-  }, 
+  },
   {
-   "fieldname": "rounded_total", 
-   "fieldtype": "Currency", 
-   "label": "Rounded Total (Company Currency)", 
-   "oldfieldname": "rounded_total", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "rounded_total",
+   "fieldtype": "Currency",
+   "label": "Rounded Total (Company Currency)",
+   "oldfieldname": "rounded_total",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "description": "In Words will be visible once you save the Sales Invoice.", 
-   "fieldname": "in_words", 
-   "fieldtype": "Data", 
-   "label": "In Words (Company Currency)", 
-   "oldfieldname": "in_words", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "description": "In Words will be visible once you save the Sales Invoice.",
+   "fieldname": "in_words",
+   "fieldtype": "Data",
+   "label": "In Words (Company Currency)",
+   "oldfieldname": "in_words",
+   "oldfieldtype": "Data",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "total_advance", 
-   "fieldtype": "Currency", 
-   "label": "Total Advance", 
-   "oldfieldname": "total_advance", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "total_advance",
+   "fieldtype": "Currency",
+   "label": "Total Advance",
+   "oldfieldname": "total_advance",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "outstanding_amount", 
-   "fieldtype": "Currency", 
-   "in_list_view": 1, 
-   "label": "Outstanding Amount", 
-   "no_copy": 1, 
-   "oldfieldname": "outstanding_amount", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "outstanding_amount",
+   "fieldtype": "Currency",
+   "in_list_view": 1,
+   "label": "Outstanding Amount",
+   "no_copy": 1,
+   "oldfieldname": "outstanding_amount",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "column_break5", 
-   "fieldtype": "Column Break", 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "fieldname": "column_break5",
+   "fieldtype": "Column Break",
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "fieldname": "grand_total_export", 
-   "fieldtype": "Currency", 
-   "in_list_view": 1, 
-   "label": "Grand Total", 
-   "oldfieldname": "grand_total_export", 
-   "oldfieldtype": "Currency", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 1, 
+   "fieldname": "grand_total_export",
+   "fieldtype": "Currency",
+   "in_list_view": 1,
+   "label": "Grand Total",
+   "oldfieldname": "grand_total_export",
+   "oldfieldtype": "Currency",
+   "options": "currency",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 1,
    "reqd": 1
-  }, 
+  },
   {
-   "fieldname": "rounded_total_export", 
-   "fieldtype": "Currency", 
-   "label": "Rounded Total", 
-   "oldfieldname": "rounded_total_export", 
-   "oldfieldtype": "Currency", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 0, 
+   "fieldname": "rounded_total_export",
+   "fieldtype": "Currency",
+   "label": "Rounded Total",
+   "oldfieldname": "rounded_total_export",
+   "oldfieldtype": "Currency",
+   "options": "currency",
+   "permlevel": 0,
+   "print_hide": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "in_words_export", 
-   "fieldtype": "Data", 
-   "label": "In Words", 
-   "oldfieldname": "in_words_export", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
-   "print_hide": 0, 
+   "fieldname": "in_words_export",
+   "fieldtype": "Data",
+   "label": "In Words",
+   "oldfieldname": "in_words_export",
+   "oldfieldtype": "Data",
+   "permlevel": 0,
+   "print_hide": 0,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "gross_profit", 
-   "fieldtype": "Currency", 
-   "label": "Gross Profit", 
-   "oldfieldname": "gross_profit", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "gross_profit",
+   "fieldtype": "Currency",
+   "label": "Gross Profit",
+   "oldfieldname": "gross_profit",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "gross_profit_percent", 
-   "fieldtype": "Float", 
-   "label": "Gross Profit (%)", 
-   "oldfieldname": "gross_profit_percent", 
-   "oldfieldtype": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "gross_profit_percent",
+   "fieldtype": "Float",
+   "label": "Gross Profit (%)",
+   "oldfieldname": "gross_profit_percent",
+   "oldfieldtype": "Currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "advances", 
-   "fieldtype": "Section Break", 
-   "label": "Advances", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-money", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "advances",
+   "fieldtype": "Section Break",
+   "label": "Advances",
+   "oldfieldtype": "Section Break",
+   "options": "icon-money",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "get_advances_received", 
-   "fieldtype": "Button", 
-   "label": "Get Advances Received", 
-   "oldfieldtype": "Button", 
-   "options": "get_advances", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "get_advances_received",
+   "fieldtype": "Button",
+   "label": "Get Advances Received",
+   "oldfieldtype": "Button",
+   "options": "get_advances",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "advance_adjustment_details", 
-   "fieldtype": "Table", 
-   "label": "Sales Invoice Advance", 
-   "oldfieldname": "advance_adjustment_details", 
-   "oldfieldtype": "Table", 
-   "options": "Sales Invoice Advance", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "advance_adjustment_details",
+   "fieldtype": "Table",
+   "label": "Sales Invoice Advance",
+   "oldfieldname": "advance_adjustment_details",
+   "oldfieldtype": "Table",
+   "options": "Sales Invoice Advance",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "depends_on": "is_pos", 
-   "fieldname": "payments_section", 
-   "fieldtype": "Section Break", 
-   "label": "Payments", 
-   "options": "icon-money", 
-   "permlevel": 0, 
+   "depends_on": "is_pos",
+   "fieldname": "payments_section",
+   "fieldtype": "Section Break",
+   "label": "Payments",
+   "options": "icon-money",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "depends_on": "is_pos", 
-   "fieldname": "column_break3", 
-   "fieldtype": "Column Break", 
-   "permlevel": 0, 
-   "read_only": 0, 
+   "depends_on": "is_pos",
+   "fieldname": "column_break3",
+   "fieldtype": "Column Break",
+   "permlevel": 0,
+   "read_only": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "depends_on": "is_pos", 
-   "fieldname": "paid_amount", 
-   "fieldtype": "Currency", 
-   "label": "Paid Amount", 
-   "no_copy": 1, 
-   "oldfieldname": "paid_amount", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "depends_on": "is_pos",
+   "fieldname": "paid_amount",
+   "fieldtype": "Currency",
+   "label": "Paid Amount",
+   "no_copy": 1,
+   "oldfieldname": "paid_amount",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "depends_on": "is_pos", 
-   "fieldname": "cash_bank_account", 
-   "fieldtype": "Link", 
-   "label": "Cash/Bank Account", 
-   "oldfieldname": "cash_bank_account", 
-   "oldfieldtype": "Link", 
-   "options": "Account", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "depends_on": "is_pos",
+   "fieldname": "cash_bank_account",
+   "fieldtype": "Link",
+   "label": "Cash/Bank Account",
+   "oldfieldname": "cash_bank_account",
+   "oldfieldtype": "Link",
+   "options": "Account",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "depends_on": "is_pos", 
-   "fieldname": "column_break4", 
-   "fieldtype": "Column Break", 
-   "permlevel": 0, 
-   "read_only": 0, 
+   "depends_on": "is_pos",
+   "fieldname": "column_break4",
+   "fieldtype": "Column Break",
+   "permlevel": 0,
+   "read_only": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "depends_on": "is_pos", 
-   "fieldname": "write_off_outstanding_amount_automatically", 
-   "fieldtype": "Check", 
-   "label": "Write Off Outstanding Amount", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "depends_on": "is_pos",
+   "fieldname": "write_off_outstanding_amount_automatically",
+   "fieldtype": "Check",
+   "label": "Write Off Outstanding Amount",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "depends_on": "is_pos", 
-   "fieldname": "write_off_amount", 
-   "fieldtype": "Currency", 
-   "label": "Write Off Amount", 
-   "no_copy": 1, 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "depends_on": "is_pos",
+   "fieldname": "write_off_amount",
+   "fieldtype": "Currency",
+   "label": "Write Off Amount",
+   "no_copy": 1,
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "depends_on": "is_pos", 
-   "fieldname": "write_off_account", 
-   "fieldtype": "Link", 
-   "label": "Write Off Account", 
-   "options": "Account", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "depends_on": "is_pos",
+   "fieldname": "write_off_account",
+   "fieldtype": "Link",
+   "label": "Write Off Account",
+   "options": "Account",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "depends_on": "is_pos", 
-   "fieldname": "write_off_cost_center", 
-   "fieldtype": "Link", 
-   "label": "Write Off Cost Center", 
-   "options": "Cost Center", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "depends_on": "is_pos",
+   "fieldname": "write_off_cost_center",
+   "fieldtype": "Link",
+   "label": "Write Off Cost Center",
+   "options": "Cost Center",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "fold", 
-   "fieldtype": "Fold", 
+   "fieldname": "fold",
+   "fieldtype": "Fold",
    "permlevel": 0
-  }, 
+  },
   {
-   "fieldname": "terms_section_break", 
-   "fieldtype": "Section Break", 
-   "label": "Terms and Conditions", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-legal", 
-   "permlevel": 0, 
+   "fieldname": "terms_section_break",
+   "fieldtype": "Section Break",
+   "label": "Terms and Conditions",
+   "oldfieldtype": "Section Break",
+   "options": "icon-legal",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "tc_name", 
-   "fieldtype": "Link", 
-   "label": "Terms", 
-   "oldfieldname": "tc_name", 
-   "oldfieldtype": "Link", 
-   "options": "Terms and Conditions", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "tc_name",
+   "fieldtype": "Link",
+   "label": "Terms",
+   "oldfieldname": "tc_name",
+   "oldfieldtype": "Link",
+   "options": "Terms and Conditions",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "terms", 
-   "fieldtype": "Text Editor", 
-   "label": "Terms and Conditions Details", 
-   "oldfieldname": "terms", 
-   "oldfieldtype": "Text Editor", 
-   "permlevel": 0, 
+   "fieldname": "terms",
+   "fieldtype": "Text Editor",
+   "label": "Terms and Conditions Details",
+   "oldfieldname": "terms",
+   "oldfieldtype": "Text Editor",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "depends_on": "customer", 
-   "fieldname": "contact_section", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "label": "Contact Info", 
-   "options": "icon-bullhorn", 
-   "permlevel": 0, 
+   "depends_on": "customer",
+   "fieldname": "contact_section",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "label": "Contact Info",
+   "options": "icon-bullhorn",
+   "permlevel": 0,
    "read_only": 0
-  }, 
+  },
   {
-   "description": "<a href=\"#Sales Browser/Territory\">Add / Edit</a>", 
-   "fieldname": "territory", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Territory", 
-   "options": "Territory", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "reqd": 1, 
+   "description": "<a href=\"#Sales Browser/Territory\">Add / Edit</a>",
+   "fieldname": "territory",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Territory",
+   "options": "Territory",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "reqd": 1,
    "search_index": 0
-  }, 
+  },
   {
-   "description": "<a href=\"#Sales Browser/Customer Group\">Add / Edit</a>", 
-   "fieldname": "customer_group", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Customer Group", 
-   "options": "Customer Group", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "description": "<a href=\"#Sales Browser/Customer Group\">Add / Edit</a>",
+   "fieldname": "customer_group",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Customer Group",
+   "options": "Customer Group",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "search_index": 0
-  }, 
+  },
   {
-   "fieldname": "col_break23", 
-   "fieldtype": "Column Break", 
-   "permlevel": 0, 
-   "read_only": 0, 
+   "fieldname": "col_break23",
+   "fieldtype": "Column Break",
+   "permlevel": 0,
+   "read_only": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "fieldname": "customer_address", 
-   "fieldtype": "Link", 
-   "label": "Customer Address", 
-   "options": "Address", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "customer_address",
+   "fieldtype": "Link",
+   "label": "Customer Address",
+   "options": "Address",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "contact_person", 
-   "fieldtype": "Link", 
-   "label": "Contact Person", 
-   "options": "Contact", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "contact_person",
+   "fieldtype": "Link",
+   "label": "Contact Person",
+   "options": "Contact",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "more_info", 
-   "fieldtype": "Section Break", 
-   "label": "More Info", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-file-text", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "more_info",
+   "fieldtype": "Section Break",
+   "label": "More Info",
+   "oldfieldtype": "Section Break",
+   "options": "icon-file-text",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "description": "Customer (Receivable) Account", 
-   "fieldname": "debit_to", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Debit To", 
-   "oldfieldname": "debit_to", 
-   "oldfieldtype": "Link", 
-   "options": "Account", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "reqd": 1, 
+   "description": "Customer (Receivable) Account",
+   "fieldname": "debit_to",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Debit To",
+   "oldfieldname": "debit_to",
+   "oldfieldtype": "Link",
+   "options": "Account",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "reqd": 1,
    "search_index": 1
-  }, 
+  },
   {
-   "fieldname": "project_name", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Project Name", 
-   "oldfieldname": "project_name", 
-   "oldfieldtype": "Link", 
-   "options": "Project", 
-   "permlevel": 0, 
-   "read_only": 0, 
+   "fieldname": "project_name",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Project Name",
+   "oldfieldname": "project_name",
+   "oldfieldtype": "Link",
+   "options": "Project",
+   "permlevel": 0,
+   "read_only": 0,
    "search_index": 1
-  }, 
+  },
   {
-   "depends_on": "eval:doc.source == 'Campaign'", 
-   "fieldname": "campaign", 
-   "fieldtype": "Link", 
-   "label": "Campaign", 
-   "oldfieldname": "campaign", 
-   "oldfieldtype": "Link", 
-   "options": "Campaign", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "depends_on": "eval:doc.source == 'Campaign'",
+   "fieldname": "campaign",
+   "fieldtype": "Link",
+   "label": "Campaign",
+   "oldfieldname": "campaign",
+   "oldfieldtype": "Link",
+   "options": "Campaign",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "source", 
-   "fieldtype": "Select", 
-   "label": "Source", 
-   "oldfieldname": "source", 
-   "oldfieldtype": "Select", 
-   "options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "source",
+   "fieldtype": "Select",
+   "label": "Source",
+   "oldfieldname": "source",
+   "oldfieldtype": "Select",
+   "options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "default": "No", 
-   "description": "Considered as an Opening Balance", 
-   "fieldname": "is_opening", 
-   "fieldtype": "Select", 
-   "in_filter": 1, 
-   "label": "Is Opening Entry", 
-   "oldfieldname": "is_opening", 
-   "oldfieldtype": "Select", 
-   "options": "No\nYes", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "default": "No",
+   "description": "Considered as an Opening Balance",
+   "fieldname": "is_opening",
+   "fieldtype": "Select",
+   "in_filter": 1,
+   "label": "Is Opening Entry",
+   "oldfieldname": "is_opening",
+   "oldfieldtype": "Select",
+   "options": "No\nYes",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "search_index": 0
-  }, 
+  },
   {
-   "fieldname": "c_form_applicable", 
-   "fieldtype": "Select", 
-   "label": "C-Form Applicable", 
-   "no_copy": 1, 
-   "options": "No\nYes", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "fieldname": "c_form_applicable",
+   "fieldtype": "Select",
+   "label": "C-Form Applicable",
+   "no_copy": 1,
+   "options": "No\nYes",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "report_hide": 0
-  }, 
+  },
   {
-   "fieldname": "c_form_no", 
-   "fieldtype": "Link", 
-   "label": "C-Form No", 
-   "no_copy": 1, 
-   "options": "C-Form", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "c_form_no",
+   "fieldtype": "Link",
+   "label": "C-Form No",
+   "no_copy": 1,
+   "options": "C-Form",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "fieldname": "column_break8", 
-   "fieldtype": "Column Break", 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "column_break8",
+   "fieldtype": "Column Break",
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 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, 
+   "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
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "fieldname": "select_print_heading", 
-   "fieldtype": "Link", 
-   "label": "Print Heading", 
-   "no_copy": 1, 
-   "oldfieldname": "select_print_heading", 
-   "oldfieldtype": "Link", 
-   "options": "Print Heading", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "allow_on_submit": 1,
+   "fieldname": "select_print_heading",
+   "fieldtype": "Link",
+   "label": "Print Heading",
+   "no_copy": 1,
+   "oldfieldname": "select_print_heading",
+   "oldfieldtype": "Link",
+   "options": "Print Heading",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "report_hide": 1
-  }, 
+  },
   {
-   "fieldname": "posting_time", 
-   "fieldtype": "Time", 
-   "label": "Posting Time", 
-   "no_copy": 1, 
-   "oldfieldname": "posting_time", 
-   "oldfieldtype": "Time", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "posting_time",
+   "fieldtype": "Time",
+   "label": "Posting Time",
+   "no_copy": 1,
+   "oldfieldname": "posting_time",
+   "oldfieldtype": "Time",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "description": "Actual Invoice Date", 
-   "fieldname": "aging_date", 
-   "fieldtype": "Date", 
-   "label": "Aging Date", 
-   "oldfieldname": "aging_date", 
-   "oldfieldtype": "Date", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "description": "Actual Invoice Date",
+   "fieldname": "aging_date",
+   "fieldtype": "Date",
+   "label": "Aging Date",
+   "oldfieldname": "aging_date",
+   "oldfieldtype": "Date",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "fiscal_year", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Fiscal Year", 
-   "no_copy": 0, 
-   "oldfieldname": "fiscal_year", 
-   "oldfieldtype": "Select", 
-   "options": "Fiscal Year", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "reqd": 1, 
+   "fieldname": "fiscal_year",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Fiscal Year",
+   "no_copy": 0,
+   "oldfieldname": "fiscal_year",
+   "oldfieldtype": "Select",
+   "options": "Fiscal Year",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "reqd": 1,
    "search_index": 0
-  }, 
+  },
   {
-   "fieldname": "remarks", 
-   "fieldtype": "Small Text", 
-   "label": "Remarks", 
-   "no_copy": 1, 
-   "oldfieldname": "remarks", 
-   "oldfieldtype": "Text", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "fieldname": "remarks",
+   "fieldtype": "Small Text",
+   "label": "Remarks",
+   "no_copy": 1,
+   "oldfieldname": "remarks",
+   "oldfieldtype": "Text",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "reqd": 0
-  }, 
+  },
   {
-   "fieldname": "sales_team_section_break", 
-   "fieldtype": "Section Break", 
-   "label": "Sales Team", 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-group", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "sales_team_section_break",
+   "fieldtype": "Section Break",
+   "label": "Sales Team",
+   "oldfieldtype": "Section Break",
+   "options": "icon-group",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "column_break9", 
-   "fieldtype": "Column Break", 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "fieldname": "column_break9",
+   "fieldtype": "Column Break",
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "fieldname": "sales_partner", 
-   "fieldtype": "Link", 
-   "in_filter": 1, 
-   "label": "Sales Partner", 
-   "oldfieldname": "sales_partner", 
-   "oldfieldtype": "Link", 
-   "options": "Sales Partner", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "sales_partner",
+   "fieldtype": "Link",
+   "in_filter": 1,
+   "label": "Sales Partner",
+   "oldfieldname": "sales_partner",
+   "oldfieldtype": "Link",
+   "options": "Sales Partner",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "column_break10", 
-   "fieldtype": "Column Break", 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "fieldname": "column_break10",
+   "fieldtype": "Column Break",
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "fieldname": "commission_rate", 
-   "fieldtype": "Float", 
-   "label": "Commission Rate (%)", 
-   "oldfieldname": "commission_rate", 
-   "oldfieldtype": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "commission_rate",
+   "fieldtype": "Float",
+   "label": "Commission Rate (%)",
+   "oldfieldname": "commission_rate",
+   "oldfieldtype": "Currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "total_commission", 
-   "fieldtype": "Currency", 
-   "label": "Total Commission", 
-   "oldfieldname": "total_commission", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "total_commission",
+   "fieldtype": "Currency",
+   "label": "Total Commission",
+   "oldfieldname": "total_commission",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "section_break2", 
-   "fieldtype": "Section Break", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "section_break2",
+   "fieldtype": "Section Break",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "sales_team", 
-   "fieldtype": "Table", 
-   "label": "Sales Team1", 
-   "oldfieldname": "sales_team", 
-   "oldfieldtype": "Table", 
-   "options": "Sales Team", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "fieldname": "sales_team",
+   "fieldtype": "Table",
+   "label": "Sales Team1",
+   "oldfieldname": "sales_team",
+   "oldfieldtype": "Table",
+   "options": "Sales Team",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "depends_on": "eval:doc.docstatus<2", 
-   "fieldname": "recurring_invoice", 
-   "fieldtype": "Section Break", 
-   "label": "Recurring Invoice", 
-   "options": "icon-time", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "depends_on": "eval:doc.docstatus<2",
+   "fieldname": "recurring_invoice",
+   "fieldtype": "Section Break",
+   "label": "Recurring Invoice",
+   "options": "icon-time",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "column_break11", 
-   "fieldtype": "Column Break", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "fieldname": "column_break11",
+   "fieldtype": "Column Break",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "depends_on": "eval:doc.docstatus<2", 
-   "description": "Check if recurring invoice, uncheck to stop recurring or put proper End Date", 
-   "fieldname": "is_recurring", 
-   "fieldtype": "Check", 
-   "label": "Is Recurring", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "allow_on_submit": 1,
+   "depends_on": "eval:doc.docstatus<2",
+   "description": "Check if recurring invoice, uncheck to stop recurring or put proper End Date",
+   "fieldname": "is_recurring",
+   "fieldtype": "Check",
+   "label": "Is Recurring",
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "Select the period when the invoice will be generated automatically", 
-   "fieldname": "recurring_type", 
-   "fieldtype": "Select", 
-   "label": "Recurring Type", 
-   "no_copy": 1, 
-   "options": "\nMonthly\nQuarterly\nHalf-yearly\nYearly", 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "allow_on_submit": 1,
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "Select the period when the invoice will be generated automatically",
+   "fieldname": "recurring_type",
+   "fieldtype": "Select",
+   "label": "Recurring Type",
+   "no_copy": 1,
+   "options": "\nMonthly\nQuarterly\nHalf-yearly\nYearly",
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "The day of the month on which auto invoice will be generated e.g. 05, 28 etc ", 
-   "fieldname": "repeat_on_day_of_month", 
-   "fieldtype": "Int", 
-   "label": "Repeat on Day of Month", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "allow_on_submit": 1,
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "The day of the month on which auto invoice will be generated e.g. 05, 28 etc ",
+   "fieldname": "repeat_on_day_of_month",
+   "fieldtype": "Int",
+   "label": "Repeat on Day of Month",
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "The date on which next invoice will be generated. It is generated on submit.\n", 
-   "fieldname": "next_date", 
-   "fieldtype": "Date", 
-   "label": "Next Date", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "The date on which next invoice will be generated. It is generated on submit.\n",
+   "fieldname": "next_date",
+   "fieldtype": "Date",
+   "label": "Next Date",
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "The date on which recurring invoice will be stop", 
-   "fieldname": "end_date", 
-   "fieldtype": "Date", 
-   "label": "End Date", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "allow_on_submit": 1,
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "The date on which recurring invoice will be stop",
+   "fieldname": "end_date",
+   "fieldtype": "Date",
+   "label": "End Date",
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "column_break12", 
-   "fieldtype": "Column Break", 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "fieldname": "column_break12",
+   "fieldtype": "Column Break",
+   "no_copy": 0,
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "The unique id for tracking all recurring invoices.\u00a0It is generated on submit.", 
-   "fieldname": "recurring_id", 
-   "fieldtype": "Data", 
-   "label": "Recurring Id", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "The unique id for tracking all recurring invoices.\u00a0It is generated on submit.",
+   "fieldname": "recurring_id",
+   "fieldtype": "Data",
+   "label": "Recurring Id",
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 1
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "Enter email id separated by commas, invoice will be mailed automatically on particular date", 
-   "fieldname": "notification_email_address", 
-   "fieldtype": "Small Text", 
-   "label": "Notification Email Address", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 1, 
+   "allow_on_submit": 1,
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "Enter email id separated by commas, invoice will be mailed automatically on particular date",
+   "fieldname": "notification_email_address",
+   "fieldtype": "Small Text",
+   "label": "Notification Email Address",
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 1,
    "read_only": 0
-  }, 
+  },
   {
-   "fieldname": "against_income_account", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "label": "Against Income Account", 
-   "no_copy": 1, 
-   "oldfieldname": "against_income_account", 
-   "oldfieldtype": "Small Text", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
+   "fieldname": "against_income_account",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "label": "Against Income Account",
+   "no_copy": 1,
+   "oldfieldname": "against_income_account",
+   "oldfieldtype": "Small Text",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
    "report_hide": 1
   }
- ], 
- "icon": "icon-file-text", 
- "idx": 1, 
- "is_submittable": 1, 
- "modified": "2014-09-18 03:17:54.976732", 
- "modified_by": "Administrator", 
- "module": "Accounts", 
- "name": "Sales Invoice", 
- "owner": "Administrator", 
+ ],
+ "icon": "icon-file-text",
+ "idx": 1,
+ "is_submittable": 1,
+ "modified": "2014-09-18 03:17:54.976732",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Sales Invoice",
+ "owner": "Administrator",
  "permissions": [
   {
-   "amend": 1, 
-   "cancel": 1, 
-   "create": 1, 
-   "delete": 1, 
-   "email": 1, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Accounts Manager", 
-   "submit": 1, 
+   "amend": 1,
+   "cancel": 1,
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Accounts Manager",
+   "submit": 1,
    "write": 1
-  }, 
+  },
   {
-   "amend": 1, 
-   "apply_user_permissions": 1, 
-   "cancel": 0, 
-   "create": 1, 
-   "delete": 0, 
-   "email": 1, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Accounts User", 
-   "submit": 1, 
+   "amend": 1,
+   "apply_user_permissions": 1,
+   "cancel": 0,
+   "create": 1,
+   "delete": 0,
+   "email": 1,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Accounts User",
+   "submit": 1,
    "write": 1
-  }, 
+  },
   {
-   "apply_user_permissions": 1, 
-   "cancel": 0, 
-   "delete": 0, 
-   "email": 1, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
+   "apply_user_permissions": 1,
+   "cancel": 0,
+   "delete": 0,
+   "email": 1,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
    "role": "Customer"
-  }, 
+  },
   {
-   "permlevel": 1, 
-   "read": 1, 
-   "role": "Accounts Manager", 
+   "permlevel": 1,
+   "read": 1,
+   "role": "Accounts Manager",
    "write": 1
   }
- ], 
- "read_only_onload": 1, 
- "search_fields": "posting_date, due_date, debit_to, fiscal_year, grand_total, outstanding_amount", 
- "sort_field": "modified", 
+ ],
+ "read_only_onload": 1,
+ "search_fields": "posting_date, due_date, customer, fiscal_year, grand_total, outstanding_amount",
+ "sort_field": "modified",
  "sort_order": "DESC"
-}
\ No newline at end of file
+}
diff --git a/erpnext/accounts/doctype/sales_invoice/test_records.json b/erpnext/accounts/doctype/sales_invoice/test_records.json
index 76c70cc..ec1a774 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_records.json
+++ b/erpnext/accounts/doctype/sales_invoice/test_records.json
@@ -5,7 +5,7 @@
   "currency": "INR",
   "customer": "_Test Customer",
   "customer_name": "_Test Customer",
-  "debit_to": "_Test Customer - _TC",
+  "debit_to": "_Test Receivable - _TC",
   "doctype": "Sales Invoice",
   "due_date": "2013-01-23",
   "entries": [
@@ -74,7 +74,7 @@
   "currency": "INR",
   "customer": "_Test Customer",
   "customer_name": "_Test Customer",
-  "debit_to": "_Test Customer - _TC",
+  "debit_to": "_Test Receivable - _TC",
   "doctype": "Sales Invoice",
   "due_date": "2013-03-07",
   "entries": [
@@ -130,7 +130,7 @@
   "currency": "INR",
   "customer": "_Test Customer",
   "customer_name": "_Test Customer",
-  "debit_to": "_Test Customer - _TC",
+  "debit_to": "_Test Receivable - _TC",
   "doctype": "Sales Invoice",
   "due_date": "2013-01-23",
   "entries": [
@@ -256,7 +256,7 @@
   "currency": "INR",
   "customer": "_Test Customer",
   "customer_name": "_Test Customer",
-  "debit_to": "_Test Customer - _TC",
+  "debit_to": "_Test Receivable - _TC",
   "doctype": "Sales Invoice",
   "due_date": "2013-01-23",
   "entries": [
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index 53869c4..0d9876a 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -4,7 +4,7 @@
 from __future__ import unicode_literals
 
 import frappe
-from frappe import _, msgprint
+from frappe import _, msgprint, scrub
 from frappe.defaults import get_user_permissions
 from frappe.utils import add_days, getdate, formatdate, flt
 from erpnext.utilities.doctype.address.address import get_address_display
@@ -116,8 +116,6 @@
 
 	if party:
 		account = get_party_account(company, party, party_type)
-	elif account:
-		party = frappe.db.get_value('Account', account, 'master_name')
 
 	account_fieldname = "debit_to" if party_type=="Customer" else "credit_to"
 
@@ -128,15 +126,26 @@
 	}
 	return out
 
+@frappe.whitelist()
 def get_party_account(company, party, party_type):
 	if not company:
 		frappe.throw(_("Please select company first."))
 
 	if party:
-		acc_head = frappe.db.get_value("Account", {"master_name":party,
-			"master_type": party_type, "company": company})
+		party_group_doctype = "Customer Group" if party_type=="Customer" else "Supplier Type"
+		party_details = frappe.db.sql("""select p.{0}, pa.account
+			from `tab{1}` p left join `tabParty Account` pa on pa.parent = p.name
+			where p.name = %s""".format(scrub(party_group_doctype), party_type), party)
+		if party_details:
+			party_group, account = party_details[0]
 
-		return acc_head
+		if not account:
+			account = frappe.db.get_value("Party Account",
+				{"parenttype": party_group_doctype, "parent": party_group, "company": company}, "account") or \
+				frappe.db.get_value("Company", company,
+					"default_receivable_account" if party_type=="Customer" else "default_payable_account")
+
+		return account
 
 def get_due_date(posting_date, party_type, party, company):
 	"""Set Due Date = Posting Date + Credit Days"""
diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js
index 1f5d1f4..db71422 100644
--- a/erpnext/selling/doctype/customer/customer.js
+++ b/erpnext/selling/doctype/customer/customer.js
@@ -65,9 +65,9 @@
 				if(r.message["company_currency"].length == 1) {
 					cur_frm.dashboard.set_headline(
 						__("Total Billing This Year: ") + "<b>"
-						+ format_currency(r.message.total_billing, company_currency[0])
+						+ format_currency(r.message.total_billing, r.message["company_currency"][0])
 						+ '</b> / <span class="text-muted">' + __("Unpaid") + ": <b>"
-						+ format_currency(r.message.total_unpaid, company_currency[0])
+						+ format_currency(r.message.total_unpaid, r.message["company_currency"][0])
 						+ '</b></span>');
 				}
 			}
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 8f00138..bdc7be3 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -813,6 +813,8 @@
 	# customer account entry
 	parent = {
 		"account": ref.doc.debit_to,
+		"party_type": "Customer",
+		"party": ref.doc.customer,
 		"against_invoice": ref.doc.name,
 	}
 
@@ -879,7 +881,11 @@
 				children.append(account)
 
 			if not parent:
-				parent = {"account": si.debit_to}
+				parent = {
+					"account": si.debit_to,
+					"party_type": "Customer",
+					"party": si.customer
+				}
 
 			break
 
@@ -933,7 +939,11 @@
 				children.append(account)
 
 			if not parent:
-				parent = {"account": pi.credit_to}
+				parent = {
+					"account": pi.credit_to,
+					"party_type": "Supplier",
+					"party": pi.supplier
+				}
 
 			break
 
diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
index fb136f2..072f26e 100644
--- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
@@ -332,7 +332,7 @@
 
 		si = frappe.get_doc(si_doc)
 		si.posting_date = dn.posting_date
-		si.debit_to = "_Test Customer - _TC"
+		si.debit_to = "_Test Receivable - _TC"
 		for d in si.get("entries"):
 			d.income_account = "Sales - _TC"
 			d.cost_center = "_Test Cost Center - _TC"
@@ -425,7 +425,7 @@
 
 		si = make_sales_invoice(so.name)
 		si.posting_date = dn.posting_date
-		si.debit_to = "_Test Customer - _TC"
+		si.debit_to = "_Test Receivable - _TC"
 		for d in si.get("entries"):
 			d.income_account = "Sales - _TC"
 			d.cost_center = "_Test Cost Center - _TC"
@@ -471,7 +471,7 @@
 
 		pi = frappe.get_doc(pi_doc)
 		pi.posting_date = pr.posting_date
-		pi.credit_to = "_Test Supplier - _TC"
+		pi.credit_to = "_Test Payable - _TC"
 		for d in pi.get("entries"):
 			d.expense_account = "_Test Account Cost for Goods Sold - _TC"
 			d.cost_center = "_Test Cost Center - _TC"
@@ -574,7 +574,7 @@
 
 		pi = frappe.get_doc(pi_doc)
 		pi.posting_date = pr.posting_date
-		pi.credit_to = "_Test Supplier - _TC"
+		pi.credit_to = "_Test Payable - _TC"
 		for d in pi.get("entries"):
 			d.expense_account = "_Test Account Cost for Goods Sold - _TC"
 			d.cost_center = "_Test Cost Center - _TC"