Merge branch 'develop'
diff --git a/erpnext/__version__.py b/erpnext/__version__.py
index 7394cf1..4fabe95 100644
--- a/erpnext/__version__.py
+++ b/erpnext/__version__.py
@@ -1,2 +1,2 @@
 from __future__ import unicode_literals
-__version__ = '6.9.2'
+__version__ = '6.10.0'
diff --git a/erpnext/accounts/doctype/account/account.json b/erpnext/accounts/doctype/account/account.json
index ca26ffb..66e7108 100644
--- a/erpnext/accounts/doctype/account/account.json
+++ b/erpnext/accounts/doctype/account/account.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -41,6 +42,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -63,6 +65,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Account Name", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "account_name", 
    "oldfieldtype": "Data", 
@@ -87,6 +90,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Group", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -109,6 +113,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -132,7 +137,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Root Type",  
+   "label": "Root Type", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nAsset\nLiability\nIncome\nExpense\nEquity", 
    "permlevel": 0, 
@@ -154,7 +160,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Report Type",  
+   "label": "Report Type", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nBalance Sheet\nProfit and Loss", 
    "permlevel": 0, 
@@ -178,6 +185,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Currency", 
    "permlevel": 0, 
@@ -200,6 +208,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -222,6 +231,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Parent Account", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "parent_account", 
    "oldfieldtype": "Link", 
@@ -246,7 +256,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
-   "label": "Account Type",  
+   "label": "Account Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "account_type", 
    "oldfieldtype": "Select", 
@@ -272,6 +283,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "tax_rate", 
    "oldfieldtype": "Currency", 
@@ -295,7 +307,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Frozen",  
+   "label": "Frozen", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "freeze_account", 
    "oldfieldtype": "Select", 
@@ -320,6 +333,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Warehouse", 
    "permlevel": 0, 
@@ -341,7 +355,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Balance must be",  
+   "label": "Balance must be", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nDebit\nCredit", 
    "permlevel": 0, 
@@ -364,6 +379,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Lft", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -385,6 +401,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rgt", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -406,6 +423,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Old Parent", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -426,7 +444,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:37.436071", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:41.535663", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Account", 
diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
index f1c8820..731425c 100644
--- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
+++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
@@ -15,7 +15,7 @@
 
 		condition = ""
 		if not self.include_reconciled_entries:
-			condition = "and ifnull(clearance_date, '') in ('', '0000-00-00')"
+			condition = "and (clearance_date is null or clearance_date='0000-00-00')"
 
 
 		dl = frappe.db.sql("""select t1.name, t1.cheque_no, t1.cheque_date, t2.debit,
diff --git a/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.json b/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.json
index 7afb33f..ca4523c 100644
--- a/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.json
+++ b/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Voucher ID", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "voucher_id", 
    "oldfieldtype": "Link", 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Clearance Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "clearance_date", 
    "oldfieldtype": "Date", 
@@ -65,6 +67,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Against Account", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "against_account", 
    "oldfieldtype": "Data", 
@@ -88,6 +91,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Cheque Number", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "cheque_number", 
    "oldfieldtype": "Data", 
@@ -111,6 +115,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Debit", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "debit", 
    "oldfieldtype": "Currency", 
@@ -135,6 +140,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Credit", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "credit", 
    "oldfieldtype": "Currency", 
@@ -159,6 +165,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reference Type", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "DocType", 
    "permlevel": 0, 
@@ -182,6 +189,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reference Name", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "reference_type", 
    "permlevel": 0, 
@@ -205,6 +213,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Posting Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "posting_date", 
    "oldfieldtype": "Date", 
@@ -228,6 +237,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Cheque Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "cheque_date", 
    "oldfieldtype": "Date", 
@@ -249,7 +259,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:39.149782", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:42.254366", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Bank Reconciliation Detail", 
diff --git a/erpnext/accounts/doctype/budget_detail/budget_detail.json b/erpnext/accounts/doctype/budget_detail/budget_detail.json
index 4d9b489..99d3919 100644
--- a/erpnext/accounts/doctype/budget_detail/budget_detail.json
+++ b/erpnext/accounts/doctype/budget_detail/budget_detail.json
@@ -19,6 +19,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Account", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "account", 
    "oldfieldtype": "Link", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Budget Allocated", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "budget_allocated", 
    "oldfieldtype": "Currency", 
@@ -67,6 +69,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -89,7 +92,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:40.727468", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:43.050558", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Budget Detail", 
diff --git a/erpnext/accounts/doctype/c_form/c_form.json b/erpnext/accounts/doctype/c_form/c_form.json
index fe5a2cd..83b2ddc 100644
--- a/erpnext/accounts/doctype/c_form/c_form.json
+++ b/erpnext/accounts/doctype/c_form/c_form.json
@@ -18,6 +18,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -40,7 +41,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Series",  
+   "label": "Series", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "C-FORM-", 
    "permlevel": 0, 
@@ -63,6 +65,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "C-Form No", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -84,6 +87,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Received Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -105,6 +109,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Customer", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Customer", 
    "permlevel": 0, 
@@ -126,6 +131,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -149,6 +155,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -171,6 +178,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Fiscal Year", 
    "permlevel": 0, 
@@ -192,7 +200,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Quarter",  
+   "label": "Quarter", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nI\nII\nIII\nIV", 
    "permlevel": 0, 
@@ -215,6 +224,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -237,6 +247,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "State", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -257,6 +268,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -278,6 +290,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Invoices", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "C-Form Invoice Detail", 
    "permlevel": 0, 
@@ -300,6 +313,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Invoiced Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -322,6 +336,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "C-Form", 
    "permlevel": 0, 
@@ -344,7 +359,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 3, 
- "modified": "2015-10-02 07:38:40.926061", 
+ "modified": "2015-11-16 06:29:43.143528", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "C-Form", 
diff --git a/erpnext/accounts/doctype/c_form/test_c_form.py b/erpnext/accounts/doctype/c_form/test_c_form.py
new file mode 100644
index 0000000..c4c95db
--- /dev/null
+++ b/erpnext/accounts/doctype/c_form/test_c_form.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import frappe
+import unittest
+
+# test_records = frappe.get_test_records('C-Form')
+
+class TestCForm(unittest.TestCase):
+	pass
diff --git a/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.json b/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.json
index 2292caa..351ce99 100644
--- a/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.json
+++ b/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Invoice No", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Sales Invoice", 
    "permlevel": 0, 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Invoice Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -66,6 +68,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Territory", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Territory", 
    "permlevel": 0, 
@@ -90,6 +93,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Net Total", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -114,6 +118,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Grand Total", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -136,7 +141,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:41.105885", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:43.221484", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "C-Form Invoice Detail", 
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.json b/erpnext/accounts/doctype/cost_center/cost_center.json
index 93ffac9..e69a9c2 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.json
+++ b/erpnext/accounts/doctype/cost_center/cost_center.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Cost Center Name", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "cost_center_name", 
    "oldfieldtype": "Data", 
@@ -65,6 +67,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Parent Cost Center", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "parent_cost_center", 
    "oldfieldtype": "Link", 
@@ -89,6 +92,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company_name", 
    "oldfieldtype": "Link", 
@@ -112,6 +116,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -135,6 +140,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Group", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -158,6 +164,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Budget", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -180,6 +187,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Distribution Id", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "distribution_id", 
    "oldfieldtype": "Link", 
@@ -205,6 +213,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Budgets", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "budget_details", 
    "oldfieldtype": "Table", 
@@ -229,6 +238,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "lft", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "lft", 
    "oldfieldtype": "Int", 
@@ -252,6 +262,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "rgt", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "rgt", 
    "oldfieldtype": "Int", 
@@ -275,6 +286,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "old_parent", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "old_parent", 
    "oldfieldtype": "Data", 
@@ -298,7 +310,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:42.617993", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:43.870712", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Cost Center", 
diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.json b/erpnext/accounts/doctype/fiscal_year/fiscal_year.json
index a8ad0f2..fcbd72c 100644
--- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.json
+++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.json
@@ -22,6 +22,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Year Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "year", 
    "oldfieldtype": "Data", 
@@ -45,6 +46,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Disabled", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -67,6 +69,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Year Start Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "year_start_date", 
    "oldfieldtype": "Date", 
@@ -90,6 +93,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Year End Date", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -111,6 +115,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Companies", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Fiscal Year Company", 
    "permlevel": 0, 
@@ -133,7 +138,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:50.942038", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:47.289982", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Fiscal Year", 
diff --git a/erpnext/accounts/doctype/fiscal_year_company/fiscal_year_company.json b/erpnext/accounts/doctype/fiscal_year_company/fiscal_year_company.json
index 6892b16..2957d0b 100644
--- a/erpnext/accounts/doctype/fiscal_year_company/fiscal_year_company.json
+++ b/erpnext/accounts/doctype/fiscal_year_company/fiscal_year_company.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -39,7 +40,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:51.045350", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:47.344839", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Fiscal Year Company", 
diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.json b/erpnext/accounts/doctype/gl_entry/gl_entry.json
index 5f07df9..b7b698c 100644
--- a/erpnext/accounts/doctype/gl_entry/gl_entry.json
+++ b/erpnext/accounts/doctype/gl_entry/gl_entry.json
@@ -19,6 +19,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Posting Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "posting_date", 
    "oldfieldtype": "Date", 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Transaction Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "transaction_date", 
    "oldfieldtype": "Date", 
@@ -65,6 +67,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Account", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "account", 
    "oldfieldtype": "Link", 
@@ -89,6 +92,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Party Type", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "DocType", 
    "permlevel": 0, 
@@ -111,6 +115,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Party", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "party_type", 
    "permlevel": 0, 
@@ -133,6 +138,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Cost Center", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "cost_center", 
    "oldfieldtype": "Link", 
@@ -157,6 +163,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Debit Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "debit", 
    "oldfieldtype": "Currency", 
@@ -182,6 +189,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Credit Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "credit", 
    "oldfieldtype": "Currency", 
@@ -207,6 +215,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Account Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Currency", 
    "permlevel": 0, 
@@ -230,6 +239,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Debit Amount in Account Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -253,6 +263,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Credit Amount in Account Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -276,6 +287,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Against", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "against", 
    "oldfieldtype": "Text", 
@@ -299,6 +311,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Against Voucher Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "against_voucher_type", 
    "oldfieldtype": "Data", 
@@ -323,6 +336,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Against Voucher", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "against_voucher", 
    "oldfieldtype": "Data", 
@@ -347,6 +361,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Voucher Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "voucher_type", 
    "oldfieldtype": "Select", 
@@ -371,6 +386,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Voucher No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "voucher_no", 
    "oldfieldtype": "Data", 
@@ -395,6 +411,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Remarks", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "remarks", 
    "oldfieldtype": "Text", 
@@ -418,6 +435,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Is Opening", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_opening", 
    "oldfieldtype": "Select", 
@@ -442,6 +460,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Advance", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_advance", 
    "oldfieldtype": "Select", 
@@ -466,6 +485,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -490,6 +510,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -513,7 +534,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-20 12:10:59.771050", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:47.382225", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "GL Entry", 
diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.py b/erpnext/accounts/doctype/gl_entry/gl_entry.py
index f0f0fa4..1f6ff35 100644
--- a/erpnext/accounts/doctype/gl_entry/gl_entry.py
+++ b/erpnext/accounts/doctype/gl_entry/gl_entry.py
@@ -120,7 +120,7 @@
 	if not adv_adj and account:
 		balance_must_be = frappe.db.get_value("Account", account, "balance_must_be")
 		if balance_must_be:
-			balance = frappe.db.sql("""select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
+			balance = frappe.db.sql("""select sum(debit) - sum(credit)
 				from `tabGL Entry` where account = %s""", account)[0][0]
 
 			if (balance_must_be=="Debit" and flt(balance) < 0) or \
@@ -142,14 +142,14 @@
 
 def update_outstanding_amt(account, party_type, party, against_voucher_type, against_voucher, on_cancel=False):
 	if party_type and party:
-		party_condition = " and ifnull(party_type, '')='{0}' and ifnull(party, '')='{1}'"\
+		party_condition = " and party_type='{0}' and party='{1}'"\
 			.format(frappe.db.escape(party_type), frappe.db.escape(party))
 	else:
 		party_condition = ""
 
 	# get final outstanding amt
 	bal = flt(frappe.db.sql("""
-		select sum(ifnull(debit_in_account_currency, 0)) - sum(ifnull(credit_in_account_currency, 0))
+		select sum(debit_in_account_currency) - sum(credit_in_account_currency)
 		from `tabGL Entry`
 		where against_voucher_type=%s and against_voucher=%s
 		and account = %s {0}""".format(party_condition),
@@ -159,9 +159,9 @@
 		bal = -bal
 	elif against_voucher_type == "Journal Entry":
 		against_voucher_amount = flt(frappe.db.sql("""
-			select sum(ifnull(debit_in_account_currency, 0)) - sum(ifnull(credit_in_account_currency, 0))
+			select sum(debit_in_account_currency) - sum(credit_in_account_currency)
 			from `tabGL Entry` where voucher_type = 'Journal Entry' and voucher_no = %s
-			and account = %s and ifnull(against_voucher, '') = '' {0}"""
+			and account = %s and (against_voucher is null or against_voucher='') {0}"""
 			.format(party_condition), (against_voucher, account))[0][0])
 
 		if not against_voucher_amount:
diff --git a/erpnext/accounts/doctype/gl_entry/test_gl_entry.py b/erpnext/accounts/doctype/gl_entry/test_gl_entry.py
index 146d084..6cc9bc8 100644
--- a/erpnext/accounts/doctype/gl_entry/test_gl_entry.py
+++ b/erpnext/accounts/doctype/gl_entry/test_gl_entry.py
@@ -9,17 +9,17 @@
 	def test_round_off_entry(self):
 		frappe.db.set_value("Company", "_Test Company", "round_off_account", "_Test Write Off - _TC")
 		frappe.db.set_value("Company", "_Test Company", "round_off_cost_center", "_Test Cost Center - _TC")
-		
-		jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC", 
+
+		jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
 			"_Test Bank - _TC", 100, "_Test Cost Center - _TC", submit=False)
-			
+
 		jv.get("accounts")[0].debit = 100.01
 		jv.flags.ignore_validate = True
 		jv.submit()
-		
+
 		round_off_entry = frappe.db.sql("""select name from `tabGL Entry`
-			where voucher_type='Journal Entry' and voucher_no = %s 
+			where voucher_type='Journal Entry' and voucher_no = %s
 			and account='_Test Write Off - _TC' and cost_center='_Test Cost Center - _TC'
-			and ifnull(debit, 0) = 0 and ifnull(credit, 0) = '.01'""", jv.name)
-			
-		self.assertTrue(round_off_entry)
\ No newline at end of file
+			and debit = 0 and credit = '.01'""", jv.name)
+
+		self.assertTrue(round_off_entry)
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.json b/erpnext/accounts/doctype/journal_entry/journal_entry.json
index abfbaa4..1237245 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.json
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-flag", 
    "permlevel": 0, 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Title", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -64,7 +66,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
-   "label": "Entry Type",  
+   "label": "Entry Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "voucher_type", 
    "oldfieldtype": "Select", 
@@ -88,7 +91,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Series",  
+   "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "naming_series", 
    "oldfieldtype": "Select", 
@@ -112,6 +116,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -135,6 +140,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Posting Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "posting_date", 
    "oldfieldtype": "Date", 
@@ -158,6 +164,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-table", 
@@ -181,6 +188,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Accounting Entries", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "entries", 
    "oldfieldtype": "Table", 
@@ -204,6 +212,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -226,6 +235,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Reference Number", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "cheque_no", 
    "oldfieldtype": "Data", 
@@ -249,6 +259,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reference Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "cheque_date", 
    "oldfieldtype": "Date", 
@@ -272,6 +283,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "User Remark", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "user_remark", 
    "oldfieldtype": "Small Text", 
@@ -294,6 +306,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -315,6 +328,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Total Debit", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "total_debit", 
    "oldfieldtype": "Currency", 
@@ -339,6 +353,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Total Credit", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "total_credit", 
    "oldfieldtype": "Currency", 
@@ -364,6 +379,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Difference (Dr - Cr)", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "difference", 
    "oldfieldtype": "Currency", 
@@ -389,6 +405,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Make Difference Entry", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Button", 
    "permlevel": 0, 
@@ -411,6 +428,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Multi Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -433,6 +451,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Amount", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -455,6 +474,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Amount in Words", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -476,6 +496,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reference", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-pushpin", 
    "permlevel": 0, 
@@ -498,6 +519,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Clearance Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "clearance_date", 
    "oldfieldtype": "Date", 
@@ -522,6 +544,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Remark", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "remark", 
    "oldfieldtype": "Small Text", 
@@ -544,6 +567,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -565,6 +589,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Bill No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "bill_no", 
    "oldfieldtype": "Data", 
@@ -588,6 +613,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Bill Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "bill_date", 
    "oldfieldtype": "Date", 
@@ -611,6 +637,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Due Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "due_date", 
    "oldfieldtype": "Date", 
@@ -635,6 +662,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Write Off", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -658,7 +686,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Write Off Based On",  
+   "label": "Write Off Based On", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Accounts Receivable\nAccounts Payable", 
    "permlevel": 0, 
@@ -682,6 +711,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Get Outstanding Invoices", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "get_outstanding_invoices", 
    "permlevel": 0, 
@@ -703,6 +733,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -726,6 +757,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Write Off Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -748,6 +780,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Printing Settings", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -770,6 +803,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Pay To / Recd From", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -790,6 +824,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -812,6 +847,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Letter Head", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Letter Head", 
    "permlevel": 0, 
@@ -834,6 +870,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Print Heading", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "select_print_heading", 
    "oldfieldtype": "Link", 
@@ -858,6 +895,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "More Information", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-file-text", 
@@ -881,6 +919,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -905,6 +944,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -928,6 +968,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -952,7 +993,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
-   "label": "Is Opening",  
+   "label": "Is Opening", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_opening", 
    "oldfieldtype": "Select", 
@@ -978,6 +1020,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Stock Entry", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Stock Entry", 
    "permlevel": 0, 
@@ -1001,6 +1044,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Link", 
@@ -1024,7 +1068,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:54.074343", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:48.813805", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Journal Entry", 
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index c5035ad..2bfad4e 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import frappe
+import frappe, json
 from frappe.utils import cstr, flt, fmt_money, formatdate
 from frappe import msgprint, _, scrub
 from erpnext.controllers.accounts_controller import AccountsController
@@ -28,7 +28,7 @@
 		self.validate_entries_for_advance()
 		self.validate_multi_currency()
 		self.set_amounts_in_company_currency()
-		self.validate_debit_and_credit()
+		self.validate_total_debit_and_credit()
 		self.validate_against_jv()
 		self.validate_reference_doc()
 		self.set_against_account()
@@ -121,7 +121,7 @@
 
 				against_entries = frappe.db.sql("""select * from `tabJournal Entry Account`
 					where account = %s and docstatus = 1 and parent = %s
-					and ifnull(reference_type, '') in ("", "Sales Order", "Purchase Order")
+					and (reference_type is null or reference_type in ("", "Sales Order", "Purchase Order"))
 					""", (d.account, d.reference_name), as_dict=True)
 
 				if not against_entries:
@@ -252,7 +252,13 @@
 			if flt(d.debit > 0): d.against_account = ", ".join(list(set(accounts_credited)))
 			if flt(d.credit > 0): d.against_account = ", ".join(list(set(accounts_debited)))
 
-	def validate_debit_and_credit(self):
+	def validate_total_debit_and_credit(self):
+		self.set_total_debit_credit()
+		if self.difference:
+			frappe.throw(_("Total Debit must be equal to Total Credit. The difference is {0}")
+				.format(self.difference))
+
+	def set_total_debit_credit(self):
 		self.total_debit, self.total_credit, self.difference = 0, 0, 0
 		for d in self.get("accounts"):
 			if d.debit and d.credit:
@@ -264,10 +270,6 @@
 		self.difference = flt(self.total_debit, self.precision("total_debit")) - \
 			flt(self.total_credit, self.precision("total_credit"))
 
-		if self.difference:
-			frappe.throw(_("Total Debit must be equal to Total Credit. The difference is {0}")
-				.format(self.difference))
-
 	def validate_multi_currency(self):
 		alternate_currency = []
 		for d in self.get("accounts"):
@@ -283,7 +285,7 @@
 				frappe.throw(_("Please check Multi Currency option to allow accounts with other currency"))
 
 		self.set_exchange_rate()
-	
+
 	def set_amounts_in_company_currency(self):
 		for d in self.get("accounts"):
 			d.debit = flt(flt(d.debit_in_account_currency)*flt(d.exchange_rate), d.precision("debit"))
@@ -404,7 +406,7 @@
 					blank_row.debit_in_account_currency = abs(diff)
 					blank_row.debit = abs(diff)
 
-			self.validate_debit_and_credit()
+			self.validate_total_debit_and_credit()
 
 	def get_outstanding_invoices(self):
 		self.set('accounts', [])
@@ -432,7 +434,7 @@
 		elif self.write_off_based_on == 'Accounts Payable':
 			jd2.credit = total
 
-		self.validate_debit_and_credit()
+		self.validate_total_debit_and_credit()
 
 
 	def get_values(self):
@@ -520,14 +522,14 @@
 			"account_currency": account_details.account_currency,
 			"account_type": account_details.account_type
 		}
-		
+
 @frappe.whitelist()
 def get_payment_entry_against_order(dt, dn):
 	ref_doc = frappe.get_doc(dt, dn)
-	
+
 	if flt(ref_doc.per_billed, 2) > 0:
 		frappe.throw(_("Can only make payment against unbilled {0}").format(dt))
-		
+
 	if dt == "Sales Order":
 		party_type = "Customer"
 		amount_field_party = "credit_in_account_currency"
@@ -536,15 +538,15 @@
 		party_type = "Supplier"
 		amount_field_party = "debit_in_account_currency"
 		amount_field_bank = "credit_in_account_currency"
-		
+
 	party_account = get_party_account(party_type, ref_doc.get(party_type.lower()), ref_doc.company)
 	party_account_currency = get_account_currency(party_account)
-	
+
 	if party_account_currency == ref_doc.company_currency:
 		amount = flt(ref_doc.base_grand_total) - flt(ref_doc.advance_paid)
 	else:
 		amount = flt(ref_doc.grand_total) - flt(ref_doc.advance_paid)
-		
+
 	return get_payment_entry(ref_doc, {
 		"party_type": party_type,
 		"party_account": party_account,
@@ -555,35 +557,40 @@
 		"remarks": 'Advance Payment received against {0} {1}'.format(dt, dn),
 		"is_advance": "Yes"
 	})
-	
+
 @frappe.whitelist()
 def get_payment_entry_against_invoice(dt, dn):
 	ref_doc = frappe.get_doc(dt, dn)
 	if dt == "Sales Invoice":
 		party_type = "Customer"
 		party_account = ref_doc.debit_to
-		amount_field_party = "credit_in_account_currency"
-		amount_field_bank = "debit_in_account_currency"
 	else:
 		party_type = "Supplier"
 		party_account = ref_doc.credit_to
+
+
+	if (dt=="Sales Invoice" and ref_doc.outstanding_amount > 0) \
+		or (dt=="Purchase Invoice" and ref_doc.outstanding_amount < 0):
+			amount_field_party = "credit_in_account_currency"
+			amount_field_bank = "debit_in_account_currency"
+	else:
 		amount_field_party = "debit_in_account_currency"
 		amount_field_bank = "credit_in_account_currency"
-		
+
 	return get_payment_entry(ref_doc, {
 		"party_type": party_type,
 		"party_account": party_account,
 		"party_account_currency": ref_doc.party_account_currency,
 		"amount_field_party": amount_field_party,
 		"amount_field_bank": amount_field_bank,
-		"amount": ref_doc.outstanding_amount,
+		"amount": abs(ref_doc.outstanding_amount),
 		"remarks": 'Payment received against {0} {1}. {2}'.format(dt, dn, ref_doc.remarks),
 		"is_advance": "No"
 	})
-	
+
 def get_payment_entry(ref_doc, args):
 	cost_center = frappe.db.get_value("Company", ref_doc.company, "cost_center")
-	exchange_rate = get_exchange_rate(args.get("party_account"), args.get("party_account_currency"), 
+	exchange_rate = get_exchange_rate(args.get("party_account"), args.get("party_account_currency"),
 		ref_doc.company, ref_doc.doctype, ref_doc.name)
 
 	jv = frappe.new_doc("Journal Entry")
@@ -592,7 +599,7 @@
 		"company": ref_doc.company,
 		"remark": args.get("remarks")
 	})
-	
+
 	party_row = jv.append("accounts", {
 		"account": args.get("party_account"),
 		"party_type": args.get("party_type"),
@@ -601,7 +608,7 @@
 		"account_type": frappe.db.get_value("Account", args.get("party_account"), "account_type"),
 		"account_currency": args.get("party_account_currency") or \
 			get_account_currency(args.get("party_account")),
-		"account_balance": get_balance_on(args.get("party_account")),
+		"balance": get_balance_on(args.get("party_account")),
 		"party_balance": get_balance_on(party=args.get("party"), party_type=args.get("party_type")),
 		"exchange_rate": exchange_rate,
 		args.get("amount_field_party"): args.get("amount"),
@@ -614,11 +621,11 @@
 	bank_account = get_default_bank_cash_account(ref_doc.company, "Bank Entry")
 	if bank_account:
 		bank_row.update(bank_account)
-		bank_row.exchange_rate = get_exchange_rate(bank_account["account"], 
+		bank_row.exchange_rate = get_exchange_rate(bank_account["account"],
 			bank_account["account_currency"], ref_doc.company)
-			
+
 	bank_row.cost_center = cost_center
-	
+
 	if bank_row.account_currency == args.get("party_account_currency"):
 		bank_row.set(args.get("amount_field_bank"), args.get("amount"))
 	else:
@@ -630,7 +637,8 @@
 			jv.multi_currency = 1
 
 	jv.set_amounts_in_company_currency()
-	
+	jv.set_total_debit_credit()
+
 	return jv.as_dict()
 
 @frappe.whitelist()
@@ -646,24 +654,27 @@
 	return frappe.db.sql("""select jv.name, jv.posting_date, jv.user_remark
 		from `tabJournal Entry` jv, `tabJournal Entry Account` jv_detail
 		where jv_detail.parent = jv.name and jv_detail.account = %s and ifnull(jv_detail.party, '') = %s
-		and ifnull(jv_detail.reference_type, '') = ''
-		and jv.docstatus = 1 and jv.{0} like %s order by jv.name desc limit %s, %s""".format(searchfield),
+		and (jv_detail.reference_type is null or jv_detail.reference_type = '')
+		and jv.docstatus = 1 and jv.`{0}` like %s order by jv.name desc limit %s, %s""".format(frappe.db.escape(searchfield)),
 		(filters.get("account"), cstr(filters.get("party")), "%{0}%".format(txt), start, page_len))
 
 @frappe.whitelist()
 def get_outstanding(args):
 	if not frappe.has_permission("Account"):
 		frappe.msgprint(_("No Permission"), raise_exception=1)
-	args = eval(args)
+
+	if isinstance(args, basestring):
+		args = json.loads(args)
+
 	company_currency = get_company_currency(args.get("company"))
 
 	if args.get("doctype") == "Journal Entry":
 		condition = " and party=%(party)s" if args.get("party") else ""
 
 		against_jv_amount = frappe.db.sql("""
-			select sum(ifnull(debit_in_account_currency, 0)) - sum(ifnull(credit_in_account_currency, 0))
+			select sum(debit_in_account_currency) - sum(credit_in_account_currency)
 			from `tabJournal Entry Account` where parent=%(docname)s and account=%(account)s {0}
-			and ifnull(reference_type, '')=''""".format(condition), args)
+			and (reference_type is null or reference_type = '')""".format(condition), args)
 
 		against_jv_amount = flt(against_jv_amount[0][0]) if against_jv_amount else 0
 		amount_field = "credit_in_account_currency" if against_jv_amount > 0 else "debit_in_account_currency"
diff --git a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
index f2c1575..f9f3582 100644
--- a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
+++ b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
@@ -19,6 +19,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Account", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "account", 
    "oldfieldtype": "Link", 
@@ -45,6 +46,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Account Type", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -67,6 +69,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Account Balance", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "balance", 
    "oldfieldtype": "Data", 
@@ -93,6 +96,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Cost Center", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "cost_center", 
    "oldfieldtype": "Link", 
@@ -118,6 +122,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -139,6 +144,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Party Type", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "DocType", 
    "permlevel": 0, 
@@ -161,6 +167,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Party", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "party_type", 
    "permlevel": 0, 
@@ -183,6 +190,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Party Balance", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "account_currency", 
    "permlevel": 0, 
@@ -208,6 +216,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -230,6 +239,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Account Currency", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Currency", 
    "permlevel": 0, 
@@ -252,6 +262,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -274,6 +285,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Exchange Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "6", 
@@ -296,6 +308,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -317,6 +330,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Debit in Account Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "account_currency", 
    "permlevel": 0, 
@@ -340,6 +354,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Debit in Company Currency", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "debit", 
    "oldfieldtype": "Currency", 
@@ -364,6 +379,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -385,6 +401,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Credit in Account Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "account_currency", 
    "permlevel": 0, 
@@ -408,6 +425,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Credit in Company Currency", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "credit", 
    "oldfieldtype": "Currency", 
@@ -433,6 +451,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reference", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -454,6 +473,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reference Type", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nSales Invoice\nPurchase Invoice\nJournal Entry\nSales Order\nPurchase Order\nExpense Claim", 
    "permlevel": 0, 
@@ -477,6 +497,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Reference Name", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "reference_type", 
    "permlevel": 0, 
@@ -499,6 +520,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -520,6 +542,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Advance", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "is_advance", 
    "oldfieldtype": "Select", 
@@ -544,6 +567,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Against Account", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "against_account", 
    "oldfieldtype": "Text", 
@@ -565,7 +589,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-20 12:10:22.203395", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:48.961988", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Journal Entry Account", 
diff --git a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.json b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.json
index 2b3bfc9..6befedc 100644
--- a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.json
+++ b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Mode of Payment", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "mode_of_payment", 
    "oldfieldtype": "Data", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Accounts", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Mode of Payment Account", 
    "permlevel": 0, 
@@ -65,7 +67,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:57.318104", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:50.335559", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Mode of Payment", 
diff --git a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py
index e827e48..36d54b6 100644
--- a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py
+++ b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py
@@ -5,6 +5,24 @@
 import frappe
 
 from frappe.model.document import Document
+from frappe import _
 
 class ModeofPayment(Document):
-	pass
+	def validate(self):
+		self.validate_accounts()
+		self.validate_repeating_companies()
+	
+	def validate_repeating_companies(self):
+		"""Error when Same Company is entered multiple times in accounts"""
+		accounts_list = []
+		for entry in self.accounts:
+			accounts_list.append(entry.company)
+
+		if len(accounts_list)!= len(set(accounts_list)):
+			frappe.throw(_("Same Company is entered more than once"))
+
+	def validate_accounts(self):
+		for entry in self.accounts:
+			"""Error when Company of Ledger account doesn't match with Company Selected"""
+			if frappe.db.get_value("Account", entry.default_account, "company") != entry.company:
+				frappe.throw(_("Account does not match with Company"))
diff --git a/erpnext/accounts/doctype/mode_of_payment_account/mode_of_payment_account.json b/erpnext/accounts/doctype/mode_of_payment_account/mode_of_payment_account.json
index 9bb7f36..9cd1e7c 100644
--- a/erpnext/accounts/doctype/mode_of_payment_account/mode_of_payment_account.json
+++ b/erpnext/accounts/doctype/mode_of_payment_account/mode_of_payment_account.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Default Account", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Account", 
    "permlevel": 0, 
@@ -63,7 +65,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:57.388194", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:50.367895", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Mode of Payment Account", 
diff --git a/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.json b/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.json
index 080864a..d7d6710 100644
--- a/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.json
+++ b/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Distribution Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "distribution_id", 
    "oldfieldtype": "Data", 
@@ -44,6 +45,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -68,6 +70,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Monthly Distribution Percentages", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "budget_distribution_details", 
    "oldfieldtype": "Table", 
@@ -91,7 +94,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:57.594541", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:50.431735", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Monthly Distribution", 
diff --git a/erpnext/accounts/doctype/monthly_distribution_percentage/monthly_distribution_percentage.json b/erpnext/accounts/doctype/monthly_distribution_percentage/monthly_distribution_percentage.json
index ba534ed..11f7eb8 100644
--- a/erpnext/accounts/doctype/monthly_distribution_percentage/monthly_distribution_percentage.json
+++ b/erpnext/accounts/doctype/monthly_distribution_percentage/monthly_distribution_percentage.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Month", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "month", 
    "oldfieldtype": "Data", 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Percentage Allocation", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "percentage_allocation", 
    "oldfieldtype": "Currency", 
@@ -63,7 +65,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:57.670950", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:50.468982", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Monthly Distribution Percentage", 
diff --git a/erpnext/accounts/doctype/party_account/party_account.json b/erpnext/accounts/doctype/party_account/party_account.json
index f32f5cd..4527531 100644
--- a/erpnext/accounts/doctype/party_account/party_account.json
+++ b/erpnext/accounts/doctype/party_account/party_account.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -41,6 +42,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -63,6 +65,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Account", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Account", 
    "permlevel": 0, 
@@ -82,7 +85,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:59.582533", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:51.450360", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Party Account", 
diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
index f9d7312..8354556 100644
--- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
+++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
@@ -33,7 +33,7 @@
 				t1.name = t2.parent and t1.docstatus = 1 and t2.docstatus = 1
 				and t2.party_type = %(party_type)s and t2.party = %(party)s
 				and t2.account = %(account)s and {dr_or_cr} > 0
-				and ifnull(t2.reference_type, '') in ('', 'Sales Order', 'Purchase Order')
+				and (t2.reference_type is null or t2.reference_type in ('', 'Sales Order', 'Purchase Order'))
 				{cond}
 				and (CASE
 					WHEN t1.voucher_type in ('Debit Note', 'Credit Note')
diff --git a/erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.json b/erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.json
index f017349..5659f1f 100644
--- a/erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.json
+++ b/erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Invoice Type", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Sales Invoice\nPurchase Invoice\nJournal Entry", 
    "permlevel": 0, 
@@ -41,6 +42,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Invoice Number", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "", 
    "permlevel": 0, 
@@ -63,6 +65,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Invoice Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -84,6 +87,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -105,6 +109,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -126,6 +131,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Outstanding Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -144,7 +150,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-16 06:14:07.460813", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:51.516537", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Payment Reconciliation Invoice", 
diff --git a/erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.json b/erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.json
index 801dd9b..f9b6039 100644
--- a/erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.json
+++ b/erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Journal Entry", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Journal Entry", 
    "permlevel": 0, 
@@ -41,6 +42,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Posting Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -62,6 +64,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -83,6 +86,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Advance", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -104,6 +108,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Voucher Detail Number", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -125,6 +130,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -146,6 +152,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Invoice Number", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "", 
    "permlevel": 0, 
@@ -168,6 +175,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Allocated amount", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -190,6 +198,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -211,6 +220,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Remark", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -229,7 +239,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:59.835936", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:51.563989", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Payment Reconciliation Payment", 
diff --git a/erpnext/accounts/doctype/payment_tool/payment_tool.py b/erpnext/accounts/doctype/payment_tool/payment_tool.py
index b4e5f89..19527d3 100644
--- a/erpnext/accounts/doctype/payment_tool/payment_tool.py
+++ b/erpnext/accounts/doctype/payment_tool/payment_tool.py
@@ -8,6 +8,7 @@
 from frappe.model.document import Document
 import json
 from erpnext.accounts.utils import get_account_currency
+from erpnext.accounts.doctype.journal_entry.journal_entry import get_exchange_rate
 
 class PaymentTool(Document):
 	def make_journal_entry(self):
@@ -19,7 +20,15 @@
 		jv.company = self.company
 		jv.cheque_no = self.reference_no
 		jv.cheque_date = self.reference_date
-
+		
+		party_account_currency, party_account_type = frappe.db.get_value("Account", self.party_account, 
+			["account_currency", "account_type"])
+		
+		bank_account_currency, bank_account_type = None, None
+		if self.payment_account:
+			bank_account_currency, bank_account_type = frappe.db.get_value("Account", self.payment_account, 
+				["account_currency", "account_type"])
+		
 		if not self.total_payment_amount:
 			frappe.throw(_("Please enter Payment Amount in atleast one row"))
 
@@ -27,27 +36,56 @@
 			if not frappe.db.get_value(v.against_voucher_type, {"name": v.against_voucher_no}):
 				frappe.throw(_("Row {0}: {1} is not a valid {2}").format(v.idx, v.against_voucher_no,
 					v.against_voucher_type))
-
+			
 			if v.payment_amount:
+				exchange_rate = get_exchange_rate(self.party_account, party_account_currency,
+					self.company, v.against_voucher_type, v.against_voucher_no)
+				
 				d1 = jv.append("accounts")
 				d1.account = self.party_account
 				d1.party_type = self.party_type
 				d1.party = self.party
+				d1.account_currency = party_account_currency
+				d1.account_type = party_account_type
 				d1.balance = get_balance_on(self.party_account)
+				d1.party_balance = get_balance_on(party=self.party, party_type=self.party_type)
+				d1.exchange_rate = exchange_rate
 				d1.set("debit_in_account_currency" if self.received_or_paid=="Paid" \
 					else "credit_in_account_currency", flt(v.payment_amount))
-				d1.set("reference_type", v.against_voucher_type)
-				d1.set("reference_name", v.against_voucher_no)
-				d1.set('is_advance', 'Yes' if v.against_voucher_type in ['Sales Order', 'Purchase Order'] else 'No')
-				total_payment_amount = flt(total_payment_amount) + \
-					flt(d1.debit_in_account_currency) - flt(d1.credit_in_account_currency)
+				d1.reference_type = v.against_voucher_type
+				d1.reference_name = v.against_voucher_no
+				d1.is_advance = 'Yes' \
+					if v.against_voucher_type in ['Sales Order', 'Purchase Order'] else 'No'
+					
+				amount = flt(d1.debit_in_account_currency) - flt(d1.credit_in_account_currency)
+				if bank_account_currency == party_account_currency:
+					total_payment_amount += amount
+				else:
+					total_payment_amount += amount*exchange_rate
 
 		d2 = jv.append("accounts")
-		d2.account = self.payment_account
-		d2.set('debit_in_account_currency' if total_payment_amount < 0 \
-			else 'credit_in_account_currency', abs(total_payment_amount))
 		if self.payment_account:
-			d2.balance = get_balance_on(self.payment_account)
+			bank_account_currency, bank_account_type = frappe.db.get_value("Account", self.payment_account, 
+				["account_currency", "account_type"])
+				
+			d2.account = self.payment_account
+			d2.account_currency = bank_account_currency
+			d2.account_type = bank_account_type
+			d2.exchange_rate = get_exchange_rate(self.payment_account, self.company)
+			d2.account_balance = get_balance_on(self.payment_account)
+		
+		amount_field_bank = 'debit_in_account_currency' if total_payment_amount < 0 \
+			else 'credit_in_account_currency'
+		
+		d2.set(amount_field_bank, abs(total_payment_amount))
+		
+		company_currency = frappe.db.get_value("Company", self.company, "default_currency")
+		if party_account_currency != company_currency or \
+			(bank_account_currency and bank_account_currency != company_currency):
+				jv.multi_currency = 1
+			
+		jv.set_amounts_in_company_currency()
+		jv.set_total_debit_credit()
 
 		return jv.as_dict()
 
@@ -85,8 +123,8 @@
 	orders = frappe.db.sql("""
 		select
 			name as voucher_no,
-			ifnull({ref_field}, 0) as invoice_amount,
-			(ifnull({ref_field}, 0) - ifnull(advance_paid, 0)) as outstanding_amount,
+			{ref_field} as invoice_amount,
+			({ref_field} - advance_paid) as outstanding_amount,
 			transaction_date as posting_date
 		from
 			`tab{voucher_type}`
@@ -94,8 +132,8 @@
 			{party_type} = %s
 			and docstatus = 1
 			and ifnull(status, "") != "Stopped"
-			and ifnull({ref_field}, 0) > ifnull(advance_paid, 0)
-			and abs(100 - ifnull(per_billed, 0)) > 0.01
+			and {ref_field} > advance_paid
+			and abs(100 - per_billed) > 0.01
 		""".format(**{
 			"ref_field": ref_field,
 			"voucher_type": voucher_type,
@@ -116,7 +154,7 @@
 	ref_field = "base_grand_total" if party_account_currency == company_currency else "grand_total"
 
 	if against_voucher_type in ["Sales Order", "Purchase Order"]:
-		select_cond = "{0} as total_amount, ifnull({0}, 0) - ifnull(advance_paid, 0) as outstanding_amount"\
+		select_cond = "{0} as total_amount, {0} - advance_paid as outstanding_amount"\
 			.format(ref_field)
 	elif against_voucher_type in ["Sales Invoice", "Purchase Invoice"]:
 		select_cond = "{0} as total_amount, outstanding_amount".format(ref_field)
@@ -125,6 +163,6 @@
 		select_cond = "{0} as total_amount".format(ref_field)
 
 	details = frappe.db.sql("""select {0} from `tab{1}` where name = %s"""
-		.format(select_cond, against_voucher_type), against_voucher_no, as_dict=1)
+		.format(select_cond, frappe.db.escape(against_voucher_type)), against_voucher_no, as_dict=1)
 
 	return details[0] if details else {}
diff --git a/erpnext/accounts/doctype/payment_tool_detail/payment_tool_detail.json b/erpnext/accounts/doctype/payment_tool_detail/payment_tool_detail.json
index 8fba291..765aa93 100644
--- a/erpnext/accounts/doctype/payment_tool_detail/payment_tool_detail.json
+++ b/erpnext/accounts/doctype/payment_tool_detail/payment_tool_detail.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Against Voucher Type", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "DocType", 
    "permlevel": 0, 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Against Voucher No", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "against_voucher_type", 
    "permlevel": 0, 
@@ -64,6 +66,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -86,6 +89,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Total Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "party_account_currency", 
    "permlevel": 0, 
@@ -108,6 +112,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Outstanding Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "party_account_currency", 
    "permlevel": 0, 
@@ -130,6 +135,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Payment Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "party_account_currency", 
    "permlevel": 0, 
@@ -149,7 +155,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:59.950506", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:51.626386", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Payment Tool Detail", 
diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.js b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.js
index 51d8117..364b78c 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.js
+++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.js
@@ -10,12 +10,12 @@
 
 // ***************** Get Account Head *****************
 cur_frm.fields_dict['closing_account_head'].get_query = function(doc, cdt, cdn) {
-	return{
-		filters:{
-			"company": doc.company,
-			"root_type": "Liability",
-			"freeze_account": "No",
-			"is_group": 0
-		}
+	return {
+		filters: [
+			['Account', 'company', '=', doc.company],
+			['Account', 'is_group', '=', '0'],
+			['Account', 'freeze_account', '=', 'No'],
+			['Account', 'root_type', 'in', 'Liability, Equity']
+		]
 	}
 }
diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.json b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.json
index 2295956..04a9f94 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.json
+++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.json
@@ -18,6 +18,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -41,6 +42,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Transaction Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "transaction_date", 
    "oldfieldtype": "Date", 
@@ -64,6 +66,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Posting Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "posting_date", 
    "oldfieldtype": "Date", 
@@ -87,6 +90,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Closing Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -111,6 +115,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Data", 
@@ -135,6 +140,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Select", 
@@ -158,6 +164,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -181,6 +188,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Closing Account Head", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "closing_account_head", 
    "oldfieldtype": "Link", 
@@ -205,6 +213,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Remarks", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "remarks", 
    "oldfieldtype": "Small Text", 
@@ -227,7 +236,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-21 12:40:58.278256", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:51.671436", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Period Closing Voucher", 
diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
index aba43a6..4558879 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
+++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
@@ -22,21 +22,21 @@
 
 	def validate_account_head(self):
 		closing_account_type = frappe.db.get_value("Account", self.closing_account_head, "root_type")
-		
+
 		if closing_account_type != "Liability":
 			frappe.throw(_("Closing Account {0} must be of type 'Liability'")
 				.format(self.closing_account_head))
 
 		account_currency = get_account_currency(self.closing_account_head)
-		company_currency = frappe.db.get_value("Company", self.company, "default_currency")		
+		company_currency = frappe.db.get_value("Company", self.company, "default_currency")
 		if account_currency != company_currency:
 			frappe.throw(_("Currency of the Closing Account must be {0}").format(company_currency))
 
 	def validate_posting_date(self):
 		from erpnext.accounts.utils import get_fiscal_year, validate_fiscal_year
-		
+
 		validate_fiscal_year(self.posting_date, self.fiscal_year, label=_("Posting Date"), doc=self)
-		
+
 		self.year_start_date = get_fiscal_year(self.posting_date, self.fiscal_year)[1]
 
 		pce = frappe.db.sql("""select name from `tabPeriod Closing Voucher`
@@ -50,7 +50,7 @@
 		gl_entries = []
 		net_pl_balance = 0
 		pl_accounts = self.get_pl_balances()
-		
+
 		for acc in pl_accounts:
 			if flt(acc.balance_in_company_currency):
 				gl_entries.append(self.get_gl_dict({
@@ -67,7 +67,7 @@
 				}))
 
 				net_pl_balance += flt(acc.balance_in_company_currency)
-		
+
 		if net_pl_balance:
 			gl_entries.append(self.get_gl_dict({
 				"account": self.closing_account_head,
@@ -76,20 +76,20 @@
 				"credit_in_account_currency": abs(net_pl_balance) if net_pl_balance < 0 else 0,
 				"credit": abs(net_pl_balance) if net_pl_balance < 0 else 0
 			}))
-		
+
 		from erpnext.accounts.general_ledger import make_gl_entries
 		make_gl_entries(gl_entries)
 
 	def get_pl_balances(self):
 		"""Get balance for pl accounts"""
 		return frappe.db.sql("""
-			select 
-				t1.account, t2.account_currency,  				sum(ifnull(t1.debit_in_account_currency,0))-sum(ifnull(t1.credit_in_account_currency,0)) 
-					as balance_in_account_currency,
-				sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) as balance_in_company_currency
+			select
+				t1.account, t2.account_currency,
+				sum(t1.debit_in_account_currency) - sum(t1.credit_in_account_currency) as balance_in_account_currency,
+				sum(t1.debit) - sum(t1.credit) as balance_in_company_currency
 			from `tabGL Entry` t1, `tabAccount` t2
-			where t1.account = t2.name and ifnull(t2.report_type, '') = 'Profit and Loss'
+			where t1.account = t2.name and t2.report_type = 'Profit and Loss'
 			and t2.docstatus < 2 and t2.company = %s
 			and t1.posting_date between %s and %s
 			group by t1.account
-		""", (self.company, self.get("year_start_date"), self.posting_date), as_dict=1)
\ No newline at end of file
+		""", (self.company, self.get("year_start_date"), self.posting_date), as_dict=1)
diff --git a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
index db4dad4..1fdf002 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
+++ b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
@@ -12,60 +12,60 @@
 class TestPeriodClosingVoucher(unittest.TestCase):
 	def test_closing_entry(self):
 		year_start_date = get_fiscal_year(today())[1]
-		
-		make_journal_entry("_Test Bank - _TC", "Sales - _TC", 400, 
+
+		make_journal_entry("_Test Bank - _TC", "Sales - _TC", 400,
 			"_Test Cost Center - _TC", submit=True)
-		
-		make_journal_entry("_Test Account Cost for Goods Sold - _TC", 
+
+		make_journal_entry("_Test Account Cost for Goods Sold - _TC",
 			"_Test Bank - _TC", 600, "_Test Cost Center - _TC", submit=True)
-			
+
 		random_expense_account = frappe.db.sql("""
-			select t1.account, 
-				sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) as balance,
-				sum(ifnull(t1.debit_in_account_currency,0))-sum(ifnull(t1.credit_in_account_currency,0)) \
+			select t1.account,
+				sum(t1.debit) - sum(t1.credit) as balance,
+				sum(t1.debit_in_account_currency) - sum(t1.credit_in_account_currency) \
 					as balance_in_account_currency
 			from `tabGL Entry` t1, `tabAccount` t2
-			where t1.account = t2.name and ifnull(t2.root_type, '') = 'Expense'
+			where t1.account = t2.name and t2.root_type = 'Expense'
 				and t2.docstatus < 2 and t2.company = '_Test Company'
 				and t1.posting_date between %s and %s
 			group by t1.account
-			having sum(ifnull(t1.debit,0)) > sum(ifnull(t1.credit,0))
+			having sum(t1.debit) > sum(t1.credit)
 			limit 1""", (year_start_date, today()), as_dict=True)
-			
-		profit_or_loss = frappe.db.sql("""select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) as balance
+
+		profit_or_loss = frappe.db.sql("""select sum(t1.debit) - sum(t1.credit) as balance
 			from `tabGL Entry` t1, `tabAccount` t2
-			where t1.account = t2.name and ifnull(t2.report_type, '') = 'Profit and Loss'
+			where t1.account = t2.name and t2.report_type = 'Profit and Loss'
 			and t2.docstatus < 2 and t2.company = '_Test Company'
 			and t1.posting_date between %s and %s""", (year_start_date, today()))
-			
+
 		profit_or_loss = flt(profit_or_loss[0][0]) if profit_or_loss else 0
-		
+
 		pcv = self.make_period_closing_voucher()
-		
+
 		# Check value for closing account
-		gle_amount_for_closing_account = frappe.db.sql("""select ifnull(debit, 0) - ifnull(credit, 0)
+		gle_amount_for_closing_account = frappe.db.sql("""select debit - credit
 			from `tabGL Entry` where voucher_type='Period Closing Voucher' and voucher_no=%s
 			and account = '_Test Account Reserves and Surplus - _TC'""", pcv.name)
-			
+
 		gle_amount_for_closing_account = flt(gle_amount_for_closing_account[0][0]) \
 			if gle_amount_for_closing_account else 0
 
 		self.assertEqual(gle_amount_for_closing_account, profit_or_loss)
-		
+
 		if random_expense_account:
 			# Check posted value for teh above random_expense_account
 			gle_for_random_expense_account = frappe.db.sql("""
-				select ifnull(debit, 0) - ifnull(credit, 0) as amount,
-					ifnull(debit_in_account_currency, 0) - ifnull(credit_in_account_currency, 0) 
+				select debit - credit as amount,
+					debit_in_account_currency - credit_in_account_currency
 						as amount_in_account_currency
-				from `tabGL Entry` 
-				where voucher_type='Period Closing Voucher' and voucher_no=%s and account =%s""", 
+				from `tabGL Entry`
+				where voucher_type='Period Closing Voucher' and voucher_no=%s and account =%s""",
 				(pcv.name, random_expense_account[0].account), as_dict=True)
-			
+
 			self.assertEqual(gle_for_random_expense_account[0].amount, -1*random_expense_account[0].balance)
-			self.assertEqual(gle_for_random_expense_account[0].amount_in_account_currency, 
+			self.assertEqual(gle_for_random_expense_account[0].amount_in_account_currency,
 				-1*random_expense_account[0].balance_in_account_currency)
-		
+
 	def make_period_closing_voucher(self):
 		pcv = frappe.get_doc({
 			"doctype": "Period Closing Voucher",
@@ -77,7 +77,7 @@
 		})
 		pcv.insert()
 		pcv.submit()
-		
+
 		return pcv
 
 
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.json b/erpnext/accounts/doctype/pos_profile/pos_profile.json
index 02533ee..6d395af 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.json
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Applicable for User", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "user", 
    "oldfieldtype": "Link", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "naming_series", 
    "oldfieldtype": "Select", 
@@ -67,6 +69,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "warehouse", 
    "oldfieldtype": "Link", 
@@ -93,6 +96,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Update Stock", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -113,6 +117,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -135,6 +140,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer_account", 
    "oldfieldtype": "Link", 
@@ -159,6 +165,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -183,6 +190,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "currency", 
    "oldfieldtype": "Select", 
@@ -207,6 +215,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Mode of Payment", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Mode of Payment", 
    "permlevel": 0, 
@@ -229,6 +238,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -251,6 +261,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Print Format", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Print Format", 
    "permlevel": 0, 
@@ -274,6 +285,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Letter Head", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "letter_head", 
    "oldfieldtype": "Select", 
@@ -298,6 +310,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Print Heading", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "select_print_heading", 
    "oldfieldtype": "Select", 
@@ -322,6 +335,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms and Conditions", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "tc_name", 
    "oldfieldtype": "Link", 
@@ -345,6 +359,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -368,6 +383,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Territory", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "territory", 
    "oldfieldtype": "Link", 
@@ -392,6 +408,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "price_list_name", 
    "oldfieldtype": "Select", 
@@ -415,6 +432,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -437,6 +455,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Write Off Account", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Account", 
    "permlevel": 0, 
@@ -460,6 +479,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Write Off Cost Center", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Cost Center", 
    "permlevel": 0, 
@@ -483,6 +503,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "charge", 
    "oldfieldtype": "Link", 
@@ -506,6 +527,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -528,6 +550,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Cash/Bank Account", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "cash_bank_account", 
    "oldfieldtype": "Link", 
@@ -552,6 +575,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Income Account", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "income_account", 
    "oldfieldtype": "Link", 
@@ -577,6 +601,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Expense Account", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Account", 
    "permlevel": 0, 
@@ -599,6 +624,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Cost Center", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "cost_center", 
    "oldfieldtype": "Link", 
@@ -622,7 +648,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:00.196535", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:51.741253", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "POS Profile", 
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.json b/erpnext/accounts/doctype/pricing_rule/pricing_rule.json
index c0b7bb4..a9c7ce7 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.json
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -41,6 +42,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Title", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -63,7 +65,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Apply On",  
+   "label": "Apply On", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nItem Code\nItem Group\nBrand", 
    "permlevel": 0, 
@@ -87,6 +90,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Item", 
    "permlevel": 0, 
@@ -110,6 +114,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Brand", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Brand", 
    "permlevel": 0, 
@@ -133,6 +138,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Group", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Item Group", 
    "permlevel": 0, 
@@ -154,6 +160,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -176,7 +183,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Priority",  
+   "label": "Priority", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20", 
    "permlevel": 0, 
@@ -199,6 +207,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Disable", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -219,6 +228,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -241,6 +251,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Selling", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -262,6 +273,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Buying", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -282,6 +294,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -304,7 +317,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Applicable For",  
+   "label": "Applicable For", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nCustomer\nCustomer Group\nTerritory\nSales Partner\nCampaign\nSupplier\nSupplier Type", 
    "permlevel": 0, 
@@ -328,6 +342,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Customer", 
    "permlevel": 0, 
@@ -351,6 +366,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Group", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Customer Group", 
    "permlevel": 0, 
@@ -374,6 +390,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Territory", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Territory", 
    "permlevel": 0, 
@@ -397,6 +414,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Partner", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Sales Partner", 
    "permlevel": 0, 
@@ -420,6 +438,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Campaign", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Campaign", 
    "permlevel": 0, 
@@ -443,6 +462,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Supplier", 
    "permlevel": 0, 
@@ -466,6 +486,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier Type", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Supplier Type", 
    "permlevel": 0, 
@@ -487,6 +508,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -509,6 +531,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Min Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -529,6 +552,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -551,6 +575,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Max Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -571,6 +596,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -594,6 +620,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Valid From", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -615,6 +642,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Valid Upto", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -635,6 +663,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -656,6 +685,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -678,6 +708,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -699,7 +730,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Price or Discount",  
+   "label": "Price or Discount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nPrice\nDiscount Percentage", 
    "permlevel": 0, 
@@ -721,6 +753,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -743,6 +776,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -765,6 +799,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Discount on Price List Rate (%)", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -787,6 +822,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "For Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Price List", 
    "permlevel": 0, 
@@ -809,6 +845,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Simple", 
    "permlevel": 0, 
@@ -831,6 +868,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Pricing Rule Help", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -851,7 +889,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:00.632196", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:51.958974", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Pricing Rule", 
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
index 5209e8e..d835e76 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
@@ -179,7 +179,7 @@
 			if parent_groups:
 				if allow_blank: parent_groups.append('')
 				condition = " ifnull("+field+", '') in ('" + \
-					"', '".join([d.replace("'", "\\'").replace('"', '\\"').replace("%", "%%") for d in parent_groups])+"')"
+					"', '".join([frappe.db.escape(d) for d in parent_groups])+"')"
 		return condition
 
 
@@ -206,8 +206,8 @@
 
 	return frappe.db.sql("""select * from `tabPricing Rule`
 		where (item_code=%(item_code)s {item_group_condition} or brand=%(brand)s)
-			and docstatus < 2 and ifnull(disable, 0) = 0
-			and ifnull({transaction_type}, 0) = 1 {conditions}
+			and docstatus < 2 and disable = 0
+			and {transaction_type} = 1 {conditions}
 		order by priority desc, name desc""".format(
 			item_group_condition=item_group_condition,
 			transaction_type=args.transaction_type, conditions=conditions), args, as_dict=1)
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
index 5e01151..8f8abc1 100755
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Title", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -41,7 +42,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Series",  
+   "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "naming_series", 
    "oldfieldtype": "Select", 
@@ -66,6 +68,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "supplier", 
    "oldfieldtype": "Link", 
@@ -91,6 +94,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "supplier_name", 
    "oldfieldtype": "Data", 
@@ -114,6 +118,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -135,6 +140,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -156,6 +162,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Mobile No", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -177,6 +184,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Email", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -197,6 +205,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -221,6 +230,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "posting_date", 
    "oldfieldtype": "Date", 
@@ -245,6 +255,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Supplier Invoice No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "bill_no", 
    "oldfieldtype": "Data", 
@@ -268,6 +279,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Supplier Invoice Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "bill_date", 
    "oldfieldtype": "Date", 
@@ -291,6 +303,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Link", 
@@ -315,6 +328,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -339,6 +353,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Return", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -362,6 +377,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Return Against Purchase Invoice", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Purchase Invoice", 
    "permlevel": 0, 
@@ -385,6 +401,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Currency and Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-tag", 
    "permlevel": 0, 
@@ -407,6 +424,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "currency", 
    "oldfieldtype": "Select", 
@@ -432,6 +450,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Exchange Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "conversion_rate", 
    "oldfieldtype": "Currency", 
@@ -455,6 +474,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -476,6 +496,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Price List", 
    "permlevel": 0, 
@@ -498,6 +519,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Currency", 
    "permlevel": 0, 
@@ -520,6 +542,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Exchange Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "9", 
@@ -542,6 +565,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Ignore Pricing Rule", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 1, 
    "print_hide": 1, 
@@ -563,6 +587,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-shopping-cart", 
@@ -586,6 +611,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Items", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "entries", 
    "oldfieldtype": "Table", 
@@ -609,6 +635,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -630,6 +657,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -654,6 +682,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "net_total", 
    "oldfieldtype": "Currency", 
@@ -677,6 +706,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -698,6 +728,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -721,6 +752,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Total", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "net_total_import", 
    "oldfieldtype": "Currency", 
@@ -745,6 +777,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-money", 
@@ -768,6 +801,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "purchase_other_charges", 
    "oldfieldtype": "Link", 
@@ -792,6 +826,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Purchase Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "purchase_tax_details", 
    "oldfieldtype": "Table", 
@@ -816,6 +851,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges Calculation", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "HTML", 
    "permlevel": 0, 
@@ -838,6 +874,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-money", 
@@ -861,6 +898,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges Added (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges_added", 
    "oldfieldtype": "Currency", 
@@ -885,6 +923,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges Deducted (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges_deducted", 
    "oldfieldtype": "Currency", 
@@ -909,6 +948,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Taxes and Charges (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "total_tax", 
    "oldfieldtype": "Currency", 
@@ -932,6 +972,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -954,6 +995,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges Added", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges_added_import", 
    "oldfieldtype": "Currency", 
@@ -978,6 +1020,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges Deducted", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges_deducted_import", 
    "oldfieldtype": "Currency", 
@@ -1002,6 +1045,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -1026,6 +1070,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1048,7 +1093,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Apply Additional Discount On",  
+   "label": "Apply Additional Discount On", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nGrand Total\nNet Total", 
    "permlevel": 0, 
@@ -1071,6 +1117,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1093,6 +1140,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -1116,6 +1164,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -1138,6 +1187,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1160,6 +1210,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Grand Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "grand_total", 
    "oldfieldtype": "Currency", 
@@ -1185,6 +1236,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "In Words (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "in_words", 
    "oldfieldtype": "Data", 
@@ -1207,6 +1259,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -1230,6 +1283,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Grand Total", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "grand_total_import", 
    "oldfieldtype": "Currency", 
@@ -1254,6 +1308,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "In Words", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "in_words_import", 
    "oldfieldtype": "Data", 
@@ -1277,6 +1332,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Advance", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "total_advance", 
    "oldfieldtype": "Currency", 
@@ -1301,6 +1357,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Outstanding Amount", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "outstanding_amount", 
    "oldfieldtype": "Currency", 
@@ -1327,6 +1384,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Write Off", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1349,6 +1407,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Write Off Amount", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "currency", 
    "permlevel": 0, 
@@ -1371,6 +1430,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Write Off Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -1393,6 +1453,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1416,6 +1477,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Write Off Account", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Account", 
    "permlevel": 0, 
@@ -1439,6 +1501,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Write Off Cost Center", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Cost Center", 
    "permlevel": 0, 
@@ -1462,6 +1525,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Advance Payments", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-money", 
@@ -1485,6 +1549,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Get Advances Paid", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Button", 
    "options": "get_advances", 
@@ -1508,6 +1573,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Advances", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "advance_allocation_details", 
    "oldfieldtype": "Table", 
@@ -1533,6 +1599,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms and Conditions", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-legal", 
    "permlevel": 0, 
@@ -1555,6 +1622,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Terms and Conditions", 
    "permlevel": 0, 
@@ -1577,6 +1645,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms and Conditions1", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1599,6 +1668,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Details", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-bullhorn", 
    "permlevel": 0, 
@@ -1621,6 +1691,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier Address", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Address", 
    "permlevel": 0, 
@@ -1642,6 +1713,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1664,6 +1736,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Person", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Contact", 
    "permlevel": 0, 
@@ -1686,6 +1759,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Printing Settings", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1708,6 +1782,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Letter Head", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Letter Head", 
    "permlevel": 0, 
@@ -1731,6 +1806,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Print Heading", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "select_print_heading", 
    "oldfieldtype": "Link", 
@@ -1755,6 +1831,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "More Information", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-file-text", 
@@ -1779,6 +1856,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Credit To", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "credit_to", 
    "oldfieldtype": "Link", 
@@ -1803,6 +1881,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Party Account Currency", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Currency", 
    "permlevel": 0, 
@@ -1827,7 +1906,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
-   "label": "Is Opening",  
+   "label": "Is Opening", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_opening", 
    "oldfieldtype": "Select", 
@@ -1852,6 +1932,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Due Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "due_date", 
    "oldfieldtype": "Date", 
@@ -1875,6 +1956,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Against Expense Account", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "against_expense_account", 
    "oldfieldtype": "Small Text", 
@@ -1897,6 +1979,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1918,6 +2001,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Mode of Payment", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "mode_of_payment", 
    "oldfieldtype": "Select", 
@@ -1942,6 +2026,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -1966,6 +2051,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Remarks", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "remarks", 
    "oldfieldtype": "Text", 
@@ -1991,6 +2077,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Recurring Invoice", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-time", 
    "permlevel": 0, 
@@ -2015,6 +2102,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Recurring", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2037,7 +2125,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Recurring Type",  
+   "label": "Recurring Type", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Monthly\nQuarterly\nHalf-yearly\nYearly", 
    "permlevel": 0, 
@@ -2062,6 +2151,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "From Date", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2085,6 +2175,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "To Date", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2108,6 +2199,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Repeat on Day of Month", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2131,6 +2223,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "End Date", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2151,6 +2244,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2175,6 +2269,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Next Date", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2198,6 +2293,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Recurring Id", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2221,6 +2317,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Notification Email Address", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2243,6 +2340,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Recurring Print Format", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Print Format", 
    "permlevel": 0, 
@@ -2265,7 +2363,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-12 16:23:32.141069", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:52.962561", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Purchase Invoice", 
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 91b01d5..12934a1 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -106,7 +106,7 @@
 	def check_for_stopped_or_closed_status(self):
 		check_list = []
 		pc_obj = frappe.get_doc('Purchase Common')
-		
+
 		for d in self.get('items'):
 			if d.purchase_order and not d.purchase_order in check_list and not d.purchase_receipt:
 				check_list.append(d.purchase_order)
@@ -176,9 +176,10 @@
 					 throw(_("Purchse Order number required for Item {0}").format(d.item_code))
 
 	def pr_required(self):
+		stock_items = self.get_stock_items()
 		if frappe.db.get_value("Buying Settings", None, "pr_required") == 'Yes':
 			 for d in self.get('items'):
-				 if not d.purchase_receipt:
+				 if not d.purchase_receipt and d.item_code in stock_items:
 					 throw(_("Purchase Receipt number required for Item {0}").format(d.item_code))
 
 	def validate_write_off_account(self):
@@ -395,7 +396,7 @@
 
 	def on_cancel(self):
 		self.check_for_stopped_or_closed_status()
-		
+
 		if not self.is_return:
 			from erpnext.accounts.utils import remove_against_link_from_jv
 			remove_against_link_from_jv(self.doctype, self.name)
@@ -438,10 +439,10 @@
 					or tabAccount.account_type in ("Expense Account", "Fixed Asset", "Temporary"))
 				and tabAccount.is_group=0
 				and tabAccount.docstatus!=2
-				and tabAccount.company = '%(company)s'
-				and tabAccount.%(key)s LIKE '%(txt)s'
-				%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
-			'txt': "%%%s%%" % frappe.db.escape(txt), 'mcond':get_match_cond(doctype)})
+				and tabAccount.company = %(company)s
+				and tabAccount.{key} LIKE %(txt)s
+				{mcond}""".format( key=frappe.db.escape(searchfield), mcond=get_match_cond(doctype) ),
+				{ 'company': filters['company'], 'txt': "%%%s%%" % frappe.db.escape(txt) })
 
 @frappe.whitelist()
 def make_debit_note(source_name, target_doc=None):
diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index 10e20af..d2de964 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -221,7 +221,7 @@
 		test_recurring_document(self, test_records)
 
 	def test_total_purchase_cost_for_project(self):
-		existing_purchase_cost = frappe.db.sql("""select sum(ifnull(base_net_amount, 0))
+		existing_purchase_cost = frappe.db.sql("""select sum(base_net_amount)
 			from `tabPurchase Invoice Item` where project_name = '_Test Project' and docstatus=1""")
 		existing_purchase_cost = existing_purchase_cost and existing_purchase_cost[0][0] or 0
 
diff --git a/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.json b/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.json
index 024948d..34156f5 100644
--- a/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.json
+++ b/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Journal Entry", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "journal_voucher", 
    "oldfieldtype": "Link", 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Journal Entry Detail No", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "jv_detail_no", 
    "oldfieldtype": "Date", 
@@ -69,6 +71,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Remarks", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "remarks", 
    "oldfieldtype": "Small Text", 
@@ -93,6 +96,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -114,6 +118,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Advance Amount", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "advance_amount", 
    "oldfieldtype": "Currency", 
@@ -140,6 +145,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Allocated Amount", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "allocated_amount", 
    "oldfieldtype": "Currency", 
@@ -164,7 +170,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:03.538046", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:53.288895", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Purchase Invoice Advance", 
diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
index 9b8fee4..b856d89 100755
--- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
+++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
@@ -19,6 +19,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -42,6 +43,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -63,6 +65,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_name", 
    "oldfieldtype": "Data", 
@@ -86,6 +89,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -108,6 +112,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Text", 
@@ -133,6 +138,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -155,6 +161,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image View", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "image", 
    "permlevel": 0, 
@@ -178,6 +185,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Quantity and Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -199,6 +207,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "qty", 
    "oldfieldtype": "Currency", 
@@ -221,6 +230,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -242,6 +252,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "UOM", 
    "permlevel": 0, 
@@ -264,6 +275,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Conversion Factor", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -284,6 +296,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -305,6 +318,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -328,6 +342,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Discount on Price List Rate (%)", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -348,6 +363,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -369,6 +385,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Rate (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -390,6 +407,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -411,6 +429,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Rate ", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "import_rate", 
    "oldfieldtype": "Currency", 
@@ -435,6 +454,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "import_amount", 
    "oldfieldtype": "Currency", 
@@ -458,6 +478,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -479,6 +500,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rate (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "rate", 
    "oldfieldtype": "Currency", 
@@ -503,6 +525,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "amount", 
    "oldfieldtype": "Currency", 
@@ -527,6 +550,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Pricing Rule", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Pricing Rule", 
    "permlevel": 0, 
@@ -548,6 +572,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -570,6 +595,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -593,6 +619,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -615,6 +642,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -637,6 +665,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Rate (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -660,6 +689,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -683,6 +713,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Accounting", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -704,6 +735,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Expense Head", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "expense_head", 
    "oldfieldtype": "Link", 
@@ -729,6 +761,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -750,6 +783,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Project Name", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Project", 
    "permlevel": 0, 
@@ -773,6 +807,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Cost Center", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "cost_center", 
    "oldfieldtype": "Link", 
@@ -799,6 +834,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reference", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -820,6 +856,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Brand", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "brand", 
    "oldfieldtype": "Data", 
@@ -844,6 +881,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Item Group", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_group", 
    "oldfieldtype": "Link", 
@@ -869,6 +907,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Tax Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_tax_rate", 
    "oldfieldtype": "Small Text", 
@@ -892,6 +931,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Tax Amount", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -916,6 +956,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Purchase Order", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "purchase_order", 
    "oldfieldtype": "Link", 
@@ -939,6 +980,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -960,6 +1002,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Purchase Order Item", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "po_detail", 
    "oldfieldtype": "Data", 
@@ -983,6 +1026,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Purchase Receipt", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "purchase_receipt", 
    "oldfieldtype": "Link", 
@@ -1007,6 +1051,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Page Break", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -1028,6 +1073,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "PR Detail", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "pr_detail", 
    "oldfieldtype": "Data", 
@@ -1051,6 +1097,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Valuation Rate", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -1073,6 +1120,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Raw Materials Supplied Cost", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -1093,7 +1141,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-19 03:04:52.304768", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:53.343792", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Purchase Invoice Item", 
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.json b/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.json
index 0d52f40..2ce1ef7 100644
--- a/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.json
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.json
@@ -19,7 +19,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Consider Tax or Charge for",  
+   "label": "Consider Tax or Charge for", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "category", 
    "oldfieldtype": "Select", 
@@ -44,7 +45,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Add or Deduct",  
+   "label": "Add or Deduct", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "add_deduct_tax", 
    "oldfieldtype": "Select", 
@@ -68,7 +70,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Type",  
+   "label": "Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "charge_type", 
    "oldfieldtype": "Select", 
@@ -94,6 +97,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reference Row #", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "row_id", 
    "oldfieldtype": "Data", 
@@ -118,6 +122,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is this Tax included in Basic Rate?", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -139,6 +144,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -160,6 +166,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Account Head", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "account_head", 
    "oldfieldtype": "Link", 
@@ -185,6 +192,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Cost Center", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "cost_center", 
    "oldfieldtype": "Link", 
@@ -209,6 +217,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Small Text", 
@@ -233,6 +242,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -255,6 +265,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "rate", 
    "oldfieldtype": "Currency", 
@@ -277,6 +288,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -299,6 +311,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "tax_amount", 
    "oldfieldtype": "Currency", 
@@ -323,6 +336,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Tax Amount After Discount Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -346,6 +360,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "total", 
    "oldfieldtype": "Currency", 
@@ -369,6 +384,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -391,6 +407,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -414,6 +431,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -437,6 +455,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Tax Amount After Discount Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -460,6 +479,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Wise Tax Detail ", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_wise_tax_detail", 
    "oldfieldtype": "Small Text", 
@@ -483,6 +503,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Parenttype", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "parenttype", 
    "oldfieldtype": "Data", 
@@ -504,7 +525,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:06.372275", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:54.644704", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Purchase Taxes and Charges", 
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.json b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.json
index 6378a50..84e903c 100644
--- a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.json
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.json
@@ -21,6 +21,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Title", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "title", 
    "oldfieldtype": "Data", 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Default", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -65,6 +67,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Disabled", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -87,6 +90,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -109,6 +113,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -131,6 +136,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -153,6 +159,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Purchase Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "purchase_tax_details", 
    "oldfieldtype": "Table", 
@@ -176,7 +183,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:06.563868", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:54.729312", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Purchase Taxes and Charges Template", 
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py
index e81eec9..145766f 100644
--- a/erpnext/accounts/doctype/sales_invoice/pos.py
+++ b/erpnext/accounts/doctype/sales_invoice/pos.py
@@ -48,7 +48,7 @@
 		ON
 			(item_det.item_code=i.name or item_det.item_code=i.variant_of)
 		where
-			ifnull(i.has_variants, 0) = 0 and
+			i.has_variants = 0 and
 			{condition}
 		order by
 			{order_by}
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index a6a47d5..6705979 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-user", 
    "permlevel": 0, 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Title", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -66,6 +68,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "naming_series", 
    "oldfieldtype": "Select", 
@@ -90,6 +93,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer", 
    "oldfieldtype": "Link", 
@@ -115,6 +119,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer_name", 
    "oldfieldtype": "Data", 
@@ -138,6 +143,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -159,6 +165,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -180,6 +187,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Mobile No", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -201,6 +209,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Email", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -222,6 +231,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is POS", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_pos", 
    "oldfieldtype": "Check", 
@@ -246,6 +256,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Return", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -267,6 +278,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -290,6 +302,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "posting_date", 
    "oldfieldtype": "Date", 
@@ -313,6 +326,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Payment Due Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "due_date", 
    "oldfieldtype": "Date", 
@@ -336,6 +350,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -360,6 +375,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Link", 
@@ -385,6 +401,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Return Against Sales Invoice", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Sales Invoice", 
    "permlevel": 0, 
@@ -408,6 +425,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Shipping Address Name", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Address", 
    "permlevel": 0, 
@@ -431,6 +449,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Shipping Address", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -453,6 +472,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Currency and Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "", 
    "permlevel": 0, 
@@ -475,6 +495,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "currency", 
    "oldfieldtype": "Select", 
@@ -500,6 +521,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Exchange Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "conversion_rate", 
    "oldfieldtype": "Currency", 
@@ -523,6 +545,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -545,6 +568,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "price_list_name", 
    "oldfieldtype": "Select", 
@@ -569,6 +593,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Currency", 
    "permlevel": 0, 
@@ -592,6 +617,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Exchange Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "9", 
@@ -614,6 +640,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Ignore Pricing Rule", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 1, 
    "print_hide": 1, 
@@ -635,6 +662,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-shopping-cart", 
@@ -658,6 +686,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Update Stock", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "update_stock", 
    "oldfieldtype": "Check", 
@@ -681,6 +710,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Items", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "entries", 
    "oldfieldtype": "Table", 
@@ -705,6 +735,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Packing List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-suitcase", 
    "permlevel": 0, 
@@ -727,6 +758,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Packed Items", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Packed Item", 
    "permlevel": 0, 
@@ -749,6 +781,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Product Bundle Help", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -769,6 +802,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -790,6 +824,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -813,6 +848,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "net_total", 
    "oldfieldtype": "Currency", 
@@ -836,6 +872,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -857,6 +894,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -880,6 +918,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Total", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -902,6 +941,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-money", 
@@ -925,6 +965,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "charge", 
    "oldfieldtype": "Link", 
@@ -948,6 +989,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -969,6 +1011,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Shipping Rule", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Button", 
    "options": "Shipping Rule", 
@@ -991,6 +1034,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1012,6 +1056,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges", 
    "oldfieldtype": "Table", 
@@ -1036,6 +1081,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges Calculation", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "HTML", 
    "permlevel": 0, 
@@ -1057,6 +1103,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1078,6 +1125,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Taxes and Charges (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges_total", 
    "oldfieldtype": "Currency", 
@@ -1101,6 +1149,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1123,6 +1172,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -1146,6 +1196,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1169,6 +1220,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Apply Additional Discount On", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nGrand Total\nNet Total", 
    "permlevel": 0, 
@@ -1191,6 +1243,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1212,6 +1265,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -1234,6 +1288,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -1257,6 +1312,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-money", 
@@ -1280,6 +1336,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Grand Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "grand_total", 
    "oldfieldtype": "Currency", 
@@ -1304,6 +1361,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rounded Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "rounded_total", 
    "oldfieldtype": "Currency", 
@@ -1329,6 +1387,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "In Words (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "in_words", 
    "oldfieldtype": "Data", 
@@ -1351,6 +1410,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -1374,6 +1434,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Grand Total", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "grand_total_export", 
    "oldfieldtype": "Currency", 
@@ -1398,6 +1459,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rounded Total", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "rounded_total_export", 
    "oldfieldtype": "Currency", 
@@ -1422,6 +1484,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "In Words", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "in_words_export", 
    "oldfieldtype": "Data", 
@@ -1445,6 +1508,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Advance", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "total_advance", 
    "oldfieldtype": "Currency", 
@@ -1469,6 +1533,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Outstanding Amount", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "outstanding_amount", 
    "oldfieldtype": "Currency", 
@@ -1494,6 +1559,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Advance Payments", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-money", 
@@ -1517,6 +1583,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Get Advances Received", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Button", 
    "options": "get_advances", 
@@ -1540,6 +1607,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Advances", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "advance_adjustment_details", 
    "oldfieldtype": "Table", 
@@ -1566,6 +1634,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Payments", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-money", 
    "permlevel": 0, 
@@ -1588,6 +1657,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Mode of Payment", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "mode_of_payment", 
    "oldfieldtype": "Select", 
@@ -1613,6 +1683,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Cash/Bank Account", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "cash_bank_account", 
    "oldfieldtype": "Link", 
@@ -1637,6 +1708,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1660,6 +1732,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Paid Amount", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "paid_amount", 
    "oldfieldtype": "Currency", 
@@ -1684,6 +1757,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Paid Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -1709,6 +1783,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Write Off", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1732,6 +1807,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Write Off Amount", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "currency", 
    "permlevel": 0, 
@@ -1754,6 +1830,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Write Off Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -1778,6 +1855,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Write Off Outstanding Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -1799,6 +1877,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1822,6 +1901,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Write Off Account", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Account", 
    "permlevel": 0, 
@@ -1845,6 +1925,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Write Off Cost Center", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Cost Center", 
    "permlevel": 0, 
@@ -1868,6 +1949,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "", 
@@ -1891,6 +1973,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "tc_name", 
    "oldfieldtype": "Link", 
@@ -1915,6 +1998,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms and Conditions Details", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "terms", 
    "oldfieldtype": "Text Editor", 
@@ -1938,6 +2022,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Printing Settings", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1960,6 +2045,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Letter Head", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "letter_head", 
    "oldfieldtype": "Select", 
@@ -1983,6 +2069,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -2005,6 +2092,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Print Heading", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "select_print_heading", 
    "oldfieldtype": "Link", 
@@ -2030,6 +2118,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "More Information", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-bullhorn", 
    "permlevel": 0, 
@@ -2052,6 +2141,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Project Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "project_name", 
    "oldfieldtype": "Link", 
@@ -2077,6 +2167,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Territory", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Territory", 
    "permlevel": 0, 
@@ -2100,6 +2191,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer Group", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Customer Group", 
    "permlevel": 0, 
@@ -2121,6 +2213,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -2143,6 +2236,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Address", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Address", 
    "permlevel": 0, 
@@ -2165,6 +2259,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Person", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Contact", 
    "permlevel": 0, 
@@ -2188,6 +2283,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Campaign", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "campaign", 
    "oldfieldtype": "Link", 
@@ -2212,6 +2308,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Source", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "source", 
    "oldfieldtype": "Select", 
@@ -2236,6 +2333,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Accounting Details", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-file-text", 
@@ -2260,6 +2358,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Debit To", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "debit_to", 
    "oldfieldtype": "Link", 
@@ -2284,6 +2383,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Party Account Currency", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Currency", 
    "permlevel": 0, 
@@ -2309,6 +2409,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Is Opening Entry", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_opening", 
    "oldfieldtype": "Select", 
@@ -2333,6 +2434,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "C-Form Applicable", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "No\nYes", 
    "permlevel": 0, 
@@ -2355,6 +2457,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "C-Form No", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "C-Form", 
    "permlevel": 0, 
@@ -2376,6 +2479,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -2398,6 +2502,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Posting Time", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "posting_time", 
    "oldfieldtype": "Time", 
@@ -2421,6 +2526,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -2445,6 +2551,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Remarks", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "remarks", 
    "oldfieldtype": "Text", 
@@ -2469,6 +2576,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Commission", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-group", 
@@ -2492,6 +2600,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Sales Partner", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "sales_partner", 
    "oldfieldtype": "Link", 
@@ -2515,6 +2624,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -2538,6 +2648,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Commission Rate (%)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "commission_rate", 
    "oldfieldtype": "Currency", 
@@ -2561,6 +2672,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Commission", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "total_commission", 
    "oldfieldtype": "Currency", 
@@ -2586,6 +2698,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Team", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2607,6 +2720,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Team1", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "sales_team", 
    "oldfieldtype": "Table", 
@@ -2633,6 +2747,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Recurring", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-time", 
    "permlevel": 0, 
@@ -2654,6 +2769,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2678,6 +2794,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Recurring", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2701,6 +2818,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Recurring Type", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "\nMonthly\nQuarterly\nHalf-yearly\nYearly", 
    "permlevel": 0, 
@@ -2725,6 +2843,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "From Date", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -2748,6 +2867,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "To Date", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -2771,6 +2891,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Repeat on Day of Month", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2794,6 +2915,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "End Date", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2814,6 +2936,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2838,6 +2961,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Next Date", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2861,6 +2985,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Recurring Id", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2884,6 +3009,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Notification Email Address", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2906,6 +3032,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Recurring Print Format", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Print Format", 
    "permlevel": 0, 
@@ -2929,6 +3056,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Against Income Account", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "against_income_account", 
    "oldfieldtype": "Small Text", 
@@ -2951,7 +3079,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-26 12:12:40.616546", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:55.906783", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Sales Invoice", 
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 6abf1ba..4b33f10 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -155,7 +155,7 @@
 				'second_join_field': 'so_detail',
 				'overflow_type': 'delivery',
 				'extra_cond': """ and exists(select name from `tabSales Invoice`
-					where name=`tabSales Invoice Item`.parent and ifnull(update_stock, 0) = 1)"""
+					where name=`tabSales Invoice Item`.parent and update_stock = 1)"""
 			},
 			{
 				'source_dt': 'Sales Invoice Item',
@@ -359,8 +359,8 @@
 		"""check for does customer belong to same project as entered.."""
 		if self.project_name and self.customer:
 			res = frappe.db.sql("""select name from `tabProject`
-				where name = %s and (customer = %s or
-					ifnull(customer,'')='')""", (self.project_name, self.customer))
+				where name = %s and (customer = %s or customer is null or customer = '')""",
+				(self.project_name, self.customer))
 			if not res:
 				throw(_("Customer {0} does not belong to project {1}").format(self.customer,self.project_name))
 
@@ -379,6 +379,8 @@
 				msgprint(_("Item Code required at Row No {0}").format(d.idx), raise_exception=True)
 
 	def validate_warehouse(self):
+		super(SalesInvoice, self).validate_warehouse()
+		
 		for d in self.get('items'):
 			if not d.warehouse:
 				frappe.throw(_("Warehouse required at Row No {0}").format(d.idx))
@@ -434,7 +436,7 @@
 
 		if not warehouse:
 			global_pos_profile = frappe.db.sql("""select name, warehouse from `tabPOS Profile`
-				where ifnull(user,'') = '' and company = %s""", self.company)
+				where (user is null or user = '') and company = %s""", self.company)
 
 			if global_pos_profile:
 				warehouse = global_pos_profile[0][1]
diff --git a/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.json b/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.json
index 442dadd..b1fae8e 100644
--- a/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.json
+++ b/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Journal Entry", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "journal_voucher", 
    "oldfieldtype": "Link", 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Remarks", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "remarks", 
    "oldfieldtype": "Small Text", 
@@ -69,6 +71,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Journal Entry Detail No", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "jv_detail_no", 
    "oldfieldtype": "Data", 
@@ -93,6 +96,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -114,6 +118,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Advance amount", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "advance_amount", 
    "oldfieldtype": "Currency", 
@@ -140,6 +145,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Allocated amount", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "allocated_amount", 
    "oldfieldtype": "Currency", 
@@ -164,7 +170,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:09.979547", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:56.263776", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Sales Invoice Advance", 
diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
index 0dcf9f5..51e2ebc 100644
--- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
+++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Barcode", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -40,6 +41,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -63,6 +65,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -84,6 +87,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_name", 
    "oldfieldtype": "Data", 
@@ -107,6 +111,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer's Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -128,6 +133,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Edit Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -150,6 +156,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Text", 
@@ -174,6 +181,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -196,6 +204,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image View", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "image", 
    "permlevel": 0, 
@@ -219,6 +228,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -241,6 +251,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -262,6 +273,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Quantity", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "qty", 
    "oldfieldtype": "Currency", 
@@ -285,6 +297,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "ref_rate", 
    "oldfieldtype": "Currency", 
@@ -310,6 +323,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Discount on Price List Rate (%)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "adj_rate", 
    "oldfieldtype": "Float", 
@@ -332,6 +346,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -353,6 +368,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "UOM", 
    "permlevel": 0, 
@@ -375,6 +391,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Rate (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "base_ref_rate", 
    "oldfieldtype": "Currency", 
@@ -398,6 +415,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -419,6 +437,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "export_rate", 
    "oldfieldtype": "Currency", 
@@ -443,6 +462,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "export_amount", 
    "oldfieldtype": "Currency", 
@@ -466,6 +486,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -487,6 +508,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rate (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "basic_rate", 
    "oldfieldtype": "Currency", 
@@ -511,6 +533,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "amount", 
    "oldfieldtype": "Currency", 
@@ -535,6 +558,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Pricing Rule", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Pricing Rule", 
    "permlevel": 0, 
@@ -556,6 +580,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -578,6 +603,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -601,6 +627,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -623,6 +650,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -645,6 +673,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Rate (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -668,6 +697,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -692,6 +722,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Drop Ship", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -714,6 +745,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Delivered By Supplier", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -736,6 +768,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Accounting Details", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -757,6 +790,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Income Account", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "income_account", 
    "oldfieldtype": "Link", 
@@ -783,6 +817,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Expense Account", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Account", 
    "permlevel": 0, 
@@ -805,6 +840,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -827,6 +863,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Cost Center", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "cost_center", 
    "oldfieldtype": "Link", 
@@ -854,6 +891,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Stock Details", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -875,6 +913,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "warehouse", 
    "oldfieldtype": "Link", 
@@ -899,6 +938,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Target Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Warehouse", 
    "permlevel": 0, 
@@ -922,6 +962,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Serial No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "serial_no", 
    "oldfieldtype": "Small Text", 
@@ -945,6 +986,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Batch No", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Batch", 
    "permlevel": 0, 
@@ -968,6 +1010,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Item Group", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_group", 
    "oldfieldtype": "Link", 
@@ -992,6 +1035,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Brand Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "brand", 
    "oldfieldtype": "Data", 
@@ -1015,6 +1059,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Tax Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_tax_rate", 
    "oldfieldtype": "Small Text", 
@@ -1037,6 +1082,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1058,6 +1104,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Available Batch Qty at Warehouse", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -1082,6 +1129,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Available Qty at Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "actual_qty", 
    "oldfieldtype": "Currency", 
@@ -1105,6 +1153,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "References", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1127,6 +1176,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Time Log Batch", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Time Log Batch", 
    "permlevel": 0, 
@@ -1149,6 +1199,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Sales Order", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "sales_order", 
    "oldfieldtype": "Link", 
@@ -1173,6 +1224,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Sales Order Item", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "so_detail", 
    "oldfieldtype": "Data", 
@@ -1195,6 +1247,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1217,6 +1270,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Delivery Note", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "delivery_note", 
    "oldfieldtype": "Link", 
@@ -1241,6 +1295,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Delivery Note Item", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "dn_detail", 
    "oldfieldtype": "Data", 
@@ -1264,6 +1319,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Delivered Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "delivered_qty", 
    "oldfieldtype": "Currency", 
@@ -1286,6 +1342,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1308,6 +1365,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Page Break", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -1327,7 +1385,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-11-02 15:14:02.306067", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:56.335017", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Sales Invoice Item", 
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json
index cb67a70..fe7f615 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json
@@ -18,7 +18,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Type",  
+   "label": "Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "charge_type", 
    "oldfieldtype": "Select", 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reference Row #", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "row_id", 
    "oldfieldtype": "Data", 
@@ -67,6 +69,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Account Head", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "account_head", 
    "oldfieldtype": "Link", 
@@ -92,6 +95,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Cost Center", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "cost_center_other_charges", 
    "oldfieldtype": "Link", 
@@ -115,6 +119,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -137,6 +142,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Small Text", 
@@ -163,6 +169,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is this Tax included in Basic Rate?", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -185,6 +192,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -207,6 +215,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "rate", 
    "oldfieldtype": "Currency", 
@@ -229,6 +238,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -251,6 +261,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -274,6 +285,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -297,6 +309,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Tax Amount After Discount Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -319,6 +332,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -341,6 +355,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "tax_amount", 
    "oldfieldtype": "Currency", 
@@ -365,6 +380,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "total", 
    "oldfieldtype": "Currency", 
@@ -390,6 +406,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Tax Amount After Discount Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -412,6 +429,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Wise Tax Detail", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_wise_tax_detail", 
    "oldfieldtype": "Small Text", 
@@ -435,6 +453,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Parenttype", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "parenttype", 
    "oldfieldtype": "Data", 
@@ -456,7 +475,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:11.977789", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:57.263576", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Sales Taxes and Charges", 
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.json b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.json
index ddaca27..04cc330 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.json
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.json
@@ -21,6 +21,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Title", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "title", 
    "oldfieldtype": "Data", 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Default", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -65,6 +67,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Disabled", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -86,6 +89,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -107,6 +111,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -130,6 +135,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -152,6 +158,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges", 
    "oldfieldtype": "Table", 
@@ -175,7 +182,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:12.157257", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:57.346680", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Sales Taxes and Charges Template", 
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py
index 886400e..a61ad11 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py
@@ -16,7 +16,7 @@
 
 	if doc.is_default == 1:
 		frappe.db.sql("""update `tab{0}` set is_default = 0
-			where ifnull(is_default,0) = 1 and name != %s and company = %s""".format(doc.doctype),
+			where is_default = 1 and name != %s and company = %s""".format(doc.doctype),
 			(doc.name, doc.company))
 
 	for tax in doc.get("taxes"):
diff --git a/erpnext/accounts/doctype/shipping_rule/shipping_rule.json b/erpnext/accounts/doctype/shipping_rule/shipping_rule.json
index e692322..7816dd5 100644
--- a/erpnext/accounts/doctype/shipping_rule/shipping_rule.json
+++ b/erpnext/accounts/doctype/shipping_rule/shipping_rule.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Shipping Rule Label", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Disabled", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -64,7 +66,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Calculate Based On",  
+   "label": "Calculate Based On", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Net Total\nNet Weight", 
    "permlevel": 0, 
@@ -88,6 +91,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Shipping Rule Conditions", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -109,6 +113,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Shipping Rule Conditions", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Shipping Rule Condition", 
    "permlevel": 0, 
@@ -132,6 +137,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Valid for Countries", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -153,6 +159,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Worldwide Shipping", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -176,6 +183,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Valid for Countries", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Shipping Rule Country", 
    "permlevel": 0, 
@@ -199,6 +207,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -220,6 +229,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -241,6 +251,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -262,6 +273,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Shipping Account", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Account", 
    "permlevel": 0, 
@@ -284,6 +296,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Cost Center", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Cost Center", 
    "permlevel": 0, 
@@ -305,7 +318,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:12.778062", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:57.633071", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Shipping Rule", 
diff --git a/erpnext/accounts/doctype/shipping_rule_condition/shipping_rule_condition.json b/erpnext/accounts/doctype/shipping_rule_condition/shipping_rule_condition.json
index ae22bef..f653b10 100644
--- a/erpnext/accounts/doctype/shipping_rule_condition/shipping_rule_condition.json
+++ b/erpnext/accounts/doctype/shipping_rule_condition/shipping_rule_condition.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "From Value", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -40,6 +41,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "To Value", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -61,6 +63,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Shipping Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -81,7 +84,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:12.974539", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:57.700694", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Shipping Rule Condition", 
diff --git a/erpnext/accounts/doctype/shipping_rule_country/shipping_rule_country.json b/erpnext/accounts/doctype/shipping_rule_country/shipping_rule_country.json
index f89408d..3d0c36c 100644
--- a/erpnext/accounts/doctype/shipping_rule_country/shipping_rule_country.json
+++ b/erpnext/accounts/doctype/shipping_rule_country/shipping_rule_country.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Country", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Country", 
    "permlevel": 0, 
@@ -39,7 +40,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:13.035775", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:57.731755", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Shipping Rule Country", 
diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.json b/erpnext/accounts/doctype/tax_rule/tax_rule.json
index 7340278..38e6805 100644
--- a/erpnext/accounts/doctype/tax_rule/tax_rule.json
+++ b/erpnext/accounts/doctype/tax_rule/tax_rule.json
@@ -20,7 +20,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Tax Type",  
+   "label": "Tax Type", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Sales\nPurchase", 
    "permlevel": 0, 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Use for Shopping Cart", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -65,6 +67,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -88,6 +91,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Tax Template", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Sales Taxes and Charges Template", 
    "permlevel": 0, 
@@ -112,6 +116,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Purchase Tax Template", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Purchase Taxes and Charges Template", 
    "permlevel": 0, 
@@ -135,6 +140,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Filters", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -158,6 +164,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Customer", 
    "permlevel": 0, 
@@ -182,6 +189,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Supplier", 
    "permlevel": 0, 
@@ -205,6 +213,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Billing City", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -227,6 +236,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Billing State", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -249,6 +259,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Billing Country", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Country", 
    "permlevel": 0, 
@@ -271,6 +282,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -294,6 +306,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Group", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Customer Group", 
    "permlevel": 0, 
@@ -318,6 +331,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier Type", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Supplier Type", 
    "permlevel": 0, 
@@ -341,6 +355,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Shipping City", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -363,6 +378,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Shipping State", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -385,6 +401,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Shipping Country", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Country", 
    "permlevel": 0, 
@@ -408,6 +425,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Validity", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -430,6 +448,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "From Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -451,6 +470,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -473,6 +493,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "To Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -494,6 +515,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -517,6 +539,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Priority", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -538,6 +561,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -560,6 +584,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -580,7 +605,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:16.298546", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:59.201327", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Tax Rule", 
diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py
index ed2a049..49a7bd0 100644
--- a/erpnext/accounts/general_ledger.py
+++ b/erpnext/accounts/general_ledger.py
@@ -27,25 +27,25 @@
 		gl_map = merge_similar_entries(gl_map)
 
 	for entry in gl_map:
-		# toggle debit, credit if negative entry		
+		# toggle debit, credit if negative entry
 		if flt(entry.debit) < 0:
 			entry.credit = flt(entry.credit) - flt(entry.debit)
 			entry.debit = 0.0
-			
+
 		if flt(entry.debit_in_account_currency) < 0:
 			entry.credit_in_account_currency = \
 				flt(entry.credit_in_account_currency) - flt(entry.debit_in_account_currency)
 			entry.debit_in_account_currency = 0.0
-		
+
 		if flt(entry.credit) < 0:
 			entry.debit = flt(entry.debit) - flt(entry.credit)
 			entry.credit = 0.0
-			
+
 		if flt(entry.credit_in_account_currency) < 0:
 			entry.debit_in_account_currency = \
 				flt(entry.debit_in_account_currency) - flt(entry.credit_in_account_currency)
 			entry.credit_in_account_currency = 0.0
-			
+
 	return gl_map
 
 def merge_similar_entries(gl_map):
@@ -81,7 +81,7 @@
 def save_entries(gl_map, adv_adj, update_outstanding):
 	validate_account_for_auto_accounting_for_stock(gl_map)
 	round_off_debit_credit(gl_map)
-	
+
 	for entry in gl_map:
 		make_entry(entry, adv_adj, update_outstanding)
 		# check against budget
@@ -99,7 +99,7 @@
 	if cint(frappe.db.get_single_value("Accounts Settings", "auto_accounting_for_stock")) \
 		and gl_map[0].voucher_type=="Journal Entry":
 			aii_accounts = [d[0] for d in frappe.db.sql("""select name from tabAccount
-				where account_type = 'Warehouse' and ifnull(warehouse, '')!=''""")]
+				where account_type = 'Warehouse' and (warehouse != '' and warehouse is not null)""")]
 
 			for entry in gl_map:
 				if entry.account in aii_accounts:
@@ -109,36 +109,36 @@
 def round_off_debit_credit(gl_map):
 	precision = get_field_precision(frappe.get_meta("GL Entry").get_field("debit"),
 		currency=frappe.db.get_value("Company", gl_map[0].company, "default_currency", cache=True))
-	
+
 	debit_credit_diff = 0.0
 	for entry in gl_map:
 		entry.debit = flt(entry.debit, precision)
 		entry.credit = flt(entry.credit, precision)
 		debit_credit_diff += entry.debit - entry.credit
-	
+
 	debit_credit_diff = flt(debit_credit_diff, precision)
 	if abs(debit_credit_diff) >= (5.0 / (10**precision)):
 		frappe.throw(_("Debit and Credit not equal for {0} #{1}. Difference is {2}.")
 			.format(gl_map[0].voucher_type, gl_map[0].voucher_no, debit_credit_diff))
-		
+
 	elif abs(debit_credit_diff) >= (1.0 / (10**precision)):
 		make_round_off_gle(gl_map, debit_credit_diff)
-		
+
 def make_round_off_gle(gl_map, debit_credit_diff):
-	round_off_account, round_off_cost_center = frappe.db.get_value("Company", gl_map[0].company, 
+	round_off_account, round_off_cost_center = frappe.db.get_value("Company", gl_map[0].company,
 		["round_off_account", "round_off_cost_center"]) or [None, None]
 	if not round_off_account:
 		frappe.throw(_("Please mention Round Off Account in Company"))
-		
+
 	if not round_off_cost_center:
 		frappe.throw(_("Please mention Round Off Cost Center in Company"))
-		
-	
+
+
 	round_off_gle = frappe._dict()
-	for k in ["voucher_type", "voucher_no", "company", 
+	for k in ["voucher_type", "voucher_no", "company",
 		"posting_date", "remarks", "fiscal_year", "is_opening"]:
 			round_off_gle[k] = gl_map[0][k]
-	
+
 	round_off_gle.update({
 		"account": round_off_account,
 		"debit": abs(debit_credit_diff) if debit_credit_diff < 0 else 0,
@@ -149,7 +149,7 @@
 		"against_voucher_type": None,
 		"against_voucher": None
 	})
-	
+
 	gl_map.append(round_off_gle)
 
 
diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.py b/erpnext/accounts/page/accounts_browser/accounts_browser.py
index 80101ce..210c4bf 100644
--- a/erpnext/accounts/page/accounts_browser/accounts_browser.py
+++ b/erpnext/accounts/page/accounts_browser/accounts_browser.py
@@ -25,9 +25,9 @@
 		acc = frappe.db.sql(""" select
 			name as value, is_group as expandable %s
 			from `tab%s`
-			where ifnull(parent_%s,'') = ''
+			where ifnull(`parent_%s`,'') = ''
 			and `company` = %s	and docstatus<2
-			order by name""" % (select_cond, ctype, ctype.lower().replace(' ','_'), '%s'),
+			order by name""" % (select_cond, frappe.db.escape(ctype), frappe.db.escape(ctype.lower().replace(' ','_')), '%s'),
 				company, as_dict=1)
 
 		if args["parent"]=="Accounts":
@@ -38,9 +38,9 @@
 		acc = frappe.db.sql("""select
 			name as value, is_group as expandable %s
 	 		from `tab%s`
-			where ifnull(parent_%s,'') = %s
+			where ifnull(`parent_%s`,'') = %s
 			and docstatus<2
-			order by name""" % (select_cond, ctype, ctype.lower().replace(' ','_'), '%s'),
+			order by name""" % (select_cond, frappe.db.escape(ctype), frappe.db.escape(ctype.lower().replace(' ','_')), '%s'),
 				args['parent'], as_dict=1)
 
 	if ctype == 'Account':
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
index e4ae2a4..3168514 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
@@ -216,7 +216,7 @@
 			self.gl_entries = frappe.db.sql("""select name, posting_date, account, party_type, party,
 				voucher_type, voucher_no, against_voucher_type, against_voucher, account_currency, remarks, {0}
 				from `tabGL Entry`
-				where docstatus < 2 and party_type=%s and ifnull(party, '') != '' {1}
+				where docstatus < 2 and party_type=%s and (party is not null and party != '') {1}
 				order by posting_date, party"""
 				.format(select_fields, conditions), values, as_dict=True)
 
diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
index 7016c46..e11878e 100644
--- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
+++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
@@ -24,7 +24,7 @@
 		total_credit += flt(d[3])
 
 	amounts_not_reflected_in_system = frappe.db.sql("""
-		select sum(ifnull(jvd.debit_in_account_currency, 0) - ifnull(jvd.credit_in_account_currency, 0))
+		select sum(jvd.debit_in_account_currency - jvd.credit_in_account_currency)
 		from `tabJournal Entry Account` jvd, `tabJournal Entry` jv
 		where jvd.parent = jv.name and jv.docstatus=1 and jvd.account=%s
 		and jv.posting_date > %s and jv.clearance_date <= %s and ifnull(jv.is_opening, 'No') = 'No'
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py
index 7bad361..e11fb0e 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.py
+++ b/erpnext/accounts/report/general_ledger/general_ledger.py
@@ -102,15 +102,15 @@
 	return result
 
 def get_gl_entries(filters):
-	select_fields = """, sum(ifnull(debit_in_account_currency, 0)) as debit_in_account_currency,
-		sum(ifnull(credit_in_account_currency, 0)) as credit_in_account_currency""" \
+	select_fields = """, sum(debit_in_account_currency) as debit_in_account_currency,
+		sum(credit_in_account_currency) as credit_in_account_currency""" \
 		if filters.get("show_in_account_currency") else ""
 
 	group_by_condition = "group by voucher_type, voucher_no, account, cost_center" \
 		if filters.get("group_by_voucher") else "group by name"
 
 	gl_entries = frappe.db.sql("""select posting_date, account, party_type, party,
-			sum(ifnull(debit, 0)) as debit, sum(ifnull(credit, 0)) as credit,
+			sum(debit) as debit, sum(credit) as credit,
 			voucher_type, voucher_no, cost_center, remarks, against, is_opening {select_fields}
 		from `tabGL Entry`
 		where company=%(company)s {conditions}
diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py
index b500d6c..8d9684c 100644
--- a/erpnext/accounts/report/gross_profit/gross_profit.py
+++ b/erpnext/accounts/report/gross_profit/gross_profit.py
@@ -208,7 +208,7 @@
 			else:
 				self.average_buying_rate[item_code] = flt(frappe.db.sql("""select avg(valuation_rate)
 					from `tabStock Ledger Entry`
-					where item_code = %s and ifnull(qty_after_transaction,0) > 0""", item_code)[0][0])
+					where item_code = %s and qty_after_transaction > 0""", item_code)[0][0])
 
 		return self.average_buying_rate[item_code]
 
diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
index bcb128b..122b239 100644
--- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
+++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
@@ -88,7 +88,7 @@
 
 	tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail, charge_type, base_tax_amount_after_discount_amount
 		from `tabPurchase Taxes and Charges` where parenttype = 'Purchase Invoice'
-		and docstatus = 1 and ifnull(account_head, '') != '' and category in ('Total', 'Valuation and Total')
+		and docstatus = 1 and (account_head is not null and account_head != '') and category in ('Total', 'Valuation and Total')
 		and parent in (%s)""" % ', '.join(['%s']*len(invoice_wise_items)), tuple(invoice_wise_items.keys()))
 
 	for parent, account_head, item_wise_tax_detail, charge_type, tax_amount in tax_details:
diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
index 61b4227..b8afa9f 100644
--- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
+++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
@@ -86,7 +86,7 @@
 	tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail,
 		charge_type, base_tax_amount_after_discount_amount
 		from `tabSales Taxes and Charges` where parenttype = 'Sales Invoice'
-		and docstatus = 1 and ifnull(account_head, '') != ''
+		and docstatus = 1 and (account_head is not null and account_head != '')
 		and parent in (%s)""" % ', '.join(['%s']*len(invoice_wise_items)),
 		tuple(invoice_wise_items.keys()))
 
diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py
index 6f80029..cad1f19 100644
--- a/erpnext/accounts/report/purchase_register/purchase_register.py
+++ b/erpnext/accounts/report/purchase_register/purchase_register.py
@@ -29,7 +29,7 @@
 		purchase_receipt = list(set(invoice_po_pr_map.get(inv.name, {}).get("purchase_receipt", [])))
 		project_name = list(set(invoice_po_pr_map.get(inv.name, {}).get("project_name", [])))
 
-		row = [inv.name, inv.posting_date, inv.supplier, inv.supplier_name, 
+		row = [inv.name, inv.posting_date, inv.supplier, inv.supplier_name,
 			supplier_details.get(inv.supplier),
 			inv.credit_to, ", ".join(project_name), inv.bill_no, inv.bill_date, inv.remarks,
 			", ".join(purchase_order), ", ".join(purchase_receipt)]
@@ -54,7 +54,7 @@
 
 		# total tax, grand total, outstanding amount & rounded total
 		row += [total_tax, inv.base_grand_total, flt(inv.base_grand_total, 2), inv.outstanding_amount]
-		data.append(row)		
+		data.append(row)
 
 	return columns, data
 
@@ -71,13 +71,15 @@
 
 	if invoice_list:
 		expense_accounts = frappe.db.sql_list("""select distinct expense_account
-			from `tabPurchase Invoice Item` where docstatus = 1 and ifnull(expense_account, '') != ''
+			from `tabPurchase Invoice Item` where docstatus = 1
+			and (expense_account is not null and expense_account != '')
 			and parent in (%s) order by expense_account""" %
 			', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]))
 
 		tax_accounts = 	frappe.db.sql_list("""select distinct account_head
 			from `tabPurchase Taxes and Charges` where parenttype = 'Purchase Invoice'
-			and docstatus = 1 and ifnull(account_head, '') != '' and category in ('Total', 'Valuation and Total')
+			and docstatus = 1 and (account_head is not null and account_head != '')
+			and category in ('Total', 'Valuation and Total')
 			and parent in (%s) order by account_head""" %
 			', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]))
 
@@ -143,7 +145,7 @@
 	return invoice_expense_map, invoice_tax_map
 
 def get_invoice_po_pr_map(invoice_list):
-	pi_items = frappe.db.sql("""select parent, purchase_order, purchase_receipt, po_detail, 
+	pi_items = frappe.db.sql("""select parent, purchase_order, purchase_receipt, po_detail,
 		project_name from `tabPurchase Invoice Item` where parent in (%s)
 		and (ifnull(purchase_order, '') != '' or ifnull(purchase_receipt, '') != '')""" %
 		', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py
index ffb274c..d202cf3 100644
--- a/erpnext/accounts/report/sales_register/sales_register.py
+++ b/erpnext/accounts/report/sales_register/sales_register.py
@@ -79,7 +79,7 @@
 
 		tax_accounts = 	frappe.db.sql_list("""select distinct account_head
 			from `tabSales Taxes and Charges` where parenttype = 'Sales Invoice'
-			and docstatus = 1 and ifnull(base_tax_amount_after_discount_amount, 0) != 0
+			and docstatus = 1 and base_tax_amount_after_discount_amount != 0
 			and parent in (%s) order by account_head""" %
 			', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]))
 
diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py
index 11af273..fdbed90 100644
--- a/erpnext/accounts/report/trial_balance/trial_balance.py
+++ b/erpnext/accounts/report/trial_balance/trial_balance.py
@@ -85,7 +85,7 @@
 		
 	gle = frappe.db.sql("""
 		select 
-			account, sum(ifnull(debit, 0)) as opening_debit, sum(ifnull(credit, 0)) as opening_credit 
+			account, sum(debit) as opening_debit, sum(credit) as opening_credit 
 		from `tabGL Entry`
 		where 
 			company=%(company)s
diff --git a/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py b/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
index 2a47ce8..ceabaab 100644
--- a/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
+++ b/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
@@ -76,7 +76,7 @@
 	
 def get_opening_balances(filters):
 	gle = frappe.db.sql("""
-		select party, sum(ifnull(debit, 0)) as opening_debit, sum(ifnull(credit, 0)) as opening_credit 
+		select party, sum(debit) as opening_debit, sum(credit) as opening_credit 
 		from `tabGL Entry`
 		where company=%(company)s 
 			and ifnull(party_type, '') = %(party_type)s and ifnull(party, '') != ''
@@ -96,7 +96,7 @@
 	
 def get_balances_within_period(filters):
 	gle = frappe.db.sql("""
-		select party, sum(ifnull(debit, 0)) as debit, sum(ifnull(credit, 0)) as credit 
+		select party, sum(debit) as debit, sum(credit) as credit 
 		from `tabGL Entry`
 		where company=%(company)s 
 			and ifnull(party_type, '') = %(party_type)s and ifnull(party, '') != ''
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 5d0403e..05b771a 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -21,7 +21,7 @@
 
 def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verbose=1, company=None):
 	# if year start date is 2012-04-01, year end date should be 2013-03-31 (hence subdate)
-	cond = " ifnull(disabled, 0) = 0"
+	cond = " disabled = 0"
 	if fiscal_year:
 		cond += " and fy.name = %(fiscal_year)s"
 	else:
@@ -65,7 +65,7 @@
 
 	cond = []
 	if date:
-		cond.append("posting_date <= '%s'" % date)
+		cond.append("posting_date <= '%s'" % frappe.db.escape(cstr(date)))
 	else:
 		# get balance of all entries that exist
 		date = nowdate()
@@ -105,17 +105,17 @@
 			if acc.account_currency == frappe.db.get_value("Company", acc.company, "default_currency"):
 				in_account_currency = False
 		else:
-			cond.append("""gle.account = "%s" """ % (account.replace('"', '\\"'), ))
+			cond.append("""gle.account = "%s" """ % (frappe.db.escape(account), ))
 
 	if party_type and party:
 		cond.append("""gle.party_type = "%s" and gle.party = "%s" """ %
-			(party_type.replace('"', '\\"'), party.replace('"', '\\"')))
+			(frappe.db.escape(party_type), frappe.db.escape(party)))
 
 	if account or (party_type and party):
 		if in_account_currency:
-			select_field = "sum(ifnull(debit_in_account_currency, 0)) - sum(ifnull(credit_in_account_currency, 0))"
+			select_field = "sum(debit_in_account_currency) - sum(credit_in_account_currency)"
 		else:
-			select_field = "sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))"
+			select_field = "sum(debit) - sum(credit)"
 		bal = frappe.db.sql("""
 			SELECT {0}
 			FROM `tabGL Entry` gle
@@ -181,7 +181,7 @@
 		select t2.{dr_or_cr} from `tabJournal Entry` t1, `tabJournal Entry Account` t2
 		where t1.name = t2.parent and t2.account = %(account)s
 		and t2.party_type = %(party_type)s and t2.party = %(party)s
-		and ifnull(t2.reference_type, '') in ("", "Sales Order", "Purchase Order")
+		and (t2.reference_type is null or t2.reference_type in ("", "Sales Order", "Purchase Order"))
 		and t1.name = %(voucher_no)s and t2.name = %(voucher_detail_no)s
 		and t1.docstatus=1 """.format(dr_or_cr = args.get("dr_or_cr")), args)
 
@@ -282,7 +282,7 @@
 		sum(debit) - sum(credit) as diff
 		from `tabGL Entry`
 		group by voucher_type, voucher_no
-		having sum(ifnull(debit, 0)) != sum(ifnull(credit, 0))""", as_dict=1)
+		having sum(debit) != sum(credit)""", as_dict=1)
 
 	for d in vouchers:
 		if abs(d.diff) > 0:
@@ -301,7 +301,7 @@
 	difference = {}
 
 	account_warehouse = dict(frappe.db.sql("""select name, warehouse from tabAccount
-		where account_type = 'Warehouse' and ifnull(warehouse, '') != ''
+		where account_type = 'Warehouse' and (warehouse is not null and warehouse != '')
 		and name in (%s)""" % ', '.join(['%s']*len(account_list)), account_list))
 
 	for account, warehouse in account_warehouse.items():
@@ -372,7 +372,7 @@
 		if args.get("month_end_date") else ""
 
 	return flt(frappe.db.sql("""
-		select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
+		select sum(debit) - sum(credit)
 		from `tabGL Entry`
 		where account='%(account)s' and cost_center='%(cost_center)s'
 		and fiscal_year='%(fiscal_year)s' and company='%(company)s' %(condition)s
@@ -392,14 +392,14 @@
 		from `tabStock Ledger Entry` where company=%s""", company)
 
 	pr_valuation_amount = frappe.db.sql("""
-		select sum(ifnull(pr_item.valuation_rate, 0) * ifnull(pr_item.qty, 0) * ifnull(pr_item.conversion_factor, 0))
+		select sum(pr_item.valuation_rate * pr_item.qty * pr_item.conversion_factor)
 		from `tabPurchase Receipt Item` pr_item, `tabPurchase Receipt` pr
 	    where pr.name = pr_item.parent and pr.docstatus=1 and pr.company=%s
 		and pr.posting_date <= %s and pr_item.item_code in (%s)""" %
 	    ('%s', '%s', ', '.join(['%s']*len(stock_items))), tuple([company, posting_date] + stock_items))[0][0]
 
 	pi_valuation_amount = frappe.db.sql("""
-		select sum(ifnull(pi_item.valuation_rate, 0) * ifnull(pi_item.qty, 0) * ifnull(pi_item.conversion_factor, 0))
+		select sum(pi_item.valuation_rate * pi_item.qty * pi_item.conversion_factor)
 		from `tabPurchase Invoice Item` pi_item, `tabPurchase Invoice` pi
 	    where pi.name = pi_item.parent and pi.docstatus=1 and pi.company=%s
 		and pi.posting_date <= %s and pi_item.item_code in (%s)""" %
@@ -420,18 +420,18 @@
 	precision = frappe.get_precision("Sales Invoice", "outstanding_amount")
 
 	if party_type=="Customer":
-		dr_or_cr = "ifnull(debit_in_account_currency, 0) - ifnull(credit_in_account_currency, 0)"
-		payment_dr_or_cr = "ifnull(payment_gl_entry.credit_in_account_currency, 0) - ifnull(payment_gl_entry.debit_in_account_currency, 0)"
+		dr_or_cr = "debit_in_account_currency - credit_in_account_currency"
+		payment_dr_or_cr = "payment_gl_entry.credit_in_account_currency - payment_gl_entry.debit_in_account_currency"
 	else:
-		dr_or_cr = "ifnull(credit_in_account_currency, 0) - ifnull(debit_in_account_currency, 0)"
-		payment_dr_or_cr = "ifnull(payment_gl_entry.debit_in_account_currency, 0) - ifnull(payment_gl_entry.credit_in_account_currency, 0)"
+		dr_or_cr = "credit_in_account_currency - debit_in_account_currency"
+		payment_dr_or_cr = "payment_gl_entry.debit_in_account_currency - payment_gl_entry.credit_in_account_currency"
 
 	invoice_list = frappe.db.sql("""select
 			voucher_no,	voucher_type, posting_date,
 			ifnull(sum({dr_or_cr}), 0) as invoice_amount,
 			(
 				select
-					ifnull(sum(ifnull({payment_dr_or_cr}, 0)), 0)
+					ifnull(sum({payment_dr_or_cr}), 0)
 				from `tabGL Entry` payment_gl_entry
 				where
 					payment_gl_entry.against_voucher_type = invoice_gl_entry.voucher_type
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index e1b01a1..74936da 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -18,9 +18,27 @@
 		var me = this;
 		this._super();
 		// this.frm.dashboard.reset();
+		var allow_receipt = false;
+		var is_drop_ship = false;
 
+		for (var i in cur_frm.doc.items) {
+			var item = cur_frm.doc.items[i];
+			if(item.delivered_by_supplier !== 1) {
+				allow_receipt = true;
+			}
+			
+			else {
+				is_drop_ship = true
+			}
+			
+			if(is_drop_ship && allow_receipt) {
+				break;
+			}
+		}
+		
+		cur_frm.set_df_property("drop_ship", "hidden", !is_drop_ship);
+		
 		if(doc.docstatus == 1 && !in_list(["Stopped", "Closed", "Delivered"], doc.status)) {
-
 			if (this.frm.has_perm("submit")) {
 				if(flt(doc.per_billed, 2) < 100 || doc.per_received < 100) {
 					cur_frm.add_custom_button(__('Stop'), this.stop_purchase_order);
@@ -29,7 +47,7 @@
 				cur_frm.add_custom_button(__('Close'), this.close_purchase_order);
 			}
 
-			if(doc.delivered_by_supplier && doc.status!="Delivered"){
+			if(is_drop_ship && doc.status!="Delivered"){
 				cur_frm.add_custom_button(__('Mark as Delivered'), this.delivered_by_supplier);
 			}
 
@@ -37,7 +55,12 @@
 				cur_frm.add_custom_button(__('Payment'), cur_frm.cscript.make_bank_entry);
 			}
 
-			if(flt(doc.per_received, 2) < 100 && this.frm.doc.__onload.has_stock_item) {
+		} else if(doc.docstatus===0) {
+			cur_frm.cscript.add_from_mappers();
+		} 
+		
+		if(doc.docstatus == 1 && !in_list(["Stopped", "Closed"], doc.status)) {
+			if(flt(doc.per_received, 2) < 100 && this.frm.doc.__onload.has_stock_item && allow_receipt) {
 				cur_frm.add_custom_button(__('Receive'), this.make_purchase_receipt).addClass("btn-primary");
 
 				if(doc.is_subcontracted==="Yes") {
@@ -47,13 +70,9 @@
 			}
 
 			if(flt(doc.per_billed, 2) < 100)
-				cur_frm.add_custom_button(__('Invoice'), this.make_purchase_invoice);
-
-
-		} else if(doc.docstatus===0) {
-			cur_frm.cscript.add_from_mappers();
+				cur_frm.add_custom_button(__('Invoice'), this.make_purchase_invoice);	
 		}
-
+		
 		if(doc.docstatus == 1 && in_list(["Stopped", "Closed", "Delivered"], doc.status)) {
 			if (this.frm.has_perm("submit")) {
 				cur_frm.add_custom_button(__('Re-open'), this.unstop_purchase_order);
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index 0b03319..db37033 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -1,2399 +1,2499 @@
 {
- "allow_copy": 0, 
- "allow_import": 1, 
- "allow_rename": 0, 
- "autoname": "naming_series:", 
- "creation": "2013-05-21 16:16:39", 
- "custom": 0, 
- "docstatus": 0, 
- "doctype": "DocType", 
- "document_type": "Document", 
+ "allow_copy": 0,
+ "allow_import": 1,
+ "allow_rename": 0,
+ "autoname": "naming_series:",
+ "creation": "2013-05-21 16:16:39",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "Document",
  "fields": [
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "supplier_section", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "", 
-   "no_copy": 0, 
-   "options": "icon-user", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "supplier_section",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "",
+   "length": 0,
+   "no_copy": 0,
+   "options": "icon-user",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "default": "{supplier_name}", 
-   "fieldname": "title", 
-   "fieldtype": "Data", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Title", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 1,
+   "bold": 0,
+   "collapsible": 0,
+   "default": "{supplier_name}",
+   "fieldname": "title",
+   "fieldtype": "Data",
+   "hidden": 1,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Title",
+   "length": 0,
+   "no_copy": 1,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "naming_series", 
-   "fieldtype": "Select", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Series", 
-   "no_copy": 1, 
-   "oldfieldname": "naming_series", 
-   "oldfieldtype": "Select", 
-   "options": "PO-", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "naming_series",
+   "fieldtype": "Select",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Series",
+   "length": 0,
+   "no_copy": 1,
+   "oldfieldname": "naming_series",
+   "oldfieldtype": "Select",
+   "options": "PO-",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 1, 
-   "collapsible": 0, 
-   "description": "", 
-   "fieldname": "supplier", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Supplier", 
-   "no_copy": 0, 
-   "oldfieldname": "supplier", 
-   "oldfieldtype": "Link", 
-   "options": "Supplier", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 1, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 1,
+   "collapsible": 0,
+   "description": "",
+   "fieldname": "supplier",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 1,
+   "in_list_view": 0,
+   "label": "Supplier",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "supplier",
+   "oldfieldtype": "Link",
+   "options": "Supplier",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 1,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "default": "No", 
-   "fieldname": "is_subcontracted", 
-   "fieldtype": "Select", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Supply Raw Materials", 
-   "no_copy": 0, 
-   "options": "No\nYes", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "default": "No",
+   "fieldname": "is_subcontracted",
+   "fieldtype": "Select",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Supply Raw Materials",
+   "length": 0,
+   "no_copy": 0,
+   "options": "No\nYes",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "supplier_name", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Supplier Name", 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "supplier_name",
+   "fieldtype": "Data",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Supplier Name",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "depends_on": "", 
-   "fieldname": "address_display", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Address", 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "depends_on": "",
+   "fieldname": "address_display",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Address",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "contact_display", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Contact", 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "contact_display",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Contact",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "contact_mobile", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Mobile No", 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "contact_mobile",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Mobile No",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "contact_email", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Contact Email", 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "contact_email",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Contact Email",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "column_break1", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "no_copy": 0, 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_width": "50%", 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "column_break1",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_width": "50%",
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
+   "unique": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "transaction_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Date", 
-   "no_copy": 0, 
-   "oldfieldname": "transaction_date", 
-   "oldfieldtype": "Date", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 1, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "transaction_date",
+   "fieldtype": "Date",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 1,
+   "in_list_view": 0,
+   "label": "Date",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "transaction_date",
+   "oldfieldtype": "Date",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 1,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "amended_from", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 1, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Amended From", 
-   "no_copy": 1, 
-   "oldfieldname": "amended_from", 
-   "oldfieldtype": "Data", 
-   "options": "Purchase Order", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "amended_from",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 1,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Amended From",
+   "length": 0,
+   "no_copy": 1,
+   "oldfieldname": "amended_from",
+   "oldfieldtype": "Data",
+   "options": "Purchase Order",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "description": "", 
-   "fieldname": "company", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Company", 
-   "no_copy": 0, 
-   "oldfieldname": "company", 
-   "oldfieldtype": "Link", 
-   "options": "Company", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 1, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "description": "",
+   "fieldname": "company",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 1,
+   "in_list_view": 0,
+   "label": "Company",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "company",
+   "oldfieldtype": "Link",
+   "options": "Company",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 1,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 1, 
-   "collapsible_depends_on": "delivered_by_supplier", 
-   "fieldname": "drop_ship", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Drop Ship", 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "collapsible_depends_on": "",
+   "fieldname": "drop_ship",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Drop Ship",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "depends_on": "delivered_by_supplier", 
-   "fieldname": "customer", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Customer", 
-   "no_copy": 0, 
-   "options": "Customer", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "depends_on": "",
+   "fieldname": "customer",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Customer",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Customer",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "depends_on": "delivered_by_supplier", 
-   "fieldname": "customer_name", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Customer Name", 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "depends_on": "",
+   "fieldname": "customer_name",
+   "fieldtype": "Data",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Customer Name",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "delivered_by_supplier", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "To be delivered to customer", 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "delivered_by_supplier",
+   "fieldtype": "Check",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "To be delivered to customer",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "column_break_19", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "column_break_19",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "depends_on": "delivered_by_supplier", 
-   "fieldname": "customer_address", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Customer Address", 
-   "no_copy": 0, 
-   "options": "Address", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "depends_on": "",
+   "fieldname": "customer_address",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Customer Address",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Address",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "depends_on": "delivered_by_supplier", 
-   "fieldname": "customer_contact_person", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Customer Contact", 
-   "no_copy": 0, 
-   "options": "Contact", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "depends_on": "",
+   "fieldname": "customer_contact_person",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Customer Contact",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Contact",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "customer_address_display", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Customer Address Display", 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "customer_address_display",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Customer Address Display",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "customer_contact_display", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Customer Contact", 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "customer_contact_display",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Customer Contact",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "customer_contact_mobile", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Customer Mobile No", 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "customer_contact_mobile",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Customer Mobile No",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "customer_contact_email", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Customer Contact Email", 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "customer_contact_email",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Customer Contact Email",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 1, 
-   "fieldname": "currency_and_price_list", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Currency and Price List", 
-   "no_copy": 0, 
-   "options": "icon-tag", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 1,
+   "fieldname": "currency_and_price_list",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Currency and Price List",
+   "length": 0,
+   "no_copy": 0,
+   "options": "icon-tag",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "currency", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Currency", 
-   "no_copy": 0, 
-   "oldfieldname": "currency", 
-   "oldfieldtype": "Select", 
-   "options": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "currency",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Currency",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "currency",
+   "oldfieldtype": "Select",
+   "options": "Currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "description": "", 
-   "fieldname": "conversion_rate", 
-   "fieldtype": "Float", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Exchange Rate", 
-   "no_copy": 0, 
-   "oldfieldname": "conversion_rate", 
-   "oldfieldtype": "Currency", 
-   "permlevel": 0, 
-   "precision": "9", 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "description": "",
+   "fieldname": "conversion_rate",
+   "fieldtype": "Float",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Exchange Rate",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "conversion_rate",
+   "oldfieldtype": "Currency",
+   "permlevel": 0,
+   "precision": "9",
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "cb_price_list", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "cb_price_list",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "buying_price_list", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Price List", 
-   "no_copy": 0, 
-   "options": "Price List", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "buying_price_list",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Price List",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Price List",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "price_list_currency", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Price List Currency", 
-   "no_copy": 0, 
-   "options": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "price_list_currency",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Price List Currency",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "plc_conversion_rate", 
-   "fieldtype": "Float", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Price List Exchange Rate", 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "9", 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "plc_conversion_rate",
+   "fieldtype": "Float",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Price List Exchange Rate",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "9",
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "ignore_pricing_rule", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Ignore Pricing Rule", 
-   "no_copy": 1, 
-   "permlevel": 1, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "ignore_pricing_rule",
+   "fieldtype": "Check",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Ignore Pricing Rule",
+   "length": 0,
+   "no_copy": 1,
+   "permlevel": 1,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "items_section", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "", 
-   "no_copy": 0, 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-shopping-cart", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "items_section",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldtype": "Section Break",
+   "options": "icon-shopping-cart",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "items", 
-   "fieldtype": "Table", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Items", 
-   "no_copy": 0, 
-   "oldfieldname": "po_details", 
-   "oldfieldtype": "Table", 
-   "options": "Purchase Order Item", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "items",
+   "fieldtype": "Table",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Items",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "po_details",
+   "oldfieldtype": "Table",
+   "options": "Purchase Order Item",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "get_last_purchase_rate", 
-   "fieldtype": "Button", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Get Last Purchase Rate", 
-   "no_copy": 0, 
-   "oldfieldtype": "Button", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "get_last_purchase_rate",
+   "fieldtype": "Button",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Get Last Purchase Rate",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldtype": "Button",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "sb_last_purchase", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "sb_last_purchase",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "base_total", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Total (Company Currency)", 
-   "no_copy": 0, 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "base_total",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Total (Company Currency)",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "base_net_total", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Net Total (Company Currency)", 
-   "no_copy": 1, 
-   "oldfieldname": "net_total", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "base_net_total",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Net Total (Company Currency)",
+   "length": 0,
+   "no_copy": 1,
+   "oldfieldname": "net_total",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "column_break_26", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "column_break_26",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "total", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Total", 
-   "no_copy": 0, 
-   "options": "currency", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "total",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Total",
+   "length": 0,
+   "no_copy": 0,
+   "options": "currency",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "net_total", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Net Total", 
-   "no_copy": 0, 
-   "oldfieldname": "net_total_import", 
-   "oldfieldtype": "Currency", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "net_total",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Net Total",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "net_total_import",
+   "oldfieldtype": "Currency",
+   "options": "currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "taxes_section", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "", 
-   "no_copy": 0, 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-money", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "taxes_section",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldtype": "Section Break",
+   "options": "icon-money",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "description": "", 
-   "fieldname": "taxes_and_charges", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Taxes and Charges", 
-   "no_copy": 0, 
-   "oldfieldname": "purchase_other_charges", 
-   "oldfieldtype": "Link", 
-   "options": "Purchase Taxes and Charges Template", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "description": "",
+   "fieldname": "taxes_and_charges",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Taxes and Charges",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "purchase_other_charges",
+   "oldfieldtype": "Link",
+   "options": "Purchase Taxes and Charges Template",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "taxes", 
-   "fieldtype": "Table", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Purchase Taxes and Charges", 
-   "no_copy": 0, 
-   "oldfieldname": "purchase_tax_details", 
-   "oldfieldtype": "Table", 
-   "options": "Purchase Taxes and Charges", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "taxes",
+   "fieldtype": "Table",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Purchase Taxes and Charges",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "purchase_tax_details",
+   "oldfieldtype": "Table",
+   "options": "Purchase Taxes and Charges",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "other_charges_calculation", 
-   "fieldtype": "HTML", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Taxes and Charges Calculation", 
-   "no_copy": 1, 
-   "oldfieldtype": "HTML", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "other_charges_calculation",
+   "fieldtype": "HTML",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Taxes and Charges Calculation",
+   "length": 0,
+   "no_copy": 1,
+   "oldfieldtype": "HTML",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "totals", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "", 
-   "no_copy": 0, 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-money", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "totals",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldtype": "Section Break",
+   "options": "icon-money",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "base_taxes_and_charges_added", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Taxes and Charges Added (Company Currency)", 
-   "no_copy": 0, 
-   "oldfieldname": "other_charges_added", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "base_taxes_and_charges_added",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Taxes and Charges Added (Company Currency)",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "other_charges_added",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "base_taxes_and_charges_deducted", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Taxes and Charges Deducted (Company Currency)", 
-   "no_copy": 0, 
-   "oldfieldname": "other_charges_deducted", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "base_taxes_and_charges_deducted",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Taxes and Charges Deducted (Company Currency)",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "other_charges_deducted",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "base_total_taxes_and_charges", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Total Taxes and Charges (Company Currency)", 
-   "no_copy": 1, 
-   "oldfieldname": "total_tax", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "base_total_taxes_and_charges",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Total Taxes and Charges (Company Currency)",
+   "length": 0,
+   "no_copy": 1,
+   "oldfieldname": "total_tax",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "column_break_39", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "column_break_39",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "taxes_and_charges_added", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Taxes and Charges Added", 
-   "no_copy": 0, 
-   "oldfieldname": "other_charges_added_import", 
-   "oldfieldtype": "Currency", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "taxes_and_charges_added",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Taxes and Charges Added",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "other_charges_added_import",
+   "oldfieldtype": "Currency",
+   "options": "currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "taxes_and_charges_deducted", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Taxes and Charges Deducted", 
-   "no_copy": 0, 
-   "oldfieldname": "other_charges_deducted_import", 
-   "oldfieldtype": "Currency", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "taxes_and_charges_deducted",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Taxes and Charges Deducted",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "other_charges_deducted_import",
+   "oldfieldtype": "Currency",
+   "options": "currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "total_taxes_and_charges", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Total Taxes and Charges", 
-   "no_copy": 0, 
-   "options": "currency", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "total_taxes_and_charges",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Total Taxes and Charges",
+   "length": 0,
+   "no_copy": 0,
+   "options": "currency",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 1, 
-   "collapsible_depends_on": "discount_amount", 
-   "fieldname": "discount_section", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Additional Discount", 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 1,
+   "collapsible_depends_on": "discount_amount",
+   "fieldname": "discount_section",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Additional Discount",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "default": "Grand Total", 
-   "fieldname": "apply_discount_on", 
-   "fieldtype": "Select", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Apply Additional Discount On", 
-   "no_copy": 0, 
-   "options": "\nGrand Total\nNet Total", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "default": "Grand Total",
+   "fieldname": "apply_discount_on",
+   "fieldtype": "Select",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Apply Additional Discount On",
+   "length": 0,
+   "no_copy": 0,
+   "options": "\nGrand Total\nNet Total",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "column_break_45", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "column_break_45",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "discount_amount", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Additional Discount Amount", 
-   "no_copy": 0, 
-   "options": "currency", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "discount_amount",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Additional Discount Amount",
+   "length": 0,
+   "no_copy": 0,
+   "options": "currency",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "base_discount_amount", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Additional Discount Amount (Company Currency)", 
-   "no_copy": 0, 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "base_discount_amount",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Additional Discount Amount (Company Currency)",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "totals_section", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "totals_section",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "base_grand_total", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Grand Total (Company Currency)", 
-   "no_copy": 1, 
-   "oldfieldname": "grand_total", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "base_grand_total",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Grand Total (Company Currency)",
+   "length": 0,
+   "no_copy": 1,
+   "oldfieldname": "grand_total",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "description": "In Words will be visible once you save the Purchase Order.", 
-   "fieldname": "base_in_words", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "In Words (Company Currency)", 
-   "no_copy": 0, 
-   "oldfieldname": "in_words", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "description": "In Words will be visible once you save the Purchase Order.",
+   "fieldname": "base_in_words",
+   "fieldtype": "Data",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "In Words (Company Currency)",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "in_words",
+   "oldfieldtype": "Data",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "base_rounded_total", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Rounded Total (Company Currency)", 
-   "no_copy": 0, 
-   "oldfieldname": "rounded_total", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "base_rounded_total",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Rounded Total (Company Currency)",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "rounded_total",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "advance_paid", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Advance Paid", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "advance_paid",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Advance Paid",
+   "length": 0,
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "column_break4", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "no_copy": 0, 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "column_break4",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "grand_total", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Grand Total", 
-   "no_copy": 0, 
-   "oldfieldname": "grand_total_import", 
-   "oldfieldtype": "Currency", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "grand_total",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 1,
+   "label": "Grand Total",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "grand_total_import",
+   "oldfieldtype": "Currency",
+   "options": "currency",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "in_words", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "In Words", 
-   "no_copy": 0, 
-   "oldfieldname": "in_words_import", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "in_words",
+   "fieldtype": "Data",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "In Words",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "in_words_import",
+   "oldfieldtype": "Data",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 1, 
-   "collapsible_depends_on": "terms", 
-   "fieldname": "terms_section_break", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Terms and Conditions", 
-   "no_copy": 0, 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-legal", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 1,
+   "collapsible_depends_on": "terms",
+   "fieldname": "terms_section_break",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Terms and Conditions",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldtype": "Section Break",
+   "options": "icon-legal",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "tc_name", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Terms", 
-   "no_copy": 0, 
-   "oldfieldname": "tc_name", 
-   "oldfieldtype": "Link", 
-   "options": "Terms and Conditions", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "tc_name",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Terms",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "tc_name",
+   "oldfieldtype": "Link",
+   "options": "Terms and Conditions",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "terms", 
-   "fieldtype": "Text Editor", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Terms and Conditions", 
-   "no_copy": 0, 
-   "oldfieldname": "terms", 
-   "oldfieldtype": "Text Editor", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "terms",
+   "fieldtype": "Text Editor",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Terms and Conditions",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "terms",
+   "oldfieldtype": "Text Editor",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 1, 
-   "depends_on": "supplier", 
-   "fieldname": "contact_section", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Contact Details", 
-   "no_copy": 0, 
-   "options": "icon-bullhorn", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 1,
+   "depends_on": "supplier",
+   "fieldname": "contact_section",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Contact Details",
+   "length": 0,
+   "no_copy": 0,
+   "options": "icon-bullhorn",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "supplier_address", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Supplier Address", 
-   "no_copy": 0, 
-   "options": "Address", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "supplier_address",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 1,
+   "in_list_view": 0,
+   "label": "Supplier Address",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Address",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "cb_contact", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "cb_contact",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "contact_person", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Contact Person", 
-   "no_copy": 0, 
-   "options": "Contact", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "contact_person",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 1,
+   "in_list_view": 0,
+   "label": "Contact Person",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Contact",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 1, 
-   "fieldname": "more_info", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "More Information", 
-   "no_copy": 0, 
-   "oldfieldtype": "Section Break", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 1,
+   "fieldname": "more_info",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "More Information",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldtype": "Section Break",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "default": "Draft", 
-   "fieldname": "status", 
-   "fieldtype": "Select", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Status", 
-   "no_copy": 1, 
-   "oldfieldname": "status", 
-   "oldfieldtype": "Select", 
-   "options": "\nDraft\nTo Receive and Bill\nTo Bill\nTo Receive\nCompleted\nStopped\nCancelled\nClosed\nDelivered", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 1, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "default": "Draft",
+   "fieldname": "status",
+   "fieldtype": "Select",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 1,
+   "in_list_view": 0,
+   "label": "Status",
+   "length": 0,
+   "no_copy": 1,
+   "oldfieldname": "status",
+   "oldfieldtype": "Select",
+   "options": "\nDraft\nTo Receive and Bill\nTo Bill\nTo Receive\nCompleted\nStopped\nCancelled\nClosed\nDelivered",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 1,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "fiscal_year", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Fiscal Year", 
-   "no_copy": 0, 
-   "oldfieldname": "fiscal_year", 
-   "oldfieldtype": "Select", 
-   "options": "Fiscal Year", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 1, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "fiscal_year",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 1,
+   "in_list_view": 0,
+   "label": "Fiscal Year",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "fiscal_year",
+   "oldfieldtype": "Select",
+   "options": "Fiscal Year",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 1,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "ref_sq", 
-   "fieldtype": "Data", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Ref SQ", 
-   "no_copy": 1, 
-   "oldfieldname": "ref_sq", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "ref_sq",
+   "fieldtype": "Data",
+   "hidden": 1,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Ref SQ",
+   "length": 0,
+   "no_copy": 1,
+   "oldfieldname": "ref_sq",
+   "oldfieldtype": "Data",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "column_break_74", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "column_break_74",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "depends_on": "eval:!doc.__islocal", 
-   "description": "", 
-   "fieldname": "per_received", 
-   "fieldtype": "Percent", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "% Received", 
-   "no_copy": 1, 
-   "oldfieldname": "per_received", 
-   "oldfieldtype": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "depends_on": "eval:!doc.__islocal",
+   "description": "",
+   "fieldname": "per_received",
+   "fieldtype": "Percent",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 1,
+   "label": "% Received",
+   "length": 0,
+   "no_copy": 1,
+   "oldfieldname": "per_received",
+   "oldfieldtype": "Currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "depends_on": "eval:!doc.__islocal", 
-   "description": "", 
-   "fieldname": "per_billed", 
-   "fieldtype": "Percent", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "% Billed", 
-   "no_copy": 1, 
-   "oldfieldname": "per_billed", 
-   "oldfieldtype": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "depends_on": "eval:!doc.__islocal",
+   "description": "",
+   "fieldname": "per_billed",
+   "fieldtype": "Percent",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 1,
+   "label": "% Billed",
+   "length": 0,
+   "no_copy": 1,
+   "oldfieldname": "per_billed",
+   "oldfieldtype": "Currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 1, 
-   "fieldname": "column_break5", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Printing Settings", 
-   "no_copy": 0, 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_width": "50%", 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 1,
+   "fieldname": "column_break5",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Printing Settings",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
+   "print_hide": 1,
+   "print_width": "50%",
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
+   "unique": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "letter_head", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Letter Head", 
-   "no_copy": 0, 
-   "oldfieldname": "letter_head", 
-   "oldfieldtype": "Select", 
-   "options": "Letter Head", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 1,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "letter_head",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Letter Head",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "letter_head",
+   "oldfieldtype": "Select",
+   "options": "Letter Head",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "select_print_heading", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "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, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 1,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "select_print_heading",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Print Heading",
+   "length": 0,
+   "no_copy": 1,
+   "oldfieldname": "select_print_heading",
+   "oldfieldtype": "Link",
+   "options": "Print Heading",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 1,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 1, 
-   "collapsible_depends_on": "supplied_items", 
-   "description": "", 
-   "fieldname": "raw_material_details", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Raw Materials Supplied", 
-   "no_copy": 0, 
-   "oldfieldtype": "Section Break", 
-   "options": "icon-truck", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 1,
+   "collapsible_depends_on": "supplied_items",
+   "description": "",
+   "fieldname": "raw_material_details",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Raw Materials Supplied",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldtype": "Section Break",
+   "options": "icon-truck",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "supplied_items", 
-   "fieldtype": "Table", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Supplied Items", 
-   "no_copy": 0, 
-   "oldfieldname": "po_raw_material_details", 
-   "oldfieldtype": "Table", 
-   "options": "Purchase Order Item Supplied", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "supplied_items",
+   "fieldtype": "Table",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Supplied Items",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "po_raw_material_details",
+   "oldfieldtype": "Table",
+   "options": "Purchase Order Item Supplied",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 1, 
-   "collapsible_depends_on": "is_recurring", 
-   "fieldname": "recurring_order", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Recurring", 
-   "no_copy": 0, 
-   "options": "icon-time", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 1,
+   "collapsible_depends_on": "is_recurring",
+   "fieldname": "recurring_order",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Recurring",
+   "length": 0,
+   "no_copy": 0,
+   "options": "icon-time",
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "column_break", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "", 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "column_break",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "depends_on": "eval:doc.docstatus<2", 
-   "description": "", 
-   "fieldname": "is_recurring", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Is Recurring", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 1,
+   "bold": 0,
+   "collapsible": 0,
+   "depends_on": "eval:doc.docstatus<2",
+   "description": "",
+   "fieldname": "is_recurring",
+   "fieldtype": "Check",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Is Recurring",
+   "length": 0,
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "fieldname": "recurring_type", 
-   "fieldtype": "Select", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Recurring Type", 
-   "no_copy": 1, 
-   "options": "Monthly\nQuarterly\nHalf-yearly\nYearly", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 1,
+   "bold": 0,
+   "collapsible": 0,
+   "depends_on": "eval:doc.is_recurring==1",
+   "fieldname": "recurring_type",
+   "fieldtype": "Select",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Recurring Type",
+   "length": 0,
+   "no_copy": 1,
+   "options": "Monthly\nQuarterly\nHalf-yearly\nYearly",
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "Start date of current order's period", 
-   "fieldname": "from_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "From Date", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 1,
+   "bold": 0,
+   "collapsible": 0,
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "Start date of current order's period",
+   "fieldname": "from_date",
+   "fieldtype": "Date",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "From Date",
+   "length": 0,
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "End date of current order's period", 
-   "fieldname": "to_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "To Date", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 1,
+   "bold": 0,
+   "collapsible": 0,
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "End date of current order's period",
+   "fieldname": "to_date",
+   "fieldtype": "Date",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "To Date",
+   "length": 0,
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "The day of the month on which auto order will be generated e.g. 05, 28 etc", 
-   "fieldname": "repeat_on_day_of_month", 
-   "fieldtype": "Int", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Repeat on Day of Month", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 1,
+   "bold": 0,
+   "collapsible": 0,
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "The day of the month on which auto order will be generated e.g. 05, 28 etc",
+   "fieldname": "repeat_on_day_of_month",
+   "fieldtype": "Int",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Repeat on Day of Month",
+   "length": 0,
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "The date on which recurring order will be stop", 
-   "fieldname": "end_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "End Date", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 1,
+   "bold": 0,
+   "collapsible": 0,
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "The date on which recurring order will be stop",
+   "fieldname": "end_date",
+   "fieldtype": "Date",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "End Date",
+   "length": 0,
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "column_break83", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "", 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "column_break83",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "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", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Next Date", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "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",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Next Date",
+   "length": 0,
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "fieldname": "recurring_id", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Recurring Id", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "depends_on": "eval:doc.is_recurring==1",
+   "fieldname": "recurring_id",
+   "fieldtype": "Data",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Recurring Id",
+   "length": 0,
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "description": "Enter email id separated by commas, order will be mailed automatically on particular date", 
-   "fieldname": "notification_email_address", 
-   "fieldtype": "Small Text", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Notification Email Address", 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 1,
+   "bold": 0,
+   "collapsible": 0,
+   "depends_on": "eval:doc.is_recurring==1",
+   "description": "Enter email id separated by commas, order will be mailed automatically on particular date",
+   "fieldname": "notification_email_address",
+   "fieldtype": "Small Text",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Notification Email Address",
+   "length": 0,
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 1,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "depends_on": "eval:doc.is_recurring==1", 
-   "fieldname": "recurring_print_format", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Recurring Print Format", 
-   "no_copy": 0, 
-   "options": "Print Format", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "depends_on": "eval:doc.is_recurring==1",
+   "fieldname": "recurring_print_format",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Recurring Print Format",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Print Format",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
   }
- ], 
- "hide_heading": 0, 
- "hide_toolbar": 0, 
- "icon": "icon-file-text", 
- "idx": 1, 
- "in_create": 0, 
- "in_dialog": 0, 
- "is_submittable": 1, 
- "issingle": 0, 
- "istable": 0, 
- "modified": "2015-11-04 04:44:22.025827", 
- "modified_by": "Administrator", 
- "module": "Buying", 
- "name": "Purchase Order", 
- "owner": "Administrator", 
+ ],
+ "hide_heading": 0,
+ "hide_toolbar": 0,
+ "icon": "icon-file-text",
+ "idx": 1,
+ "in_create": 0,
+ "in_dialog": 0,
+ "is_submittable": 1,
+ "issingle": 0,
+ "istable": 0,
+ "max_attachments": 0,
+ "modified": "2015-11-17 06:29:53.532086",
+ "modified_by": "Administrator",
+ "module": "Buying",
+ "name": "Purchase Order",
+ "owner": "Administrator",
  "permissions": [
   {
-   "amend": 0, 
-   "apply_user_permissions": 0, 
-   "cancel": 0, 
-   "create": 0, 
-   "delete": 0, 
-   "email": 0, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 0, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Stock User", 
-   "set_user_permissions": 0, 
-   "share": 0, 
-   "submit": 0, 
+   "amend": 0,
+   "apply_user_permissions": 0,
+   "cancel": 0,
+   "create": 0,
+   "delete": 0,
+   "email": 0,
+   "export": 0,
+   "if_owner": 0,
+   "import": 0,
+   "permlevel": 0,
+   "print": 0,
+   "read": 1,
+   "report": 1,
+   "role": "Stock User",
+   "set_user_permissions": 0,
+   "share": 0,
+   "submit": 0,
    "write": 0
-  }, 
+  },
   {
-   "amend": 1, 
-   "apply_user_permissions": 0, 
-   "cancel": 1, 
-   "create": 1, 
-   "delete": 1, 
-   "email": 1, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Purchase Manager", 
-   "set_user_permissions": 0, 
-   "share": 1, 
-   "submit": 1, 
+   "amend": 1,
+   "apply_user_permissions": 0,
+   "cancel": 1,
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "export": 0,
+   "if_owner": 0,
+   "import": 0,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Purchase Manager",
+   "set_user_permissions": 0,
+   "share": 1,
+   "submit": 1,
    "write": 1
-  }, 
+  },
   {
-   "amend": 1, 
-   "apply_user_permissions": 0, 
-   "cancel": 1, 
-   "create": 1, 
-   "delete": 1, 
-   "email": 1, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Purchase User", 
-   "set_user_permissions": 0, 
-   "share": 1, 
-   "submit": 1, 
+   "amend": 1,
+   "apply_user_permissions": 0,
+   "cancel": 1,
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "export": 0,
+   "if_owner": 0,
+   "import": 0,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Purchase User",
+   "set_user_permissions": 0,
+   "share": 1,
+   "submit": 1,
    "write": 1
-  }, 
+  },
   {
-   "amend": 0, 
-   "apply_user_permissions": 0, 
-   "cancel": 0, 
-   "create": 0, 
-   "delete": 0, 
-   "email": 1, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Supplier", 
-   "set_user_permissions": 0, 
-   "share": 0, 
-   "submit": 0, 
+   "amend": 0,
+   "apply_user_permissions": 0,
+   "cancel": 0,
+   "create": 0,
+   "delete": 0,
+   "email": 1,
+   "export": 0,
+   "if_owner": 0,
+   "import": 0,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Supplier",
+   "set_user_permissions": 0,
+   "share": 0,
+   "submit": 0,
    "write": 0
-  }, 
+  },
   {
-   "amend": 0, 
-   "apply_user_permissions": 0, 
-   "cancel": 0, 
-   "create": 0, 
-   "delete": 0, 
-   "email": 0, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 1, 
-   "print": 0, 
-   "read": 1, 
-   "report": 0, 
-   "role": "Purchase Manager", 
-   "set_user_permissions": 0, 
-   "share": 0, 
-   "submit": 0, 
+   "amend": 0,
+   "apply_user_permissions": 0,
+   "cancel": 0,
+   "create": 0,
+   "delete": 0,
+   "email": 0,
+   "export": 0,
+   "if_owner": 0,
+   "import": 0,
+   "permlevel": 1,
+   "print": 0,
+   "read": 1,
+   "report": 0,
+   "role": "Purchase Manager",
+   "set_user_permissions": 0,
+   "share": 0,
+   "submit": 0,
    "write": 1
   }
- ], 
- "read_only": 0, 
- "read_only_onload": 1, 
- "search_fields": "status, transaction_date, supplier,grand_total", 
- "sort_field": "modified", 
- "sort_order": "DESC", 
+ ],
+ "read_only": 0,
+ "read_only_onload": 1,
+ "search_fields": "status, transaction_date, supplier,grand_total",
+ "sort_field": "modified",
+ "sort_order": "DESC",
  "title_field": "title"
-}
\ No newline at end of file
+}
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index d069bc0..4670e35 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -51,6 +51,7 @@
 		self.validate_for_subcontracting()
 		self.validate_minimum_order_qty()
 		self.create_raw_materials_supplied("supplied_items")
+		self.set_received_qty_and_billed_amount_for_drop_ship_items()
 
 	def validate_with_previous_doc(self):
 		super(PurchaseOrder, self).validate_with_previous_doc({
@@ -137,9 +138,11 @@
 		"""update requested qty (before ordered_qty is updated)"""
 		item_wh_list = []
 		for d in self.get("items"):
-			if (not po_item_rows or d.name in po_item_rows) and [d.item_code, d.warehouse] not in item_wh_list \
-					and frappe.db.get_value("Item", d.item_code, "is_stock_item") and d.warehouse:
-				item_wh_list.append([d.item_code, d.warehouse])
+			if (not po_item_rows or d.name in po_item_rows) \
+				and [d.item_code, d.warehouse] not in item_wh_list \
+				and frappe.db.get_value("Item", d.item_code, "is_stock_item") \
+				and d.warehouse and not d.delivered_by_supplier:
+					item_wh_list.append([d.item_code, d.warehouse])
 
 		for item_code, warehouse in item_wh_list:
 			update_bin_qty(item_code, warehouse, {
@@ -164,13 +167,13 @@
 		clear_doctype_notifications(self)
 
 	def on_submit(self):
-		if self.delivered_by_supplier == 1:
+		if self.has_drop_ship_item():
 			self.update_status_updater()
 
 		super(PurchaseOrder, self).on_submit()
 
 		purchase_controller = frappe.get_doc("Purchase Common")
-
+		
 		self.update_prevdoc_status()
 		self.update_requested_qty()
 		self.update_ordered_qty()
@@ -181,7 +184,7 @@
 		purchase_controller.update_last_purchase_rate(self, is_submit = 1)
 
 	def on_cancel(self):
-		if self.delivered_by_supplier == 1:
+		if self.has_drop_ship_item():
 			self.update_status_updater()
 
 		pc_obj = frappe.get_doc('Purchase Common')
@@ -234,7 +237,7 @@
 		"""Update delivered qty in Sales Order for drop ship"""
 		sales_orders_to_update = []
 		for item in self.items:
-			if item.prevdoc_doctype == "Sales Order":
+			if item.prevdoc_doctype == "Sales Order" and item.delivered_by_supplier == 1:	
 				if item.prevdoc_docname not in sales_orders_to_update:
 					sales_orders_to_update.append(item.prevdoc_docname)
 
@@ -244,6 +247,21 @@
 			so.set_status(update=True)
 			so.notify_update()
 
+	def has_drop_ship_item(self):
+		is_drop_ship = False
+		
+		for item in self.items:
+			if item.delivered_by_supplier == 1:
+				is_drop_ship = True
+		
+		return is_drop_ship
+	
+	def set_received_qty_and_billed_amount_for_drop_ship_items(self):
+		for item in self.items:
+			if item.delivered_by_supplier == 1:
+				item.received_qty = item.qty
+				item.billed_amt = item.amount
+
 @frappe.whitelist()
 def stop_or_unstop_purchase_orders(names, status):
 	if not frappe.has_permission("Purchase Order", "write"):
@@ -262,7 +280,6 @@
 
 	frappe.local.message_log = []
 
-
 def set_missing_values(source, target):
 	target.ignore_pricing_rule = 1
 	target.run_method("set_missing_values")
@@ -292,7 +309,7 @@
 				"parenttype": "prevdoc_doctype",
 			},
 			"postprocess": update_item,
-			"condition": lambda doc: doc.received_qty < doc.qty
+			"condition": lambda doc: doc.received_qty < doc.qty and doc.delivered_by_supplier!=1
 		},
 		"Purchase Taxes and Charges": {
 			"doctype": "Purchase Taxes and Charges",
@@ -328,7 +345,7 @@
 				"parent": "purchase_order",
 			},
 			"postprocess": update_item,
-			"condition": lambda doc: doc.base_amount==0 or doc.billed_amt < doc.amount
+			"condition": lambda doc: (doc.base_amount==0 or doc.billed_amt < doc.amount) and doc.delivered_by_supplier!=1
 		},
 		"Purchase Taxes and Charges": {
 			"doctype": "Purchase Taxes and Charges",
diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
index af08473..16e09b1 100755
--- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
+++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
@@ -1,1214 +1,1290 @@
 {
- "allow_copy": 0,
- "allow_import": 0,
- "allow_rename": 0,
- "autoname": "hash",
- "creation": "2013-05-24 19:29:06",
- "custom": 0,
- "docstatus": 0,
- "doctype": "DocType",
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "autoname": "hash", 
+ "creation": "2013-05-24 19:29:06", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
  "fields": [
   {
-   "allow_on_submit": 0,
-   "bold": 1,
-   "collapsible": 0,
-   "fieldname": "item_code",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 1,
-   "in_list_view": 1,
-   "label": "Item Code",
-   "no_copy": 0,
-   "oldfieldname": "item_code",
-   "oldfieldtype": "Link",
-   "options": "Item",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 1,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "fieldname": "item_code", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 1, 
+   "in_list_view": 1, 
+   "label": "Item Code", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "item_code", 
+   "oldfieldtype": "Link", 
+   "options": "Item", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 1, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "description": "",
-   "fieldname": "supplier_part_no",
-   "fieldtype": "Data",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Supplier Part Number",
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "description": "", 
+   "fieldname": "supplier_part_no", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Supplier Part Number", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "item_name",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 1,
-   "in_list_view": 1,
-   "label": "Item Name",
-   "no_copy": 0,
-   "oldfieldname": "item_name",
-   "oldfieldtype": "Data",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 1,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "item_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 1, 
+   "in_list_view": 1, 
+   "label": "Item Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "item_name", 
+   "oldfieldtype": "Data", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 1, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "column_break_4",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "column_break_4", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 1,
-   "collapsible": 0,
-   "fieldname": "schedule_date",
-   "fieldtype": "Date",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 1,
-   "in_list_view": 1,
-   "label": "Reqd By Date",
-   "no_copy": 0,
-   "oldfieldname": "schedule_date",
-   "oldfieldtype": "Date",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 1,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "fieldname": "schedule_date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 1, 
+   "in_list_view": 1, 
+   "label": "Reqd By Date", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "schedule_date", 
+   "oldfieldtype": "Date", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 1, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "fieldname": "section_break_5",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Description",
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "fieldname": "section_break_5", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Description", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "description",
-   "fieldtype": "Text Editor",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Description",
-   "no_copy": 0,
-   "oldfieldname": "description",
-   "oldfieldtype": "Small Text",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_width": "300px",
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "description", 
+   "fieldtype": "Text Editor", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Description", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "description", 
+   "oldfieldtype": "Small Text", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_width": "300px", 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "300px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "col_break1",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "col_break1", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "image",
-   "fieldtype": "Attach",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Image",
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "image", 
+   "fieldtype": "Attach", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Image", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "image_view",
-   "fieldtype": "Image",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Image View",
-   "no_copy": 0,
-   "options": "image",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "image_view", 
+   "fieldtype": "Image", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Image View", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "image", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "quantity_and_rate",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Quantity and Rate",
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "quantity_and_rate", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Quantity and Rate", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 1,
-   "collapsible": 0,
-   "fieldname": "qty",
-   "fieldtype": "Float",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "Quantity",
-   "no_copy": 0,
-   "oldfieldname": "qty",
-   "oldfieldtype": "Currency",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_width": "60px",
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "fieldname": "qty", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Quantity", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "qty", 
+   "oldfieldtype": "Currency", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_width": "60px", 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "60px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "stock_uom",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "Stock UOM",
-   "no_copy": 0,
-   "oldfieldname": "stock_uom",
-   "oldfieldtype": "Data",
-   "options": "UOM",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_width": "100px",
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "stock_uom", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Stock UOM", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "stock_uom", 
+   "oldfieldtype": "Data", 
+   "options": "UOM", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_width": "100px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "100px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "col_break2",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "col_break2", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "uom",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "UOM",
-   "no_copy": 0,
-   "oldfieldname": "uom",
-   "oldfieldtype": "Link",
-   "options": "UOM",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_width": "100px",
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "uom", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "UOM", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "uom", 
+   "oldfieldtype": "Link", 
+   "options": "UOM", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_width": "100px", 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "100px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "conversion_factor",
-   "fieldtype": "Float",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "UOM Conversion Factor",
-   "no_copy": 0,
-   "oldfieldname": "conversion_factor",
-   "oldfieldtype": "Currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_width": "100px",
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "conversion_factor", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "UOM Conversion Factor", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "conversion_factor", 
+   "oldfieldtype": "Currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_width": "100px", 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "100px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "sec_break1",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "sec_break1", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "price_list_rate",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Price List Rate",
-   "no_copy": 0,
-   "options": "currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "price_list_rate", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Price List Rate", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "depends_on": "price_list_rate",
-   "fieldname": "discount_percentage",
-   "fieldtype": "Percent",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "Discount on Price List Rate (%)",
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "depends_on": "price_list_rate", 
+   "fieldname": "discount_percentage", 
+   "fieldtype": "Percent", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Discount on Price List Rate (%)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "col_break3",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "col_break3", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "base_price_list_rate",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Price List Rate (Company Currency)",
-   "no_copy": 0,
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "base_price_list_rate", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Price List Rate (Company Currency)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "sec_break2",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "sec_break2", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 1,
-   "collapsible": 0,
-   "fieldname": "rate",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "Rate ",
-   "no_copy": 0,
-   "oldfieldname": "import_rate",
-   "oldfieldtype": "Currency",
-   "options": "currency",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "fieldname": "rate", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Rate ", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "import_rate", 
+   "oldfieldtype": "Currency", 
+   "options": "currency", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "amount",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "Amount",
-   "no_copy": 0,
-   "oldfieldname": "import_amount",
-   "oldfieldtype": "Currency",
-   "options": "currency",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Amount", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "import_amount", 
+   "oldfieldtype": "Currency", 
+   "options": "currency", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "col_break4",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "col_break4", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "base_rate",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Rate (Company Currency)",
-   "no_copy": 0,
-   "oldfieldname": "purchase_rate",
-   "oldfieldtype": "Currency",
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_width": "100px",
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "base_rate", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Rate (Company Currency)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "purchase_rate", 
+   "oldfieldtype": "Currency", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_width": "100px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "100px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "base_amount",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Amount (Company Currency)",
-   "no_copy": 0,
-   "oldfieldname": "amount",
-   "oldfieldtype": "Currency",
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "base_amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Amount (Company Currency)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "amount", 
+   "oldfieldtype": "Currency", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "pricing_rule",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Pricing Rule",
-   "no_copy": 0,
-   "options": "Pricing Rule",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "pricing_rule", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Pricing Rule", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Pricing Rule", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "section_break_29",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "section_break_29", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "net_rate",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Net Rate",
-   "no_copy": 0,
-   "options": "currency",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "net_rate", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Net Rate", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "net_amount",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Net Amount",
-   "no_copy": 0,
-   "options": "currency",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "net_amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Net Amount", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "column_break_32",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "column_break_32", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "base_net_rate",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Net Rate (Company Currency)",
-   "no_copy": 0,
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "base_net_rate", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Net Rate (Company Currency)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "base_net_amount",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Net Amount (Company Currency)",
-   "no_copy": 0,
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "base_net_amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Net Amount (Company Currency)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "warehouse_and_reference",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Warehouse and Reference",
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "warehouse_and_reference", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Warehouse and Reference", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "warehouse",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "Warehouse",
-   "no_copy": 0,
-   "oldfieldname": "warehouse",
-   "oldfieldtype": "Link",
-   "options": "Warehouse",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "warehouse", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Warehouse", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "warehouse", 
+   "oldfieldtype": "Link", 
+   "options": "Warehouse", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "project_name",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 1,
-   "in_list_view": 0,
-   "label": "Project Name",
-   "no_copy": 0,
-   "options": "Project",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "project_name", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "Project Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Project", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "prevdoc_doctype",
-   "fieldtype": "Link",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Reference Document Type",
-   "no_copy": 1,
-   "oldfieldname": "prevdoc_doctype",
-   "oldfieldtype": "Data",
-   "options": "DocType",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "prevdoc_doctype", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Reference Document Type", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "prevdoc_doctype", 
+   "oldfieldtype": "Data", 
+   "options": "DocType", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "prevdoc_docname",
-   "fieldtype": "Dynamic Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 1,
-   "in_list_view": 0,
-   "label": "Reference Name",
-   "no_copy": 1,
-   "oldfieldname": "prevdoc_docname",
-   "oldfieldtype": "Link",
-   "options": "prevdoc_doctype",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_width": "120px",
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 1,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "prevdoc_docname", 
+   "fieldtype": "Dynamic Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "Reference Name", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "prevdoc_docname", 
+   "oldfieldtype": "Link", 
+   "options": "prevdoc_doctype", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_width": "120px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "120px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "prevdoc_detail_docname",
-   "fieldtype": "Data",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "in_filter": 1,
-   "in_list_view": 0,
-   "label": "Material Request Detail No",
-   "no_copy": 1,
-   "oldfieldname": "prevdoc_detail_docname",
-   "oldfieldtype": "Data",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 1,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "prevdoc_detail_docname", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "Material Request Detail No", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "prevdoc_detail_docname", 
+   "oldfieldtype": "Data", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "supplier_quotation",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Supplier Quotation",
-   "no_copy": 1,
-   "options": "Supplier Quotation",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "supplier_quotation", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Supplier Quotation", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Supplier Quotation", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "supplier_quotation_item",
-   "fieldtype": "Link",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Supplier Quotation Item",
-   "no_copy": 1,
-   "options": "Supplier Quotation Item",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "supplier_quotation_item", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Supplier Quotation Item", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Supplier Quotation Item", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "col_break5",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "delivered_by_supplier", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "To be delivered to customer", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "description": "",
-   "fieldname": "item_group",
-   "fieldtype": "Link",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "in_filter": 1,
-   "in_list_view": 0,
-   "label": "Item Group",
-   "no_copy": 0,
-   "oldfieldname": "item_group",
-   "oldfieldtype": "Link",
-   "options": "Item Group",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "col_break5", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "brand",
-   "fieldtype": "Link",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Brand",
-   "no_copy": 0,
-   "oldfieldname": "brand",
-   "oldfieldtype": "Link",
-   "options": "Brand",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "description": "", 
+   "fieldname": "item_group", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "Item Group", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "item_group", 
+   "oldfieldtype": "Link", 
+   "options": "Item Group", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "bom",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "BOM",
-   "no_copy": 1,
-   "options": "BOM",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "brand", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Brand", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "brand", 
+   "oldfieldtype": "Link", 
+   "options": "Brand", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "stock_qty",
-   "fieldtype": "Float",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Qty as per Stock UOM",
-   "no_copy": 1,
-   "oldfieldname": "stock_qty",
-   "oldfieldtype": "Currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_width": "100px",
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "bom", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "BOM", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "BOM", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "stock_qty", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Qty as per Stock UOM", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "stock_qty", 
+   "oldfieldtype": "Currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_width": "100px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "100px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "received_qty",
-   "fieldtype": "Float",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Received Qty",
-   "no_copy": 1,
-   "oldfieldname": "received_qty",
-   "oldfieldtype": "Currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "received_qty", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Received Qty", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "received_qty", 
+   "oldfieldtype": "Currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "depends_on": "returned_qty",
-   "fieldname": "returned_qty",
-   "fieldtype": "Float",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Returned Qty",
-   "no_copy": 1,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "depends_on": "returned_qty", 
+   "fieldname": "returned_qty", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Returned Qty", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "billed_amt",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Billed Amt",
-   "no_copy": 1,
-   "options": "currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "billed_amt", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Billed Amt", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges",
-   "fieldname": "item_tax_rate",
-   "fieldtype": "Small Text",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Item Tax Rate",
-   "no_copy": 0,
-   "oldfieldname": "item_tax_rate",
-   "oldfieldtype": "Small Text",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 1,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges", 
+   "fieldname": "item_tax_rate", 
+   "fieldtype": "Small Text", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Item Tax Rate", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "item_tax_rate", 
+   "oldfieldtype": "Small Text", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 1, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 1,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "page_break",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Page Break",
-   "no_copy": 1,
-   "oldfieldname": "page_break",
-   "oldfieldtype": "Check",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "page_break", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Page Break", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "page_break", 
+   "oldfieldtype": "Check", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
   }
- ],
- "hide_heading": 0,
- "hide_toolbar": 0,
- "idx": 1,
- "in_create": 0,
- "in_dialog": 0,
- "is_submittable": 0,
- "issingle": 0,
- "istable": 1,
- "modified": "2015-10-19 03:04:51.773012",
- "modified_by": "Administrator",
- "module": "Buying",
- "name": "Purchase Order Item",
- "owner": "Administrator",
- "permissions": [],
- "read_only": 0,
- "read_only_onload": 0,
- "sort_field": "modified",
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 1, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2015-11-19 02:53:19.301428", 
+ "modified_by": "Administrator", 
+ "module": "Buying", 
+ "name": "Purchase Order Item", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "sort_field": "modified", 
  "sort_order": "DESC"
-}
+}
\ No newline at end of file
diff --git a/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.json b/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.json
index 488f382..bad9e0e 100644
--- a/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.json
+++ b/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "main_item_code", 
    "oldfieldtype": "Data", 
@@ -41,6 +42,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Raw Material Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "rm_item_code", 
    "oldfieldtype": "Data", 
@@ -64,6 +66,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Supplied Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "required_qty", 
    "oldfieldtype": "Currency", 
@@ -87,6 +90,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "rate", 
    "oldfieldtype": "Currency", 
@@ -111,6 +115,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "amount", 
    "oldfieldtype": "Currency", 
@@ -135,6 +140,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "BOM Detail No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "bom_detail_no", 
    "oldfieldtype": "Data", 
@@ -158,6 +164,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Reference Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "reference_name", 
    "oldfieldtype": "Data", 
@@ -181,6 +188,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Conversion Factor", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "conversion_factor", 
    "oldfieldtype": "Currency", 
@@ -204,6 +212,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Stock Uom", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "stock_uom", 
    "oldfieldtype": "Data", 
@@ -226,7 +235,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:05.021801", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:54.025077", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Purchase Order Item Supplied", 
diff --git a/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.json b/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.json
index 8911e51..070909d 100644
--- a/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.json
+++ b/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "main_item_code", 
    "oldfieldtype": "Data", 
@@ -41,6 +42,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Raw Material Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "rm_item_code", 
    "oldfieldtype": "Data", 
@@ -64,6 +66,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Data", 
@@ -89,6 +92,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Batch No", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Batch", 
    "permlevel": 0, 
@@ -111,6 +115,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Serial No", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -131,6 +136,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -152,6 +158,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Required Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "required_qty", 
    "oldfieldtype": "Currency", 
@@ -175,6 +182,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Consumed Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "consumed_qty", 
    "oldfieldtype": "Currency", 
@@ -198,6 +206,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Stock Uom", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "stock_uom", 
    "oldfieldtype": "Data", 
@@ -222,6 +231,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "rate", 
    "oldfieldtype": "Currency", 
@@ -246,6 +256,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "amount", 
    "oldfieldtype": "Currency", 
@@ -270,6 +281,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Conversion Factor", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "conversion_factor", 
    "oldfieldtype": "Currency", 
@@ -293,6 +305,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Current Stock", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "current_stock", 
    "oldfieldtype": "Currency", 
@@ -316,6 +329,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Reference Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "reference_name", 
    "oldfieldtype": "Data", 
@@ -339,6 +353,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "BOM Detail No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "bom_detail_no", 
    "oldfieldtype": "Data", 
@@ -360,7 +375,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:06.224300", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:54.573531", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Purchase Receipt Item Supplied", 
diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.json b/erpnext/buying/doctype/quality_inspection/quality_inspection.json
index 193866e..ba5396c 100644
--- a/erpnext/buying/doctype/quality_inspection/quality_inspection.json
+++ b/erpnext/buying/doctype/quality_inspection/quality_inspection.json
@@ -18,7 +18,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Series",  
+   "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "QI-", 
    "permlevel": 0, 
@@ -42,6 +43,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Report Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "report_date", 
    "oldfieldtype": "Date", 
@@ -64,6 +66,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -85,7 +88,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
-   "label": "Inspection Type",  
+   "label": "Inspection Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "inspection_type", 
    "oldfieldtype": "Select", 
@@ -110,6 +114,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Purchase Receipt No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "purchase_receipt_no", 
    "oldfieldtype": "Link", 
@@ -134,6 +139,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Delivery Note No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "delivery_note_no", 
    "oldfieldtype": "Link", 
@@ -157,6 +163,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -179,6 +186,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -203,6 +211,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Serial No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_serial_no", 
    "oldfieldtype": "Link", 
@@ -227,6 +236,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Batch No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "batch_no", 
    "oldfieldtype": "Link", 
@@ -251,6 +261,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sample Size", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "sample_size", 
    "oldfieldtype": "Currency", 
@@ -273,6 +284,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -296,6 +308,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -318,6 +331,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Small Text", 
@@ -341,6 +355,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -364,6 +379,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Inspected By", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "inspected_by", 
    "oldfieldtype": "Data", 
@@ -388,6 +404,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Verified By", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "verified_by", 
    "oldfieldtype": "Data", 
@@ -410,6 +427,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -432,6 +450,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Remarks", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "remarks", 
    "oldfieldtype": "Text", 
@@ -455,6 +474,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Data", 
@@ -479,6 +499,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "Simple", 
@@ -502,6 +523,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Get Specification Details", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "get_item_specification_details", 
    "permlevel": 0, 
@@ -524,6 +546,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Readings", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "qa_specification_details", 
    "oldfieldtype": "Table", 
@@ -547,7 +570,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:06.674821", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:54.786379", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Quality Inspection", 
diff --git a/erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.json b/erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.json
index 2650268..046d79d 100644
--- a/erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.json
+++ b/erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Parameter", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "specification", 
    "oldfieldtype": "Data", 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Acceptance Criteria", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "value", 
    "oldfieldtype": "Data", 
@@ -65,6 +67,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Reading 1", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "reading_1", 
    "oldfieldtype": "Data", 
@@ -88,6 +91,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Reading 2", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "reading_2", 
    "oldfieldtype": "Data", 
@@ -111,6 +115,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Reading 3", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "reading_3", 
    "oldfieldtype": "Data", 
@@ -134,6 +139,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Reading 4", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "reading_4", 
    "oldfieldtype": "Data", 
@@ -157,6 +163,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reading 5", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "reading_5", 
    "oldfieldtype": "Data", 
@@ -180,6 +187,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reading 6", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "reading_6", 
    "oldfieldtype": "Data", 
@@ -203,6 +211,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reading 7", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "reading_7", 
    "oldfieldtype": "Data", 
@@ -226,6 +235,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reading 8", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "reading_8", 
    "oldfieldtype": "Data", 
@@ -249,6 +259,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reading 9", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "reading_9", 
    "oldfieldtype": "Data", 
@@ -272,6 +283,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reading 10", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "reading_10", 
    "oldfieldtype": "Data", 
@@ -295,7 +307,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "status", 
    "oldfieldtype": "Select", 
@@ -318,7 +331,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:06.876419", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:54.873250", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Quality Inspection Reading", 
diff --git a/erpnext/buying/doctype/supplier/supplier.json b/erpnext/buying/doctype/supplier/supplier.json
index 36c8be2..23ae746 100644
--- a/erpnext/buying/doctype/supplier/supplier.json
+++ b/erpnext/buying/doctype/supplier/supplier.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-user", 
@@ -43,7 +44,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Series",  
+   "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "naming_series", 
    "oldfieldtype": "Select", 
@@ -68,6 +70,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier Name", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "supplier_name", 
    "oldfieldtype": "Data", 
@@ -90,6 +93,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -112,6 +116,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Supplier Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "supplier_type", 
    "oldfieldtype": "Link", 
@@ -136,6 +141,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Frozen", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -157,6 +163,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -179,6 +186,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Billing Currency", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Currency", 
    "permlevel": 0, 
@@ -201,6 +209,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Price List", 
    "permlevel": 0, 
@@ -222,6 +231,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -244,6 +254,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Purchase Taxes and Charges Template", 
    "permlevel": 0, 
@@ -266,6 +277,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Credit Days", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -288,6 +300,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address and Contacts", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "options": "icon-map-marker", 
@@ -311,6 +324,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address HTML", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -331,6 +345,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -353,6 +368,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact HTML", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -375,6 +391,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Payable Accounts", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -398,6 +415,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Accounts", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Party Account", 
    "permlevel": 0, 
@@ -421,6 +439,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier Details", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -443,6 +462,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Website", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "website", 
    "oldfieldtype": "Data", 
@@ -467,6 +487,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier Details", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "supplier_details", 
    "oldfieldtype": "Code", 
@@ -490,6 +511,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Communications", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Communication", 
    "permlevel": 0, 
@@ -511,7 +533,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:14.767820", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:58.500467", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Supplier", 
diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py
index 6ae0a2e..f010626 100644
--- a/erpnext/buying/doctype/supplier/supplier.py
+++ b/erpnext/buying/doctype/supplier/supplier.py
@@ -93,7 +93,7 @@
 			{"supplier": supplier, "docstatus": ["!=", 2] }, "count(*)")
 
 	billing_this_year = frappe.db.sql("""
-		select sum(ifnull(credit_in_account_currency, 0)) - sum(ifnull(debit_in_account_currency, 0))
+		select sum(credit_in_account_currency) - sum(debit_in_account_currency)
 		from `tabGL Entry`
 		where voucher_type='Purchase Invoice' and party_type = 'Supplier'
 			and party=%s and fiscal_year = %s""",
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
index 5f95e91..df25b23 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-user", 
    "permlevel": 0, 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Title", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -64,7 +66,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Series",  
+   "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "naming_series", 
    "oldfieldtype": "Select", 
@@ -90,6 +93,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Supplier", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "supplier", 
    "oldfieldtype": "Link", 
@@ -114,6 +118,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -135,6 +140,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -156,6 +162,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -177,6 +184,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Mobile No", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -198,6 +206,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Email", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -218,6 +227,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -242,6 +252,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "transaction_date", 
    "oldfieldtype": "Date", 
@@ -265,6 +276,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Data", 
@@ -290,6 +302,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -314,6 +327,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Currency and Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-tag", 
    "permlevel": 0, 
@@ -336,6 +350,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "currency", 
    "oldfieldtype": "Select", 
@@ -361,6 +376,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Exchange Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "conversion_rate", 
    "oldfieldtype": "Currency", 
@@ -384,6 +400,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -407,6 +424,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Price List", 
    "permlevel": 0, 
@@ -430,6 +448,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Currency", 
    "permlevel": 0, 
@@ -453,6 +472,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Exchange Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "9", 
@@ -475,6 +495,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Ignore Pricing Rule", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 1, 
    "print_hide": 1, 
@@ -496,6 +517,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-shopping-cart", 
@@ -519,6 +541,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Items", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "po_details", 
    "oldfieldtype": "Table", 
@@ -542,6 +565,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -563,6 +587,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -586,6 +611,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "net_total", 
    "oldfieldtype": "Currency", 
@@ -609,6 +635,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -630,6 +657,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -653,6 +681,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Total", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "net_total_import", 
    "oldfieldtype": "Currency", 
@@ -677,6 +706,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-money", 
@@ -701,6 +731,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "purchase_other_charges", 
    "oldfieldtype": "Link", 
@@ -725,6 +756,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Purchase Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "purchase_tax_details", 
    "oldfieldtype": "Table", 
@@ -749,6 +781,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges Calculation", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldtype": "HTML", 
    "permlevel": 0, 
@@ -771,6 +804,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-money", 
@@ -794,6 +828,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges Added (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges_added", 
    "oldfieldtype": "Currency", 
@@ -818,6 +853,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges Deducted (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges_deducted", 
    "oldfieldtype": "Currency", 
@@ -842,6 +878,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Taxes and Charges (Company Currency)", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "total_tax", 
    "oldfieldtype": "Currency", 
@@ -865,6 +902,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -887,6 +925,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges Added", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges_added_import", 
    "oldfieldtype": "Currency", 
@@ -911,6 +950,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges Deducted", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges_deducted_import", 
    "oldfieldtype": "Currency", 
@@ -935,6 +975,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -959,6 +1000,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -981,7 +1023,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Apply Additional Discount On",  
+   "label": "Apply Additional Discount On", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nGrand Total\nNet Total", 
    "permlevel": 0, 
@@ -1004,6 +1047,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1026,6 +1070,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -1049,6 +1094,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -1071,6 +1117,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1093,6 +1140,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Grand Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "grand_total", 
    "oldfieldtype": "Currency", 
@@ -1118,6 +1166,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "In Words (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "in_words", 
    "oldfieldtype": "Data", 
@@ -1141,6 +1190,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rounded Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "rounded_total", 
    "oldfieldtype": "Currency", 
@@ -1164,6 +1214,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -1186,6 +1237,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Grand Total", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "grand_total_import", 
    "oldfieldtype": "Currency", 
@@ -1210,6 +1262,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "In Words", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "in_words_import", 
    "oldfieldtype": "Data", 
@@ -1234,6 +1287,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms and Conditions", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-legal", 
@@ -1257,6 +1311,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "tc_name", 
    "oldfieldtype": "Link", 
@@ -1281,6 +1336,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms and Conditions", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "terms", 
    "oldfieldtype": "Text Editor", 
@@ -1305,6 +1361,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Details", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-bullhorn", 
    "permlevel": 0, 
@@ -1327,6 +1384,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Supplier Address", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Address", 
    "permlevel": 0, 
@@ -1349,6 +1407,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Contact Person", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Contact", 
    "permlevel": 0, 
@@ -1371,6 +1430,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Printing Settings", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1393,6 +1453,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Print Heading", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "select_print_heading", 
    "oldfieldtype": "Link", 
@@ -1417,6 +1478,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Letter Head", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "letter_head", 
    "oldfieldtype": "Select", 
@@ -1441,6 +1503,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "More Information", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-file-text", 
@@ -1463,7 +1526,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "status", 
    "oldfieldtype": "Select", 
@@ -1488,7 +1552,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Is Subcontracted",  
+   "label": "Is Subcontracted", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nYes\nNo", 
    "permlevel": 0, 
@@ -1510,6 +1575,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1531,6 +1597,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -1554,7 +1621,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:15.027459", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:58.617934", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Supplier Quotation", 
diff --git a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
index ce1aaa3..7ee47c4 100644
--- a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
+++ b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
@@ -19,6 +19,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier Part Number", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -64,6 +66,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -86,6 +89,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_name", 
    "oldfieldtype": "Data", 
@@ -109,6 +113,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -131,6 +136,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Small Text", 
@@ -155,6 +161,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -176,6 +183,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -198,6 +206,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image View", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "image", 
    "permlevel": 0, 
@@ -221,6 +230,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Quantity and Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -242,6 +252,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Quantity", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "qty", 
    "oldfieldtype": "Currency", 
@@ -267,6 +278,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -290,6 +302,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Discount on Price List Rate (%)", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -310,6 +323,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -331,6 +345,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "uom", 
    "oldfieldtype": "Link", 
@@ -357,6 +372,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Rate (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -378,6 +394,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -399,6 +416,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Rate ", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "import_rate", 
    "oldfieldtype": "Currency", 
@@ -423,6 +441,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "import_amount", 
    "oldfieldtype": "Currency", 
@@ -446,6 +465,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -467,6 +487,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rate (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "purchase_rate", 
    "oldfieldtype": "Currency", 
@@ -493,6 +514,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "amount", 
    "oldfieldtype": "Currency", 
@@ -517,6 +539,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Pricing Rule", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Pricing Rule", 
    "permlevel": 0, 
@@ -538,6 +561,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -560,6 +584,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -582,6 +607,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -604,6 +630,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -626,6 +653,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Rate (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -649,6 +677,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -672,6 +701,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Warehouse and Reference", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -693,6 +723,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "warehouse", 
    "oldfieldtype": "Link", 
@@ -717,6 +748,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Project Name", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Project", 
    "permlevel": 0, 
@@ -739,6 +771,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Prevdoc DocType", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "prevdoc_doctype", 
    "oldfieldtype": "Data", 
@@ -762,6 +795,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Material Request No", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "prevdoc_docname", 
    "oldfieldtype": "Link", 
@@ -787,6 +821,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -808,6 +843,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Material Request Detail No", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "prevdoc_detail_docname", 
    "oldfieldtype": "Data", 
@@ -831,6 +867,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Brand", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "brand", 
    "oldfieldtype": "Link", 
@@ -856,6 +893,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Item Group", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_group", 
    "oldfieldtype": "Link", 
@@ -881,6 +919,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Tax Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_tax_rate", 
    "oldfieldtype": "Small Text", 
@@ -904,6 +943,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Page Break", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "page_break", 
    "oldfieldtype": "Check", 
@@ -925,7 +965,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-19 03:04:51.597343", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:58.833849", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Supplier Quotation Item", 
diff --git a/erpnext/config/docs.py b/erpnext/config/docs.py
index d85dc1d..dc771bc 100644
--- a/erpnext/config/docs.py
+++ b/erpnext/config/docs.py
@@ -2,22 +2,18 @@
 docs_base_url = "https://frappe.github.io/erpnext"
 headline = "Learn ERPNext Inside Out"
 sub_heading = "Find detailed explanation for all ERPNext features"
-long_description = """
-ERPNext helps you to manage all your business information in one application and use it to manage operations and take decisions based on data.
+long_description = """ERPNext is a fully featured ERP system designed for Small and Medium Sized
+business. ERPNext covers a wide range of features including Accounting, CRM,
+Inventory management, Selling, Purchasing, Manufacturing, Projects, HR &
+Payroll, Website, E-Commerce and much more.
 
-Among other things, ERPNext will help you to:
+ERPNext is based on the Frappe Framework is highly customizable and extendable.
+You can create Custom Form, Fields, Scripts and can also create your own Apps
+to extend ERPNext functionality.
 
-- Track all Invoices and Payments.
-- Know what quantity of which product is available in stock.
-- Identify open customer queries.
-- Manage payroll.
-- Assign tasks and follow up on them.
-- Maintain a database of all your customers, suppliers and their contacts.
-- Prepare quotes.
-- Get reminders on maintenance schedules.
-- Publish your website.
-
-And a lot lot lot more."""
+ERPNext is Open Source under the GNU General Public Licence v3 and has been
+listed as one of the Best Open Source Softwares in the world by my online
+blogs."""
 
 def get_context(context):
 	context.top_bar_items = [
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 5b06f1c..65f39aa 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -152,13 +152,14 @@
 					ret = get_item_details(args)
 
 					for fieldname, value in ret.items():
-						if item.meta.get_field(fieldname) and \
-							(item.get(fieldname) is None or fieldname in force_item_fields) \
-								and value is not None:
+						if item.meta.get_field(fieldname) and value is not None:
+							if (item.get(fieldname) is None or fieldname in force_item_fields):
 								item.set(fieldname, value)
 
-						if fieldname == "cost_center" and item.meta.get_field("cost_center") \
-							and not item.get("cost_center") and value is not None:
+							elif fieldname == "cost_center" and not item.get("cost_center"):
+								item.set(fieldname, value)
+
+							elif fieldname == "conversion_factor" and not item.get("conversion_factor"):
 								item.set(fieldname, value)
 
 					if ret.get("pricing_rule"):
@@ -257,7 +258,7 @@
 		self.set(parentfield, self.get(parentfield, {"allocated_amount": ["not in", [0, None, ""]]}))
 
 		frappe.db.sql("""delete from `tab%s` where parentfield=%s and parent = %s
-			and ifnull(allocated_amount, 0) = 0""" % (childtype, '%s', '%s'), (parentfield, self.name))
+			and allocated_amount = 0""" % (childtype, '%s', '%s'), (parentfield, self.name))
 
 	def get_advances(self, account_head, party_type, party, child_doctype, parentfield, dr_or_cr, against_order_field):
 		"""Returns list of advances against Account, Party, Reference"""
@@ -375,7 +376,7 @@
 
 		advance_paid = frappe.db.sql("""
 			select
-				sum(ifnull({dr_or_cr}, 0))
+				sum({dr_or_cr})
 			from
 				`tabJournal Entry Account`
 			where
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index 5ccf29d..c9b660d 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -52,15 +52,6 @@
 					self.supplier = supplier
 					break
 
-	def validate_warehouse(self):
-		from erpnext.stock.utils import validate_warehouse_company
-
-		warehouses = list(set([d.warehouse for d in
-			self.get("items") if getattr(d, "warehouse", None)]))
-
-		for w in warehouses:
-			validate_warehouse_company(w, self.company)
-
 	def validate_stock_or_nonstock_items(self):
 		if self.meta.get_field("taxes") and not self.get_stock_items():
 			tax_for_valuation = [d.account_head for d in self.get("taxes")
@@ -234,7 +225,7 @@
 
 	def get_items_from_bom(self, item_code, bom):
 		bom_items = frappe.db.sql("""select t2.item_code,
-			ifnull(t2.qty, 0) / ifnull(t1.quantity, 1) as qty_consumed_per_unit,
+			t2.qty / ifnull(t1.quantity, 1) as qty_consumed_per_unit,
 			t2.rate, t2.stock_uom, t2.name, t2.description
 			from `tabBOM` t1, `tabBOM Item` t2, tabItem t3
 			where t2.parent = t1.name and t1.item = %s
diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py
index 0af0b81..3c262f1 100644
--- a/erpnext/controllers/queries.py
+++ b/erpnext/controllers/queries.py
@@ -165,7 +165,7 @@
 			concat(substr(tabItem.description, 1, 40), "..."), description) as decription
 		from tabItem
 		where tabItem.docstatus < 2
-			and ifnull(tabItem.has_variants, 0)=0
+			and tabItem.has_variants=0
 			and tabItem.disabled=0
 			and (tabItem.end_of_life > %(today)s or ifnull(tabItem.end_of_life, '0000-00-00')='0000-00-00')
 			and (tabItem.`{key}` LIKE %(txt)s
diff --git a/erpnext/controllers/recurring_document.py b/erpnext/controllers/recurring_document.py
index 41fd8b2..fa6c1cc 100644
--- a/erpnext/controllers/recurring_document.py
+++ b/erpnext/controllers/recurring_document.py
@@ -37,7 +37,7 @@
 	condition = " and ifnull(status, '') != 'Stopped'" if doctype in ("Sales Order", "Purchase Order") else ""
 
 	recurring_documents = frappe.db.sql("""select name, recurring_id
-		from `tab{0}` where ifnull(is_recurring, 0)=1
+		from `tab{0}` where is_recurring=1
 		and docstatus=1 and next_date=%s
 		and next_date <= ifnull(end_date, '2199-12-31') {1}""".format(doctype, condition), next_date)
 
diff --git a/erpnext/controllers/sales_and_purchase_return.py b/erpnext/controllers/sales_and_purchase_return.py
index f4895ca..c6c7111 100644
--- a/erpnext/controllers/sales_and_purchase_return.py
+++ b/erpnext/controllers/sales_and_purchase_return.py
@@ -110,7 +110,7 @@
 			`tab{0} Item` child, `tab{1}` par
 		where
 			child.parent = par.name and par.docstatus = 1
-			and ifnull(par.is_return, 0) = 1 and par.return_against = %s and child.qty < 0
+			and par.is_return = 1 and par.return_against = %s and child.qty < 0
 		group by item_code
 	""".format(doc.doctype, doc.doctype), doc.return_against))
 
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 1ed8b8a..895f146 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -202,7 +202,7 @@
 			
 		delivered_via_si = frappe.db.sql("""select sum(si_item.qty) 
 			from `tabSales Invoice Item` si_item, `tabSales Invoice` si
-			where si_item.parent = si.name and ifnull(si.update_stock, 0) = 1
+			where si_item.parent = si.name and si.update_stock = 1
 			and si_item.so_detail = %s and si.docstatus = 1 
 			and si_item.sales_order = %s
 			and si.name != %s""", (so_detail, so, current_docname))
diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py
index f221fc2..503aa93 100644
--- a/erpnext/controllers/status_updater.py
+++ b/erpnext/controllers/status_updater.py
@@ -229,7 +229,7 @@
 			if args.get('target_parent_field'):
 				frappe.db.sql("""update `tab%(target_parent_dt)s`
 					set %(target_parent_field)s = round((select sum(if(%(target_ref_field)s >
-						ifnull(%(target_field)s, 0), %(target_field)s,
+						%(target_field)s, %(target_field)s,
 						%(target_ref_field)s))/sum(%(target_ref_field)s)*100
 						from `tab%(target_dt)s` where parent="%(name)s"), 2) %(set_modified)s
 					where name='%(name)s'""" % args)
@@ -237,7 +237,7 @@
 			# update field
 			if args.get('status_field'):
 				frappe.db.sql("""update `tab%(target_parent_dt)s`
-					set %(status_field)s = if(ifnull(%(target_parent_field)s,0)<0.001,
+					set %(status_field)s = if(%(target_parent_field)s<0.001,
 						'Not %(keyword)s', if(%(target_parent_field)s>=99.99,
 						'Fully %(keyword)s', 'Partly %(keyword)s'))
 					where name='%(name)s'""" % args)
@@ -264,10 +264,10 @@
 
 	def update_billing_status(self, zero_amount_refdoc, ref_dt, ref_fieldname):
 		for ref_dn in zero_amount_refdoc:
-			ref_doc_qty = flt(frappe.db.sql("""select sum(ifnull(qty, 0)) from `tab%s Item`
+			ref_doc_qty = flt(frappe.db.sql("""select sum(qty) from `tab%s Item`
 				where parent=%s""" % (ref_dt, '%s'), (ref_dn))[0][0])
 
-			billed_qty = flt(frappe.db.sql("""select sum(ifnull(qty, 0))
+			billed_qty = flt(frappe.db.sql("""select sum(qty)
 				from `tab%s Item` where %s=%s and docstatus=1""" %
 				(self.doctype, ref_fieldname, '%s'), (ref_dn))[0][0])
 
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index 2a9fa17..6e860c5 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -221,7 +221,7 @@
 	def get_incoming_rate_for_sales_return(self, item_code, warehouse, against_document):
 		incoming_rate = 0.0
 		if against_document and item_code:
-			incoming_rate = frappe.db.sql("""select abs(ifnull(stock_value_difference, 0) / actual_qty)
+			incoming_rate = frappe.db.sql("""select abs(stock_value_difference / actual_qty)
 				from `tabStock Ledger Entry`
 				where voucher_type = %s and voucher_no = %s
 					and item_code = %s and warehouse=%s limit 1""",
@@ -303,6 +303,15 @@
 						}))
 
 		self.make_sl_entries(sl_entries)
+		
+	def validate_warehouse(self):
+		from erpnext.stock.utils import validate_warehouse_company
+
+		warehouses = list(set([d.warehouse for d in
+			self.get("items") if getattr(d, "warehouse", None)]))
+
+		for w in warehouses:
+			validate_warehouse_company(w, self.company)
 
 def update_gl_entries_after(posting_date, posting_time, for_warehouses=None, for_items=None,
 		warehouse_account=None):
@@ -376,6 +385,6 @@
 	warehouse_account = frappe._dict()
 
 	for d in frappe.db.sql("""select warehouse, name, account_currency from tabAccount
-		where account_type = 'Warehouse' and ifnull(warehouse, '') != ''""", as_dict=1):
+		where account_type = 'Warehouse' and (warehouse is not null and warehouse != '')""", as_dict=1):
 			warehouse_account.setdefault(d.warehouse, d)
 	return warehouse_account
diff --git a/erpnext/controllers/website_list_for_contact.py b/erpnext/controllers/website_list_for_contact.py
index c925383..ae6e9e4 100644
--- a/erpnext/controllers/website_list_for_contact.py
+++ b/erpnext/controllers/website_list_for_contact.py
@@ -13,7 +13,7 @@
 		"global_number_format": frappe.db.get_default("number_format") or "#,###.##",
 		"currency": frappe.db.get_default("currency"),
 		"currency_symbols": json.dumps(dict(frappe.db.sql("""select name, symbol
-			from tabCurrency where ifnull(enabled,0)=1"""))),
+			from tabCurrency where enabled=1"""))),
 		"row_template": "templates/includes/transaction_row.html",
 		"get_list": get_transaction_list
 	}
diff --git a/erpnext/crm/doctype/lead/lead.json b/erpnext/crm/doctype/lead/lead.json
index b81375c..ff20cfd 100644
--- a/erpnext/crm/doctype/lead/lead.json
+++ b/erpnext/crm/doctype/lead/lead.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-user", 
    "permlevel": 0, 
@@ -41,7 +42,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Series",  
+   "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "naming_series", 
    "oldfieldtype": "Select", 
@@ -66,6 +68,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Person Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "lead_name", 
    "oldfieldtype": "Data", 
@@ -89,6 +92,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Organization Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company_name", 
    "oldfieldtype": "Data", 
@@ -112,6 +116,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Email Id", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "email_id", 
    "oldfieldtype": "Data", 
@@ -135,6 +140,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -157,7 +163,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "status", 
    "oldfieldtype": "Select", 
@@ -181,7 +188,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
-   "label": "Source",  
+   "label": "Source", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "source", 
    "oldfieldtype": "Select", 
@@ -207,6 +215,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "From Customer", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer", 
    "oldfieldtype": "Link", 
@@ -233,6 +242,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Campaign Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "campaign_name", 
    "oldfieldtype": "Link", 
@@ -256,6 +266,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -279,6 +290,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Lead Owner", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "lead_owner", 
    "oldfieldtype": "Link", 
@@ -302,6 +314,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -324,6 +337,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Next Contact By", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "contact_by", 
    "oldfieldtype": "Link", 
@@ -350,6 +364,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Next Contact Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "contact_date", 
    "oldfieldtype": "Date", 
@@ -374,6 +389,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address & Contact", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "options": "icon-map-marker", 
@@ -398,6 +414,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address Desc", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "<em>Addresses will appear only when you save the lead</em>", 
    "permlevel": 0, 
@@ -420,6 +437,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address HTML", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -440,6 +458,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -461,6 +480,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Phone", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "contact_no", 
    "oldfieldtype": "Data", 
@@ -484,6 +504,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Mobile No.", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "mobile_no", 
    "oldfieldtype": "Data", 
@@ -507,6 +528,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Fax", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fax", 
    "oldfieldtype": "Data", 
@@ -530,6 +552,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Website", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "website", 
    "oldfieldtype": "Data", 
@@ -554,6 +577,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Territory", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "territory", 
    "oldfieldtype": "Link", 
@@ -578,6 +602,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "More Information", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-file-text", 
@@ -600,7 +625,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
-   "label": "Lead Type",  
+   "label": "Lead Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "type", 
    "oldfieldtype": "Select", 
@@ -624,7 +650,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
-   "label": "Market Segment",  
+   "label": "Market Segment", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "market_segment", 
    "oldfieldtype": "Select", 
@@ -649,6 +676,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Industry", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "industry", 
    "oldfieldtype": "Link", 
@@ -672,7 +700,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Request Type",  
+   "label": "Request Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "request_type", 
    "oldfieldtype": "Select", 
@@ -697,6 +726,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -720,6 +750,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -743,6 +774,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -767,6 +799,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Unsubscribed", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -788,6 +821,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Blog Subscriber", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -808,7 +842,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:55.014441", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:49.250337", 
  "modified_by": "Administrator", 
  "module": "CRM", 
  "name": "Lead", 
diff --git a/erpnext/crm/doctype/newsletter/newsletter.json b/erpnext/crm/doctype/newsletter/newsletter.json
index 923c6d9..348b12b 100644
--- a/erpnext/crm/doctype/newsletter/newsletter.json
+++ b/erpnext/crm/doctype/newsletter/newsletter.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Newsletter List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Newsletter List", 
    "permlevel": 0, 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Subject", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -66,6 +68,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sender", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -87,6 +90,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Email Sent?", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -108,6 +112,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -129,6 +134,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Message", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -151,6 +157,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -173,6 +180,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Test Email Id", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -194,6 +202,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Test", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "test_send", 
    "permlevel": 0, 
@@ -215,7 +224,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:57.733269", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:50.506090", 
  "modified_by": "Administrator", 
  "module": "CRM", 
  "name": "Newsletter", 
diff --git a/erpnext/crm/doctype/newsletter_list/newsletter_list.json b/erpnext/crm/doctype/newsletter_list/newsletter_list.json
index 7e3a382..597116f 100644
--- a/erpnext/crm/doctype/newsletter_list/newsletter_list.json
+++ b/erpnext/crm/doctype/newsletter_list/newsletter_list.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Title", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Total Subscribers", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -62,7 +64,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:57.839265", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:50.643141", 
  "modified_by": "Administrator", 
  "module": "CRM", 
  "name": "Newsletter List", 
diff --git a/erpnext/crm/doctype/newsletter_list_subscriber/newsletter_list_subscriber.json b/erpnext/crm/doctype/newsletter_list_subscriber/newsletter_list_subscriber.json
index c22d042..08208b8 100644
--- a/erpnext/crm/doctype/newsletter_list_subscriber/newsletter_list_subscriber.json
+++ b/erpnext/crm/doctype/newsletter_list_subscriber/newsletter_list_subscriber.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Newsletter List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Newsletter List", 
    "permlevel": 0, 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Email", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -65,6 +67,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Unsubscribed", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -84,7 +87,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:57.901238", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:50.675306", 
  "modified_by": "Administrator", 
  "module": "CRM", 
  "name": "Newsletter List Subscriber", 
diff --git a/erpnext/crm/doctype/opportunity/opportunity.json b/erpnext/crm/doctype/opportunity/opportunity.json
index 6b94b2c..a0afbb8 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.json
+++ b/erpnext/crm/doctype/opportunity/opportunity.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-user", 
    "permlevel": 0, 
@@ -42,7 +43,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Series",  
+   "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "naming_series", 
    "oldfieldtype": "Select", 
@@ -66,7 +68,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Opportunity From",  
+   "label": "Opportunity From", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "enquiry_from", 
    "oldfieldtype": "Select", 
@@ -92,6 +95,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer", 
    "oldfieldtype": "Link", 
@@ -117,6 +121,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Lead", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "lead", 
    "oldfieldtype": "Link", 
@@ -142,6 +147,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer / Lead Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -162,6 +168,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -185,6 +192,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Title", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -207,7 +215,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Opportunity Type",  
+   "label": "Opportunity Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "enquiry_type", 
    "oldfieldtype": "Select", 
@@ -232,7 +241,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "status", 
    "oldfieldtype": "Select", 
@@ -258,6 +268,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Lost Reason", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -279,6 +290,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "With Items", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -302,6 +314,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-shopping-cart", 
@@ -326,6 +339,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Items", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "enquiry_details", 
    "oldfieldtype": "Table", 
@@ -352,6 +366,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Info", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-bullhorn", 
    "permlevel": 0, 
@@ -375,6 +390,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer / Lead Address", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Address", 
    "permlevel": 0, 
@@ -397,6 +413,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "address", 
    "oldfieldtype": "Small Text", 
@@ -422,6 +439,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Territory", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Territory", 
    "permlevel": 0, 
@@ -446,6 +464,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer Group", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer_group", 
    "oldfieldtype": "Link", 
@@ -469,6 +488,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -491,6 +511,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Contact Person", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Contact", 
    "permlevel": 0, 
@@ -514,6 +535,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -536,6 +558,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Email", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -558,6 +581,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Mobile No", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -580,6 +604,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Source", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-file-text", 
@@ -602,7 +627,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Source",  
+   "label": "Source", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "source", 
    "oldfieldtype": "Select", 
@@ -628,6 +654,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Campaign", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "campaign", 
    "oldfieldtype": "Link", 
@@ -651,6 +678,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -674,6 +702,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -699,6 +728,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Opportunity Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "transaction_date", 
    "oldfieldtype": "Date", 
@@ -723,6 +753,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -748,6 +779,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Next Contact", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -771,6 +803,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Next Contact By", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "contact_by", 
    "oldfieldtype": "Link", 
@@ -797,6 +830,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Next Contact Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "contact_date", 
    "oldfieldtype": "Date", 
@@ -819,6 +853,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -842,6 +877,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "To Discuss", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "to_discuss", 
    "oldfieldtype": "Small Text", 
@@ -865,6 +901,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Data", 
@@ -889,7 +926,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:58.453338", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:50.931180", 
  "modified_by": "Administrator", 
  "module": "CRM", 
  "name": "Opportunity", 
diff --git a/erpnext/crm/doctype/opportunity_item/opportunity_item.json b/erpnext/crm/doctype/opportunity_item/opportunity_item.json
index 61b883d..1715c55 100644
--- a/erpnext/crm/doctype/opportunity_item/opportunity_item.json
+++ b/erpnext/crm/doctype/opportunity_item/opportunity_item.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -41,6 +42,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -62,6 +64,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "qty", 
    "oldfieldtype": "Currency", 
@@ -86,6 +89,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Group", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_group", 
    "oldfieldtype": "Link", 
@@ -110,6 +114,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Brand", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "brand", 
    "oldfieldtype": "Link", 
@@ -133,6 +138,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -155,6 +161,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "uom", 
    "oldfieldtype": "Link", 
@@ -179,6 +186,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_name", 
    "oldfieldtype": "Data", 
@@ -202,6 +210,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Text", 
@@ -226,6 +235,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -248,6 +258,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "", 
    "permlevel": 0, 
@@ -271,6 +282,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image View", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "image", 
    "permlevel": 0, 
@@ -294,6 +306,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Basic Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "basic_rate", 
    "oldfieldtype": "Currency", 
@@ -316,7 +329,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-19 03:04:51.988510", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:51.062309", 
  "modified_by": "Administrator", 
  "module": "CRM", 
  "name": "Opportunity Item", 
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index bb117c1..6ed7c62 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -4,32 +4,10 @@
 app_name = "erpnext"
 app_title = "ERPNext"
 app_publisher = "Frappe Technologies Pvt. Ltd."
-app_description = """## ERPNext
-
-ERPNext is a fully featured ERP system designed for Small and Medium Sized
-business. ERPNext covers a wide range of features including Accounting, CRM,
-Inventory management, Selling, Purchasing, Manufacturing, Projects, HR &
-Payroll, Website, E-Commerce and much more.
-
-ERPNext is based on the Frappe Framework is highly customizable and extendable.
-You can create Custom Form, Fields, Scripts and can also create your own Apps
-to extend ERPNext functionality.
-
-ERPNext is Open Source under the GNU General Public Licence v3 and has been
-listed as one of the Best Open Source Softwares in the world by my online
-blogs.
-
-### Links
-
-- Website: [https://erpnext.com](https://erpnext.com)
-- GitHub: [https://github.com/frappe/erpnext](https://github.com/frappe/erpnext)
-- Forum: [https://discuss.erpnext.com](https://discuss.erpnext.com)
-- Frappe Framework: [https://frappe.io](https://frappe.io)
-
-"""
+app_description = """ERP made simple"""
 app_icon = "icon-th"
 app_color = "#e74c3c"
-app_version = "6.9.2"
+app_version = "6.10.0"
 app_email = "info@erpnext.com"
 app_license = "GNU General Public License (v3)"
 source_link = "https://github.com/frappe/erpnext"
diff --git a/erpnext/hr/doctype/appraisal/appraisal.json b/erpnext/hr/doctype/appraisal/appraisal.json
index e395f49..c9393cd 100644
--- a/erpnext/hr/doctype/appraisal/appraisal.json
+++ b/erpnext/hr/doctype/appraisal/appraisal.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Appraisal Template", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "kra_template", 
    "oldfieldtype": "Link", 
@@ -68,6 +70,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "For Employee", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "employee", 
    "oldfieldtype": "Link", 
@@ -93,6 +96,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "For Employee Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "employee_name", 
    "oldfieldtype": "Data", 
@@ -116,6 +120,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -140,7 +145,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "status", 
    "oldfieldtype": "Select", 
@@ -166,6 +172,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Start Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "start_date", 
    "oldfieldtype": "Date", 
@@ -190,6 +197,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "End Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "end_date", 
    "oldfieldtype": "Date", 
@@ -214,6 +222,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Goals", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "Simple", 
@@ -237,6 +246,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Goals", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "appraisal_details", 
    "oldfieldtype": "Table", 
@@ -261,6 +271,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Calculate Total Score", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Button", 
    "options": "calculate_total", 
@@ -284,6 +295,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Total Score (Out of 5)", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "total_score", 
    "oldfieldtype": "Currency", 
@@ -307,6 +319,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -329,6 +342,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Remarks", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -351,6 +365,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -372,6 +387,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -395,6 +411,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -417,6 +434,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -441,6 +459,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Data", 
@@ -465,7 +484,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:38.259403", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:41.850937", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Appraisal", 
diff --git a/erpnext/hr/doctype/appraisal_goal/appraisal_goal.json b/erpnext/hr/doctype/appraisal_goal/appraisal_goal.json
index 95e0891..ef561da 100644
--- a/erpnext/hr/doctype/appraisal_goal/appraisal_goal.json
+++ b/erpnext/hr/doctype/appraisal_goal/appraisal_goal.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Goal", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "kra", 
    "oldfieldtype": "Small Text", 
@@ -44,6 +45,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -66,6 +68,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Weightage (%)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "per_weightage", 
    "oldfieldtype": "Currency", 
@@ -90,6 +93,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -112,6 +116,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Score (0-5)", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "score", 
    "oldfieldtype": "Select", 
@@ -137,6 +142,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -159,6 +165,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Score Earned", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "score_earned", 
    "oldfieldtype": "Currency", 
@@ -182,7 +189,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:38.437815", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:41.929884", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Appraisal Goal", 
diff --git a/erpnext/hr/doctype/appraisal_template/appraisal_template.json b/erpnext/hr/doctype/appraisal_template/appraisal_template.json
index 5836f53..4903c58 100644
--- a/erpnext/hr/doctype/appraisal_template/appraisal_template.json
+++ b/erpnext/hr/doctype/appraisal_template/appraisal_template.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Appraisal Template Title", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "kra_title", 
    "oldfieldtype": "Data", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Small Text", 
@@ -68,6 +70,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Goals", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "kra_sheet", 
    "oldfieldtype": "Table", 
@@ -91,7 +94,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:38.527810", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:41.974626", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Appraisal Template", 
diff --git a/erpnext/hr/doctype/appraisal_template_goal/appraisal_template_goal.json b/erpnext/hr/doctype/appraisal_template_goal/appraisal_template_goal.json
index 874d05f..ccce527 100644
--- a/erpnext/hr/doctype/appraisal_template_goal/appraisal_template_goal.json
+++ b/erpnext/hr/doctype/appraisal_template_goal/appraisal_template_goal.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "KRA", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "kra", 
    "oldfieldtype": "Small Text", 
@@ -45,6 +46,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Weightage (%)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "per_weightage", 
    "oldfieldtype": "Currency", 
@@ -68,7 +70,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:38.594066", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:42.006632", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Appraisal Template Goal", 
diff --git a/erpnext/hr/doctype/attendance/attendance.json b/erpnext/hr/doctype/attendance/attendance.json
index 0c36411..78391c8 100644
--- a/erpnext/hr/doctype/attendance/attendance.json
+++ b/erpnext/hr/doctype/attendance/attendance.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "Simple", 
@@ -42,7 +43,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Series",  
+   "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "naming_series", 
    "oldfieldtype": "Select", 
@@ -67,6 +69,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Employee", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "employee", 
    "oldfieldtype": "Link", 
@@ -91,6 +94,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Employee Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "employee_name", 
    "oldfieldtype": "Data", 
@@ -114,7 +118,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "status", 
    "oldfieldtype": "Select", 
@@ -139,6 +144,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Leave Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "leave_type", 
    "oldfieldtype": "Link", 
@@ -162,6 +168,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -185,6 +192,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Attendance Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "att_date", 
    "oldfieldtype": "Date", 
@@ -208,6 +216,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -232,6 +241,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -256,6 +266,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Attendance", 
    "permlevel": 0, 
@@ -277,7 +288,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:38.766621", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:42.089225", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Attendance", 
diff --git a/erpnext/hr/doctype/branch/branch.json b/erpnext/hr/doctype/branch/branch.json
index d5b9b61..96dcc32 100644
--- a/erpnext/hr/doctype/branch/branch.json
+++ b/erpnext/hr/doctype/branch/branch.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Branch", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "branch", 
    "oldfieldtype": "Data", 
@@ -42,7 +43,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:40.571426", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:42.974184", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Branch", 
diff --git a/erpnext/hr/doctype/deduction_type/deduction_type.json b/erpnext/hr/doctype/deduction_type/deduction_type.json
index 56a9efc..46e8923 100644
--- a/erpnext/hr/doctype/deduction_type/deduction_type.json
+++ b/erpnext/hr/doctype/deduction_type/deduction_type.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "deduction_name", 
    "oldfieldtype": "Data", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Small Text", 
@@ -66,7 +68,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:44.282690", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:44.572917", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Deduction Type", 
diff --git a/erpnext/hr/doctype/department/department.json b/erpnext/hr/doctype/department/department.json
index 4607b72..2d2d287 100644
--- a/erpnext/hr/doctype/department/department.json
+++ b/erpnext/hr/doctype/department/department.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Department", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "department_name", 
    "oldfieldtype": "Data", 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Leave Block List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Leave Block List", 
    "permlevel": 0, 
@@ -65,7 +67,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:45.543232", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:45.172261", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Department", 
diff --git a/erpnext/hr/doctype/designation/designation.json b/erpnext/hr/doctype/designation/designation.json
index 43d057c..1a1cc32 100644
--- a/erpnext/hr/doctype/designation/designation.json
+++ b/erpnext/hr/doctype/designation/designation.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Designation", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "designation_name", 
    "oldfieldtype": "Data", 
@@ -42,7 +43,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:45.651511", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:45.227540", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Designation", 
diff --git a/erpnext/hr/doctype/earning_type/earning_type.json b/erpnext/hr/doctype/earning_type/earning_type.json
index ea0d556..556bf41 100644
--- a/erpnext/hr/doctype/earning_type/earning_type.json
+++ b/erpnext/hr/doctype/earning_type/earning_type.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "earning_name", 
    "oldfieldtype": "Data", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Small Text", 
@@ -66,7 +68,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:47.553467", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:45.813984", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Earning Type", 
diff --git a/erpnext/hr/doctype/employee/employee.json b/erpnext/hr/doctype/employee/employee.json
index 3f328c3..dd54623 100644
--- a/erpnext/hr/doctype/employee/employee.json
+++ b/erpnext/hr/doctype/employee/employee.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -41,6 +42,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -63,6 +65,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Employee", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -84,6 +87,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "naming_series", 
    "oldfieldtype": "Select", 
@@ -108,6 +112,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Salutation", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "salutation", 
    "oldfieldtype": "Select", 
@@ -132,6 +137,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Full Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "employee_name", 
    "oldfieldtype": "Data", 
@@ -155,6 +161,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "", 
    "permlevel": 0, 
@@ -177,6 +184,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image View", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "image", 
    "permlevel": 0, 
@@ -198,6 +206,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -221,6 +230,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "User ID", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "User", 
    "permlevel": 0, 
@@ -243,6 +253,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Employee Number", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "employee_number", 
    "oldfieldtype": "Data", 
@@ -266,6 +277,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Date of Joining", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "date_of_joining", 
    "oldfieldtype": "Date", 
@@ -290,6 +302,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Date of Birth", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "date_of_birth", 
    "oldfieldtype": "Date", 
@@ -313,6 +326,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Gender", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "gender", 
    "oldfieldtype": "Select", 
@@ -337,6 +351,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -359,6 +374,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Employment Details", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -379,6 +395,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -401,6 +418,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Status", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "status", 
    "oldfieldtype": "Select", 
@@ -425,6 +443,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Employment Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "employment_type", 
    "oldfieldtype": "Link", 
@@ -450,6 +469,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Holiday List", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "holiday_list", 
    "oldfieldtype": "Link", 
@@ -473,6 +493,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -494,6 +515,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Offer Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "scheduled_confirmation_date", 
    "oldfieldtype": "Date", 
@@ -517,6 +539,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Confirmation Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "final_confirmation_date", 
    "oldfieldtype": "Date", 
@@ -540,6 +563,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Contract End Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "contract_end_date", 
    "oldfieldtype": "Date", 
@@ -563,6 +587,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Date Of Retirement", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "date_of_retirement", 
    "oldfieldtype": "Date", 
@@ -586,6 +611,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Job Profile", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -606,6 +632,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -628,6 +655,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Branch", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "branch", 
    "oldfieldtype": "Link", 
@@ -652,6 +680,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Department", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "department", 
    "oldfieldtype": "Link", 
@@ -676,6 +705,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Designation", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "designation", 
    "oldfieldtype": "Link", 
@@ -701,6 +731,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company Email", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company_email", 
    "oldfieldtype": "Data", 
@@ -725,6 +756,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Notice (days)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "notice_number_of_days", 
    "oldfieldtype": "Int", 
@@ -748,6 +780,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Salary Information", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -771,6 +804,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Salary Mode", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "salary_mode", 
    "oldfieldtype": "Select", 
@@ -796,6 +830,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Bank Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "bank_name", 
    "oldfieldtype": "Link", 
@@ -820,6 +855,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Bank A/C No.", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "bank_ac_no", 
    "oldfieldtype": "Data", 
@@ -843,6 +879,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Organization Profile", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -864,6 +901,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reports to", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "reports_to", 
    "oldfieldtype": "Link", 
@@ -889,6 +927,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Leave Approvers", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Employee Leave Approver", 
    "permlevel": 0, 
@@ -911,6 +950,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Details", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -931,6 +971,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -953,6 +994,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Cell Number", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -974,6 +1016,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Personal Email", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Email", 
    "permlevel": 0, 
@@ -996,6 +1039,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Unsubscribed", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1017,6 +1061,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Emergency Contact Details", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "<h4 class=\"text-muted\">Emergency Contact Details</h4>", 
    "permlevel": 0, 
@@ -1039,6 +1084,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Emergency Contact", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1060,6 +1106,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Relation", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1081,6 +1128,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Emergency Phone", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1101,6 +1149,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1123,6 +1172,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Permanent Address Is", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nRented\nOwned", 
    "permlevel": 0, 
@@ -1145,6 +1195,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Permanent Address", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1166,6 +1217,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Current Address Is", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nRented\nOwned", 
    "permlevel": 0, 
@@ -1188,6 +1240,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Current Address", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1209,6 +1262,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1231,6 +1285,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Bio", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1252,6 +1307,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Personal Details", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1272,6 +1328,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1294,6 +1351,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Passport Number", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1315,6 +1373,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Date of Issue", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1336,6 +1395,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Valid Upto", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1357,6 +1417,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Place of Issue", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1377,6 +1438,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1399,6 +1461,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Marital Status", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nSingle\nMarried\nDivorced\nWidowed", 
    "permlevel": 0, 
@@ -1421,6 +1484,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Blood Group", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nA+\nA-\nB+\nB-\nAB+\nAB-\nO+\nO-", 
    "permlevel": 0, 
@@ -1444,6 +1508,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Family Background", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1466,6 +1531,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Health Details", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1487,6 +1553,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Educational Qualification", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1508,6 +1575,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Education", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Employee Education", 
    "permlevel": 0, 
@@ -1530,6 +1598,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Previous Work Experience", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Simple", 
    "permlevel": 0, 
@@ -1552,6 +1621,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "External Work History", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Employee External Work History", 
    "permlevel": 0, 
@@ -1574,6 +1644,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "History In Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Simple", 
    "permlevel": 0, 
@@ -1596,6 +1667,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Internal Work History", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Employee Internal Work History", 
    "permlevel": 0, 
@@ -1618,6 +1690,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Exit", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -1639,6 +1712,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1661,6 +1735,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Resignation Letter Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "resignation_letter_date", 
    "oldfieldtype": "Date", 
@@ -1684,6 +1759,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Relieving Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "relieving_date", 
    "oldfieldtype": "Date", 
@@ -1707,6 +1783,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reason for Leaving", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "reason_for_leaving", 
    "oldfieldtype": "Data", 
@@ -1730,6 +1807,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Leave Encashed?", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "leave_encashed", 
    "oldfieldtype": "Select", 
@@ -1754,6 +1832,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Encashment Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "encashment_date", 
    "oldfieldtype": "Date", 
@@ -1777,6 +1856,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Exit Interview Details", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "col_brk6", 
    "oldfieldtype": "Column Break", 
@@ -1801,6 +1881,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Held On", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "held_on", 
    "oldfieldtype": "Date", 
@@ -1824,6 +1905,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reason for Resignation", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "reason_for_resignation", 
    "oldfieldtype": "Select", 
@@ -1848,6 +1930,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "New Workplace", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "new_workplace", 
    "oldfieldtype": "Data", 
@@ -1871,6 +1954,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Feedback", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "feedback", 
    "oldfieldtype": "Text", 
@@ -1893,7 +1977,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-19 03:04:49.862553", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:46.290512", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Employee", 
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index 12c49c8..e781532 100644
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -208,15 +208,15 @@
 			users = [u.email_id or u.name for u in get_enabled_system_users()]
 
 		for e in birthdays:
-			frappe.sendmail(recipients=filter(lambda u: u not in (e.company_email, e.personal_email), users),
+			frappe.sendmail(recipients=filter(lambda u: u not in (e.company_email, e.personal_email, e.user_id), users),
 				subject=_("Birthday Reminder for {0}").format(e.employee_name),
 				message=_("""Today is {0}'s birthday!""").format(e.employee_name),
-				reply_to=e.company_email or e.personal_email,
+				reply_to=e.company_email or e.personal_email or e.user_id,
 				bulk=True)
 
 def get_employees_who_are_born_today():
 	"""Get Employee properties whose birthday is today."""
-	return frappe.db.sql("""select name, personal_email, company_email, employee_name
+	return frappe.db.sql("""select name, personal_email, company_email, user_id, employee_name
 		from tabEmployee where day(date_of_birth) = day(%(date)s)
 		and month(date_of_birth) = month(%(date)s)
 		and status = 'Active'""", {"date": today()}, as_dict=True)
diff --git a/erpnext/hr/doctype/employee_education/employee_education.json b/erpnext/hr/doctype/employee_education/employee_education.json
index d0d4255..1049ce5 100644
--- a/erpnext/hr/doctype/employee_education/employee_education.json
+++ b/erpnext/hr/doctype/employee_education/employee_education.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "School/University", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "school_univ", 
    "oldfieldtype": "Small Text", 
@@ -41,6 +42,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Qualification", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "qualification", 
    "oldfieldtype": "Data", 
@@ -65,7 +67,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Level",  
+   "label": "Level", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "level", 
    "oldfieldtype": "Select", 
@@ -90,6 +93,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Year of Passing", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "year_of_passing", 
    "oldfieldtype": "Int", 
@@ -113,6 +117,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Class / Percentage", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "class_per", 
    "oldfieldtype": "Data", 
@@ -136,6 +141,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Major/Optional Subjects", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "maj_opt_subj", 
    "oldfieldtype": "Text", 
@@ -157,7 +163,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:49.501752", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:46.561817", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Employee Education", 
diff --git a/erpnext/hr/doctype/employee_external_work_history/employee_external_work_history.json b/erpnext/hr/doctype/employee_external_work_history/employee_external_work_history.json
index fc10848..cbd1b54 100644
--- a/erpnext/hr/doctype/employee_external_work_history/employee_external_work_history.json
+++ b/erpnext/hr/doctype/employee_external_work_history/employee_external_work_history.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company_name", 
    "oldfieldtype": "Data", 
@@ -41,6 +42,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Designation", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "designation", 
    "oldfieldtype": "Data", 
@@ -64,6 +66,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Salary", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "salary", 
    "oldfieldtype": "Currency", 
@@ -88,6 +91,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Address", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "address", 
    "oldfieldtype": "Small Text", 
@@ -111,6 +115,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Contact", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "contact", 
    "oldfieldtype": "Data", 
@@ -134,6 +139,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Total Experience", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "total_experience", 
    "oldfieldtype": "Data", 
@@ -155,7 +161,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:49.600116", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:46.610845", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Employee External Work History", 
diff --git a/erpnext/hr/doctype/employee_internal_work_history/employee_internal_work_history.json b/erpnext/hr/doctype/employee_internal_work_history/employee_internal_work_history.json
index 20f0240..fb82e7f 100644
--- a/erpnext/hr/doctype/employee_internal_work_history/employee_internal_work_history.json
+++ b/erpnext/hr/doctype/employee_internal_work_history/employee_internal_work_history.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Branch", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "branch", 
    "oldfieldtype": "Select", 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Department", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "department", 
    "oldfieldtype": "Select", 
@@ -66,6 +68,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Designation", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "designation", 
    "oldfieldtype": "Select", 
@@ -90,6 +93,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "From Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "from_date", 
    "oldfieldtype": "Date", 
@@ -113,6 +117,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "To Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "to_date", 
    "oldfieldtype": "Date", 
@@ -134,7 +139,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:49.685680", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:46.658225", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Employee Internal Work History", 
diff --git a/erpnext/hr/doctype/employee_leave_approver/employee_leave_approver.json b/erpnext/hr/doctype/employee_leave_approver/employee_leave_approver.json
index 07b43e2..9c40cea 100644
--- a/erpnext/hr/doctype/employee_leave_approver/employee_leave_approver.json
+++ b/erpnext/hr/doctype/employee_leave_approver/employee_leave_approver.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Leave Approver", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "User", 
    "permlevel": 0, 
@@ -41,7 +42,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:49.771647", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:46.702691", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Employee Leave Approver", 
diff --git a/erpnext/hr/doctype/employment_type/employment_type.json b/erpnext/hr/doctype/employment_type/employment_type.json
index ab6d62d..5bd58d4 100644
--- a/erpnext/hr/doctype/employment_type/employment_type.json
+++ b/erpnext/hr/doctype/employment_type/employment_type.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Employment Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "employee_type_name", 
    "oldfieldtype": "Data", 
@@ -42,7 +43,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:49.822148", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:46.733350", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Employment Type", 
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.json b/erpnext/hr/doctype/expense_claim/expense_claim.json
index a5e3972..794d0e6 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.json
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "EXP", 
    "permlevel": 0, 
@@ -45,6 +46,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Approval Status", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "approval_status", 
    "oldfieldtype": "Select", 
@@ -70,6 +72,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Approver", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "exp_approver", 
    "oldfieldtype": "Select", 
@@ -94,6 +97,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -117,6 +121,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Total Claimed Amount", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "total_claimed_amount", 
    "oldfieldtype": "Currency", 
@@ -142,6 +147,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Sanctioned Amount", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "total_sanctioned_amount", 
    "oldfieldtype": "Currency", 
@@ -167,6 +173,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -189,6 +196,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Expenses", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "expense_voucher_details", 
    "oldfieldtype": "Table", 
@@ -212,6 +220,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Simple", 
    "permlevel": 0, 
@@ -235,6 +244,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Posting Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "posting_date", 
    "oldfieldtype": "Date", 
@@ -258,6 +268,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "From Employee", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "employee", 
    "oldfieldtype": "Link", 
@@ -282,6 +293,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Employee Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "employee_name", 
    "oldfieldtype": "Data", 
@@ -306,6 +318,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -330,6 +343,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -353,6 +367,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -374,6 +389,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Amount Reimbursed", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -397,6 +413,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Remark", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "remark", 
    "oldfieldtype": "Small Text", 
@@ -420,6 +437,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Project", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Project", 
    "permlevel": 0, 
@@ -443,6 +461,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Task", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Task", 
    "permlevel": 0, 
@@ -467,6 +486,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Title", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -489,6 +509,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Employees Email Id", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "email_id", 
    "oldfieldtype": "Data", 
@@ -512,6 +533,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Data", 
@@ -536,7 +558,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-11-14 12:11:13.213073", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:46.926224", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Expense Claim", 
diff --git a/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.json b/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.json
index 6e0be7d..d4e53a0 100644
--- a/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.json
+++ b/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Expense Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "expense_date", 
    "oldfieldtype": "Date", 
@@ -42,6 +43,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -64,6 +66,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Expense Claim Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "expense_type", 
    "oldfieldtype": "Link", 
@@ -91,6 +94,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Account", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Account", 
    "permlevel": 0, 
@@ -113,6 +117,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -135,6 +140,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Small Text", 
@@ -159,6 +165,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -181,6 +188,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Claim Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "claim_amount", 
    "oldfieldtype": "Currency", 
@@ -206,6 +214,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -228,6 +237,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Sanctioned Amount", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "sanctioned_amount", 
    "oldfieldtype": "Currency", 
@@ -252,7 +262,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:50.425244", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:47.025506", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Expense Claim Detail", 
diff --git a/erpnext/hr/doctype/expense_claim_type/expense_claim_type.json b/erpnext/hr/doctype/expense_claim_type/expense_claim_type.json
index a804cc5..460b3b8 100644
--- a/erpnext/hr/doctype/expense_claim_type/expense_claim_type.json
+++ b/erpnext/hr/doctype/expense_claim_type/expense_claim_type.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Expense Claim Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "expense_type", 
    "oldfieldtype": "Data", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Account", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Account", 
    "permlevel": 0, 
@@ -66,6 +68,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Small Text", 
@@ -89,7 +92,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:50.532121", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:47.084611", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Expense Claim Type", 
diff --git a/erpnext/hr/doctype/holiday/holiday.json b/erpnext/hr/doctype/holiday/holiday.json
index 6edca02..a7fc6a7 100644
--- a/erpnext/hr/doctype/holiday/holiday.json
+++ b/erpnext/hr/doctype/holiday/holiday.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -41,6 +42,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "holiday_date", 
    "oldfieldtype": "Date", 
@@ -62,7 +64,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:51.356409", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:47.483435", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Holiday", 
diff --git a/erpnext/hr/doctype/holiday_list/holiday_list.json b/erpnext/hr/doctype/holiday_list/holiday_list.json
index 70c7f22..999709d 100644
--- a/erpnext/hr/doctype/holiday_list/holiday_list.json
+++ b/erpnext/hr/doctype/holiday_list/holiday_list.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Holiday List Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "holiday_list_name", 
    "oldfieldtype": "Data", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Default", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -64,6 +66,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Link", 
@@ -87,7 +90,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Weekly Off",  
+   "label": "Weekly Off", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "\nSunday\nMonday\nTuesday\nWednesday\nThursday\nFriday\nSaturday", 
    "permlevel": 0, 
@@ -110,6 +114,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Get Weekly Off Dates", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "get_weekly_off_dates", 
    "permlevel": 0, 
@@ -132,6 +137,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Holidays", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "holiday_list_details", 
    "oldfieldtype": "Table", 
@@ -156,6 +162,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Clear Table", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "clear_table", 
    "permlevel": 0, 
@@ -177,7 +184,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:51.415692", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:47.519087", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Holiday List", 
diff --git a/erpnext/hr/doctype/holiday_list/holiday_list.py b/erpnext/hr/doctype/holiday_list/holiday_list.py
index 336a081..b1cbca3 100644
--- a/erpnext/hr/doctype/holiday_list/holiday_list.py
+++ b/erpnext/hr/doctype/holiday_list/holiday_list.py
@@ -60,7 +60,7 @@
 
 	def update_default_holiday_list(self):
 		frappe.db.sql("""update `tabHoliday List` set is_default = 0
-			where ifnull(is_default, 0) = 1 and fiscal_year = %s""", (self.fiscal_year,))
+			where is_default = 1 and fiscal_year = %s""", (self.fiscal_year,))
 
 @frappe.whitelist()
 def get_events(start, end, filters=None):
diff --git a/erpnext/hr/doctype/job_applicant/job_applicant.json b/erpnext/hr/doctype/job_applicant/job_applicant.json
index e80abe2..e1351ef 100644
--- a/erpnext/hr/doctype/job_applicant/job_applicant.json
+++ b/erpnext/hr/doctype/job_applicant/job_applicant.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Applicant Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Email Id", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Email", 
    "permlevel": 0, 
@@ -63,7 +65,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Open\nReplied\nRejected\nHold", 
    "permlevel": 0, 
@@ -85,6 +88,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -107,6 +111,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Job Opening", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Job Opening", 
    "permlevel": 0, 
@@ -128,6 +133,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -149,6 +155,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Thread HTML", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -170,6 +177,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Communications", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Communication", 
    "permlevel": 0, 
@@ -191,7 +199,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:53.861921", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:48.722773", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Job Applicant", 
diff --git a/erpnext/hr/doctype/job_opening/job_opening.json b/erpnext/hr/doctype/job_opening/job_opening.json
index a72118a..f4380ad 100644
--- a/erpnext/hr/doctype/job_opening/job_opening.json
+++ b/erpnext/hr/doctype/job_opening/job_opening.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Job Title", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -41,7 +42,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Open\nClosed", 
    "permlevel": 0, 
@@ -65,6 +67,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -85,7 +88,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:53.972949", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:48.769149", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Job Opening", 
diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation.json b/erpnext/hr/doctype/leave_allocation/leave_allocation.json
index 2f606bd..83383f8 100644
--- a/erpnext/hr/doctype/leave_allocation/leave_allocation.json
+++ b/erpnext/hr/doctype/leave_allocation/leave_allocation.json
@@ -18,6 +18,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -40,6 +41,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Employee", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "employee", 
    "oldfieldtype": "Link", 
@@ -64,6 +66,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Employee Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -84,6 +87,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -106,6 +110,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "reason", 
    "oldfieldtype": "Small Text", 
@@ -129,6 +134,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -151,6 +157,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Leave Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "leave_type", 
    "oldfieldtype": "Link", 
@@ -175,6 +182,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "From Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -197,6 +205,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "To Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -218,6 +227,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -240,6 +250,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "New Leaves Allocated", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -262,6 +273,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Add unused leaves from previous allocations", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -284,6 +296,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Unused leaves", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -305,6 +318,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Leaves Allocated", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -326,6 +340,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Data", 
@@ -349,7 +364,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-11-04 03:13:11.121463", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:49.377973", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Leave Allocation", 
diff --git a/erpnext/hr/doctype/leave_allocation/test_leave_allocation.py b/erpnext/hr/doctype/leave_allocation/test_leave_allocation.py
index b3eee31..3b22eb2 100644
--- a/erpnext/hr/doctype/leave_allocation/test_leave_allocation.py
+++ b/erpnext/hr/doctype/leave_allocation/test_leave_allocation.py
@@ -4,7 +4,9 @@
 from frappe.utils import getdate
 
 class TestLeaveAllocation(unittest.TestCase):
-	def test_overlapping_allocation(self):		
+	def test_overlapping_allocation(self):
+		frappe.db.sql("delete from `tabLeave Allocation`")
+				
 		employee = frappe.get_doc("Employee", frappe.db.sql_list("select name from tabEmployee limit 1")[0])
 		leaves = [
 			{
diff --git a/erpnext/hr/doctype/leave_application/leave_application.json b/erpnext/hr/doctype/leave_application/leave_application.json
index 10f6594..bce60af 100644
--- a/erpnext/hr/doctype/leave_application/leave_application.json
+++ b/erpnext/hr/doctype/leave_application/leave_application.json
@@ -22,6 +22,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Open\nApproved\nRejected", 
    "permlevel": 1, 
@@ -43,6 +44,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -65,6 +67,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Leave Type", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Leave Type", 
    "permlevel": 0, 
@@ -87,6 +90,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Leave Balance Before Application", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -107,6 +111,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -129,6 +134,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "From Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -150,6 +156,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "To Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -171,6 +178,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Half Day", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -192,6 +200,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Total Leave Days", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -212,6 +221,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -235,6 +245,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reason", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -255,6 +266,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -277,6 +289,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Employee", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Employee", 
    "permlevel": 0, 
@@ -299,6 +312,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Employee Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -319,6 +333,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -342,6 +357,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Leave Approver", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "User", 
    "permlevel": 0, 
@@ -364,6 +380,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Leave Approver Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -386,6 +403,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -408,6 +426,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Posting Date", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -430,6 +449,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Follow via Email", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -450,6 +470,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -471,6 +492,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -493,6 +515,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Letter Head", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Letter Head", 
    "permlevel": 0, 
@@ -515,6 +538,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Leave Application", 
    "permlevel": 0, 
@@ -537,7 +561,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 3, 
- "modified": "2015-11-15 19:32:32.258397", 
+ "modified": "2015-11-16 06:29:49.454329", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Leave Application", 
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index 1d84a40..60bc531 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -49,7 +49,7 @@
 	def on_submit(self):
 		if self.status != "Approved":
 			frappe.throw(_("Only Leave Applications with status 'Approved' can be submitted"))
-			
+
 		self.validate_back_dated_application()
 
 		# notify leave applier about approval
@@ -58,36 +58,36 @@
 	def on_cancel(self):
 		# notify leave applier about cancellation
 		self.notify_employee("cancelled")
-		
+
 	def validate_dates(self):
 		if self.from_date and self.to_date and (getdate(self.to_date) < getdate(self.from_date)):
 			frappe.throw(_("To date cannot be before from date"))
-			
+
 		self.validate_dates_acorss_allocation()
 		self.validate_back_dated_application()
-		
+
 	def validate_dates_acorss_allocation(self):
 		def _get_leave_alloction_record(date):
-			allocation = frappe.db.sql("""select name from `tabLeave Allocation` 
-				where employee=%s and leave_type=%s and docstatus=1 
+			allocation = frappe.db.sql("""select name from `tabLeave Allocation`
+				where employee=%s and leave_type=%s and docstatus=1
 				and %s between from_date and to_date""", (self.employee, self.leave_type, date))
-				
+
 			return allocation and allocation[0][0]
-			
+
 		allocation_based_on_from_date = _get_leave_alloction_record(self.from_date)
 		allocation_based_on_to_date = _get_leave_alloction_record(self.to_date)
-		
+
 		if not (allocation_based_on_from_date or allocation_based_on_to_date):
 			frappe.throw(_("Application period cannot be outside leave allocation period"))
-			
+
 		elif allocation_based_on_from_date != allocation_based_on_to_date:
 			frappe.throw(_("Application period cannot be across two alocation records"))
-			
+
 	def validate_back_dated_application(self):
 		future_allocation = frappe.db.sql("""select name, from_date from `tabLeave Allocation`
-			where employee=%s and leave_type=%s and docstatus=1 and from_date > %s 
+			where employee=%s and leave_type=%s and docstatus=1 and from_date > %s
 			and carry_forward=1""", (self.employee, self.leave_type, self.to_date), as_dict=1)
-		
+
 		if future_allocation:
 			frappe.throw(_("Leave cannot be applied/cancelled before {0}, as leave balance has already been carry-forwarded in the future leave allocation record {1}")
 				.format(formatdate(future_allocation[0].from_date), future_allocation[0].name))
@@ -110,7 +110,7 @@
 
 	def validate_balance_leaves(self):
 		if self.from_date and self.to_date:
-			self.total_leave_days = get_number_of_leave_days(self.employee, self.leave_type, 
+			self.total_leave_days = get_number_of_leave_days(self.employee, self.leave_type,
 				self.from_date, self.to_date, self.half_day)
 
 			if self.total_leave_days == 0:
@@ -143,9 +143,9 @@
 			}, as_dict = 1):
 
 			frappe.msgprint(_("Employee {0} has already applied for {1} between {2} and {3}")
-				.format(self.employee, cstr(d['leave_type']), 
+				.format(self.employee, cstr(d['leave_type']),
 					formatdate(d['from_date']), formatdate(d['to_date'])))
-			
+
 			frappe.throw("""Exising Application: <a href="#Form/Leave Application/{0}">{0}</a>"""
 				.format(d["name"]), OverlapError)
 
@@ -228,36 +228,36 @@
 		approver.parent = %s
 		and user.name like %s
 		and approver.leave_approver=user.name""", (filters.get("employee"), "%" + txt + "%"))
-		
-@frappe.whitelist()			
+
+@frappe.whitelist()
 def get_number_of_leave_days(employee, leave_type, from_date, to_date, half_day=None):
 	if half_day:
 		return 0.5
 	number_of_days = date_diff(to_date, from_date) + 1
 	if not frappe.db.get_value("Leave Type", leave_type, "include_holiday"):
 		number_of_days = flt(number_of_days) - flt(get_holidays(employee, from_date, to_date))
-	
+
 	return number_of_days
 
 @frappe.whitelist()
 def get_leave_balance_on(employee, leave_type, date, allocation_records=None):
 	if allocation_records == None:
 		allocation_records = get_leave_allocation_records(date, employee).get(employee, frappe._dict())
-		
+
 	allocation = allocation_records.get(leave_type, frappe._dict())
-	
+
 	leaves_taken = get_approved_leaves_for_period(employee, leave_type, allocation.from_date, date)
-	
+
 	return flt(allocation.total_leaves_allocated) - flt(leaves_taken)
-	
+
 def get_approved_leaves_for_period(employee, leave_type, from_date, to_date):
 	leave_applications = frappe.db.sql("""
-		select employee, leave_type, from_date, to_date, total_leave_days 
-		from `tabLeave Application` 
-		where employee=%(employee)s and leave_type=%(leave_type)s 
+		select employee, leave_type, from_date, to_date, total_leave_days
+		from `tabLeave Application`
+		where employee=%(employee)s and leave_type=%(leave_type)s
 			and status="Approved" and docstatus=1
-			and (from_date between %(from_date)s and %(to_date)s 
-				or to_date between %(from_date)s and %(to_date)s 
+			and (from_date between %(from_date)s and %(to_date)s
+				or to_date between %(from_date)s and %(to_date)s
 				or (from_date < %(from_date)s and to_date > %(to_date)s))
 	""", {
 		"from_date": from_date,
@@ -265,7 +265,7 @@
 		"employee": employee,
 		"leave_type": leave_type
 	}, as_dict=1)
-	
+
 	leave_days = 0
 	for leave_app in leave_applications:
 		if leave_app.from_date >= getdate(from_date) and leave_app.to_date <= getdate(to_date):
@@ -275,20 +275,20 @@
 				leave_app.from_date = from_date
 			if leave_app.to_date > getdate(to_date):
 				leave_app.to_date = to_date
-	
-			leave_days += get_number_of_leave_days(employee, leave_type, 
+
+			leave_days += get_number_of_leave_days(employee, leave_type,
 				leave_app.from_date, leave_app.to_date)
-			
+
 	return leave_days
-	
+
 def get_leave_allocation_records(date, employee=None):
 	conditions = (" and employee='%s'" % employee) if employee else ""
-		
+
 	leave_allocation_records = frappe.db.sql("""
-		select employee, leave_type, total_leaves_allocated, from_date 
-		from `tabLeave Allocation` 
+		select employee, leave_type, total_leaves_allocated, from_date
+		from `tabLeave Allocation`
 		where %s between from_date and to_date and docstatus=1 {0}""".format(conditions), (date), as_dict=1)
-		
+
 	allocated_leaves = frappe._dict()
 	for d in leave_allocation_records:
 		allocated_leaves.setdefault(d.employee, frappe._dict()).setdefault(d.leave_type, frappe._dict({
@@ -297,7 +297,7 @@
 		}))
 
 	return allocated_leaves
-		
+
 
 def get_holidays(employee, from_date, to_date):
 	tot_hol = frappe.db.sql("""select count(*) from `tabHoliday` h1, `tabHoliday List` h2, `tabEmployee` e1
@@ -307,8 +307,8 @@
 	if not tot_hol:
 		tot_hol = frappe.db.sql("""select count(*) from `tabHoliday` h1, `tabHoliday List` h2
 			where h1.parent = h2.name and h1.holiday_date between %s and %s
-			and ifnull(h2.is_default,0) = 1""", (from_date, to_date))[0][0]
-	
+			and h2.is_default = 1""", (from_date, to_date))[0][0]
+
 	return tot_hol
 
 def is_lwp(leave_type):
diff --git a/erpnext/hr/doctype/leave_application/test_leave_application.py b/erpnext/hr/doctype/leave_application/test_leave_application.py
index 9e21708..67e211e 100644
--- a/erpnext/hr/doctype/leave_application/test_leave_application.py
+++ b/erpnext/hr/doctype/leave_application/test_leave_application.py
@@ -44,7 +44,11 @@
 ]
 
 
-class TestLeaveApplication(unittest.TestCase):
+class TestLeaveApplication(unittest.TestCase):	
+	def setUp(self):
+		for dt in ["Leave Application", "Leave Allocation", "Salary Slip"]:
+			frappe.db.sql("delete from `tab%s`" % dt)
+	
 	def tearDown(self):
 		frappe.set_user("Administrator")
 
@@ -97,6 +101,8 @@
 
 		frappe.db.set_value("Department", "_Test Department",
 			"leave_block_list", "_Test Leave Block List")
+			
+		make_allocation_record()
 
 		application = self.get_application(_test_records[0])
 		application.insert()
@@ -120,6 +126,9 @@
 		add_role("test2@example.com", "Leave Approver")
 
 		frappe.set_user("test@example.com")
+
+		make_allocation_record()
+		
 		application = self.get_application(_test_records[0])
 		application.leave_approver = "test2@example.com"
 		application.insert()
@@ -135,7 +144,9 @@
 		add_role("test1@example.com", "Employee")
 		add_role("test@example.com", "Leave Approver")
 		self._add_employee_leave_approver("_T-Employee-0002", "test@example.com")
-
+		
+		make_allocation_record(employee="_T-Employee-0002")
+		
 		application = self.get_application(_test_records[1])
 		application.leave_approver = "test@example.com"
 
@@ -175,6 +186,9 @@
 
 		# create leave application as Employee
 		frappe.set_user("test@example.com")
+		
+		make_allocation_record()
+		
 		application = self.get_application(_test_records[0])
 		application.leave_approver = "test1@example.com"
 		application.insert()
@@ -196,6 +210,8 @@
 		self._add_employee_leave_approver("_T-Employee-0001", "test2@example.com")
 		self._remove_employee_leave_approver("_T-Employee-0001", "test1@example.com")
 
+		make_allocation_record()
+
 		application = self.get_application(_test_records[0])
 		frappe.set_user("test@example.com")
 
@@ -212,6 +228,9 @@
 		# create leave application as employee
 		# but submit as invalid leave approver - should raise exception
 		frappe.set_user("test@example.com")
+		
+		make_allocation_record()
+		
 		application = self.get_application(_test_records[0])
 		application.leave_approver = "test2@example.com"
 		application.insert()
@@ -232,6 +251,9 @@
 		frappe.db.set_value("Employee", "_T-Employee-0001", "department", None)
 
 		frappe.set_user("test@example.com")
+		
+		make_allocation_record()
+		
 		application = self.get_application(_test_records[0])
 		application.leave_approver = "test2@example.com"
 		application.insert()
@@ -246,4 +268,19 @@
 		frappe.db.sql("""delete from `tabEmployee Leave Approver` where parent=%s""",
 			"_T-Employee-0001")
 
-		frappe.db.set_value("Employee", "_T-Employee-0001", "department", original_department)
\ No newline at end of file
+		frappe.db.set_value("Employee", "_T-Employee-0001", "department", original_department)
+		
+def make_allocation_record(employee=None, leave_type=None):
+	frappe.db.sql("delete from `tabLeave Allocation`")
+	
+	allocation = frappe.get_doc({
+		"doctype": "Leave Allocation",
+		"employee": employee or "_T-Employee-0001",
+		"leave_type": leave_type or "_Test Leave Type",
+		"from_date": "2013-01-01",
+		"to_date": "2015-12-31",
+		"new_leaves_allocated": 30
+	})
+	
+	allocation.insert(ignore_permissions=True)
+	allocation.submit()
diff --git a/erpnext/hr/doctype/leave_block_list/leave_block_list.json b/erpnext/hr/doctype/leave_block_list/leave_block_list.json
index 56b4454..7dc0dde 100644
--- a/erpnext/hr/doctype/leave_block_list/leave_block_list.json
+++ b/erpnext/hr/doctype/leave_block_list/leave_block_list.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Leave Block List Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Year", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Fiscal Year", 
    "permlevel": 0, 
@@ -64,6 +66,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -87,6 +90,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Applies to Company", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -109,6 +113,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Block Days", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -130,6 +135,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Leave Block List Dates", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Leave Block List Date", 
    "permlevel": 0, 
@@ -153,6 +159,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Allow Users", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -174,6 +181,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Leave Block List Allowed", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Leave Block List Allow", 
    "permlevel": 0, 
@@ -195,7 +203,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:55.691200", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:49.553862", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Leave Block List", 
diff --git a/erpnext/hr/doctype/leave_block_list/leave_block_list.py b/erpnext/hr/doctype/leave_block_list/leave_block_list.py
index d1e39de..5d913f2 100644
--- a/erpnext/hr/doctype/leave_block_list/leave_block_list.py
+++ b/erpnext/hr/doctype/leave_block_list/leave_block_list.py
@@ -58,7 +58,7 @@
 
 	# global
 	for block_list in frappe.db.sql_list("""select name from `tabLeave Block List`
-		where ifnull(applies_to_all_departments,0)=1 and company=%s""", company):
+		where applies_to_all_departments=1 and company=%s""", company):
 		add_block_list(block_list)
 
 	return list(set(block_lists))
diff --git a/erpnext/hr/doctype/leave_block_list_allow/leave_block_list_allow.json b/erpnext/hr/doctype/leave_block_list_allow/leave_block_list_allow.json
index 33a61d7..7d5092d 100644
--- a/erpnext/hr/doctype/leave_block_list_allow/leave_block_list_allow.json
+++ b/erpnext/hr/doctype/leave_block_list_allow/leave_block_list_allow.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Allow User", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "User", 
    "permlevel": 0, 
@@ -40,7 +41,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:55.787281", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:49.599178", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Leave Block List Allow", 
diff --git a/erpnext/hr/doctype/leave_block_list_date/leave_block_list_date.json b/erpnext/hr/doctype/leave_block_list_date/leave_block_list_date.json
index 52da5b6..119e200 100644
--- a/erpnext/hr/doctype/leave_block_list_date/leave_block_list_date.json
+++ b/erpnext/hr/doctype/leave_block_list_date/leave_block_list_date.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Block Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -41,6 +42,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Reason", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -62,7 +64,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:55.839918", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:49.626901", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Leave Block List Date", 
diff --git a/erpnext/hr/doctype/leave_type/leave_type.json b/erpnext/hr/doctype/leave_type/leave_type.json
index f7f96b6..e218ecd 100644
--- a/erpnext/hr/doctype/leave_type/leave_type.json
+++ b/erpnext/hr/doctype/leave_type/leave_type.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Leave Type Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "leave_type_name", 
    "oldfieldtype": "Data", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Max Days Leave Allowed", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "max_days_allowed", 
    "oldfieldtype": "Data", 
@@ -66,6 +68,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Is Carry Forward", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_carry_forward", 
    "oldfieldtype": "Check", 
@@ -89,6 +92,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Is Encash", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_encash", 
    "oldfieldtype": "Check", 
@@ -112,6 +116,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Leave Without Pay", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -133,6 +138,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Allow Negative Balance", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -154,6 +160,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Include holidays within leaves as leaves", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -174,7 +181,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:55.903280", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:49.659028", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Leave Type", 
diff --git a/erpnext/hr/doctype/offer_letter/offer_letter.json b/erpnext/hr/doctype/offer_letter/offer_letter.json
index cd83d1e..f0000a4 100644
--- a/erpnext/hr/doctype/offer_letter/offer_letter.json
+++ b/erpnext/hr/doctype/offer_letter/offer_letter.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Job Applicant", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Job Applicant", 
    "permlevel": 0, 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Applicant Name", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "job_applicant.applicant_name", 
    "permlevel": 0, 
@@ -66,6 +68,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -87,7 +90,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Awaiting Response\nAccepted\nRejected", 
    "permlevel": 0, 
@@ -112,6 +116,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Offer Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -134,6 +139,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Designation", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Designation", 
    "permlevel": 0, 
@@ -157,6 +163,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -179,6 +186,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -201,6 +209,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Offer Letter Terms", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Offer Letter Term", 
    "permlevel": 0, 
@@ -223,6 +232,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -245,6 +255,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Select Terms and Conditions", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Terms and Conditions", 
    "permlevel": 0, 
@@ -268,6 +279,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms and Conditions", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "", 
    "permlevel": 0, 
@@ -291,6 +303,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Offer Letter", 
    "permlevel": 0, 
@@ -310,7 +323,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:58.043259", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:50.746594", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Offer Letter", 
diff --git a/erpnext/hr/doctype/offer_letter_term/offer_letter_term.json b/erpnext/hr/doctype/offer_letter_term/offer_letter_term.json
index ff98be8..b34eabc 100644
--- a/erpnext/hr/doctype/offer_letter_term/offer_letter_term.json
+++ b/erpnext/hr/doctype/offer_letter_term/offer_letter_term.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Offer Term", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Offer Term", 
    "permlevel": 0, 
@@ -41,6 +42,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -63,6 +65,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Value / Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -82,7 +85,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:58.211366", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:50.811208", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Offer Letter Term", 
diff --git a/erpnext/hr/doctype/offer_term/offer_term.json b/erpnext/hr/doctype/offer_term/offer_term.json
index ed6ad87..03e8ccc 100644
--- a/erpnext/hr/doctype/offer_term/offer_term.json
+++ b/erpnext/hr/doctype/offer_term/offer_term.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Offer Term", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -39,7 +40,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:58.280068", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:50.848215", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Offer Term", 
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.json b/erpnext/hr/doctype/salary_slip/salary_slip.json
index 3788df0..2680b52 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.json
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.json
@@ -17,6 +17,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -40,6 +41,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Employee", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "employee", 
    "oldfieldtype": "Link", 
@@ -64,6 +66,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Employee Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "employee_name", 
    "oldfieldtype": "Data", 
@@ -87,6 +90,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Department", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "department", 
    "oldfieldtype": "Link", 
@@ -111,6 +115,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Designation", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "designation", 
    "oldfieldtype": "Link", 
@@ -135,6 +140,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Branch", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "branch", 
    "oldfieldtype": "Link", 
@@ -159,6 +165,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Letter Head", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Letter Head", 
    "permlevel": 0, 
@@ -181,6 +188,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -202,6 +210,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -224,7 +233,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
-   "label": "Month",  
+   "label": "Month", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "month", 
    "oldfieldtype": "Select", 
@@ -250,6 +260,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Data", 
@@ -274,6 +285,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Working Days", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "total_days_in_month", 
    "oldfieldtype": "Int", 
@@ -297,6 +309,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Leave Without Pay", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "leave_without_pay", 
    "oldfieldtype": "Currency", 
@@ -320,6 +333,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Payment Days", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "payment_days", 
    "oldfieldtype": "Float", 
@@ -343,6 +357,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Bank Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "bank_name", 
    "oldfieldtype": "Data", 
@@ -366,6 +381,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Bank Account No.", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "bank_account_no", 
    "oldfieldtype": "Data", 
@@ -389,6 +405,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Email", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "email_check", 
    "oldfieldtype": "Check", 
@@ -412,6 +429,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Data", 
@@ -436,6 +454,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Earning & Deduction", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -458,6 +477,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Earning", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -480,6 +500,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "options": "<label>Earnings</label>", 
    "permlevel": 0, 
@@ -502,6 +523,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Earnings", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "earning_details", 
    "oldfieldtype": "Table", 
@@ -526,6 +548,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Deduction", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -548,6 +571,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "options": "<label>Deductions</label>", 
    "permlevel": 0, 
@@ -570,6 +594,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Deductions", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "deduction_details", 
    "oldfieldtype": "Table", 
@@ -594,6 +619,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -615,6 +641,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -635,6 +662,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -656,6 +684,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Arrear Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "arrear_amount", 
    "oldfieldtype": "Currency", 
@@ -680,6 +709,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Leave Encashment Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "encashment_amount", 
    "oldfieldtype": "Currency", 
@@ -704,6 +734,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Gross Pay", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "gross_pay", 
    "oldfieldtype": "Currency", 
@@ -728,6 +759,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Deduction", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "total_deduction", 
    "oldfieldtype": "Currency", 
@@ -753,6 +785,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Pay", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "net_pay", 
    "oldfieldtype": "Currency", 
@@ -777,6 +810,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rounded Total", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -800,6 +834,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total in words", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "net_pay_in_words", 
    "oldfieldtype": "Data", 
@@ -822,7 +857,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:08.187427", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:55.474041", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Salary Slip", 
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py
index 9a06c36..88d1402 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.py
@@ -23,25 +23,27 @@
 			self.get_leave_details()
 			struct = self.check_sal_struct()
 			if struct:
+				self.set("earnings", [])
+				self.set("deduction", [])
 				self.pull_sal_struct(struct)
 
 	def check_sal_struct(self):
 		m = get_month_details(self.fiscal_year, self.month)
 		struct = frappe.db.sql("""select name from `tabSalary Structure`
-			where employee=%s and is_active = 'Yes' 
-			and from_date <= %s and (to_date is null or to_date >= %s)""", 
+			where employee=%s and is_active = 'Yes'
+			and from_date <= %s and (to_date is null or to_date >= %s)""",
 			(self.employee, m.month_start_date, m.month_end_date))
-		
+
 		if not struct:
 			msgprint(_("No active Salary Structure found for employee {0} and the month")
 				.format(self.employee))
 			self.employee = None
-		
+
 		return struct and struct[0][0] or ''
 
 	def pull_sal_struct(self, struct):
 		from erpnext.hr.doctype.salary_structure.salary_structure import make_salary_slip
-		self.update(make_salary_slip(struct, self).as_dict())
+		make_salary_slip(struct, self)
 
 	def pull_emp_details(self):
 		emp = frappe.db.get_value("Employee", self.employee,
@@ -103,7 +105,7 @@
 		if not holidays:
 			holidays = frappe.db.sql("""select t1.holiday_date
 				from `tabHoliday` t1, `tabHoliday List` t2
-				where t1.parent = t2.name and ifnull(t2.is_default, 0) = 1
+				where t1.parent = t2.name and t2.is_default = 1
 				and t2.fiscal_year = %s
 				and t1.holiday_date between %s and %s""", (self.fiscal_year,
 					m['month_start_date'], m['month_end_date']))
@@ -119,7 +121,7 @@
 					select t1.name, t1.half_day
 					from `tabLeave Application` t1, `tabLeave Type` t2
 					where t2.name = t1.leave_type
-					and ifnull(t2.is_lwp, 0) = 1
+					and t2.is_lwp = 1
 					and t1.docstatus = 1
 					and t1.employee = %s
 					and %s between from_date and to_date
diff --git a/erpnext/hr/doctype/salary_slip/test_salary_slip.py b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
index fb69440..9eda231 100644
--- a/erpnext/hr/doctype/salary_slip/test_salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
@@ -7,23 +7,14 @@
 from frappe.utils import today
 from erpnext.hr.doctype.employee.employee import make_salary_structure
 from erpnext.hr.doctype.salary_structure.salary_structure import make_salary_slip
+from erpnext.hr.doctype.leave_application.test_leave_application import make_allocation_record
 
 class TestSalarySlip(unittest.TestCase):
 	def setUp(self):
 		for dt in ["Leave Application", "Leave Allocation", "Salary Slip"]:
 			frappe.db.sql("delete from `tab%s`" % dt)
 		
-		allocation = frappe.get_doc({
-			"doctype": "Leave Allocation",
-			"employee": "_T-Employee-0001",
-			"leave_type": "_Test Leave Type LWP",
-			"from_date": "2013-01-01",
-			"to_date": "2015-12-31",
-			"new_leaves_allocated": 5
-		})
-		
-		allocation.insert()
-		allocation.submit()
+		make_allocation_record(leave_type="_Test Leave Type LWP")
 		
 		frappe.db.set_value("Holiday List", "_Test Holiday List", "is_default", 1)
 		
diff --git a/erpnext/hr/doctype/salary_slip_deduction/salary_slip_deduction.json b/erpnext/hr/doctype/salary_slip_deduction/salary_slip_deduction.json
index 4f95197..a0e722e 100644
--- a/erpnext/hr/doctype/salary_slip_deduction/salary_slip_deduction.json
+++ b/erpnext/hr/doctype/salary_slip_deduction/salary_slip_deduction.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "d_type", 
    "oldfieldtype": "Data", 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "d_amount", 
    "oldfieldtype": "Currency", 
@@ -68,6 +70,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Depends on Leave Without Pay", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -89,6 +92,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -109,7 +113,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:08.470369", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:55.610195", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Salary Slip Deduction", 
diff --git a/erpnext/hr/doctype/salary_slip_earning/salary_slip_earning.json b/erpnext/hr/doctype/salary_slip_earning/salary_slip_earning.json
index 7e7eb0c..6d897b0 100644
--- a/erpnext/hr/doctype/salary_slip_earning/salary_slip_earning.json
+++ b/erpnext/hr/doctype/salary_slip_earning/salary_slip_earning.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "e_type", 
    "oldfieldtype": "Data", 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "e_amount", 
    "oldfieldtype": "Currency", 
@@ -68,6 +70,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Depends on Leave Without Pay", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -89,6 +92,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -109,7 +113,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:08.554281", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:55.649418", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Salary Slip Earning", 
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.json b/erpnext/hr/doctype/salary_structure/salary_structure.json
index f1562d4..a8aab41 100644
--- a/erpnext/hr/doctype/salary_structure/salary_structure.json
+++ b/erpnext/hr/doctype/salary_structure/salary_structure.json
@@ -17,6 +17,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -39,6 +40,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Employee", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "employee", 
    "oldfieldtype": "Link", 
@@ -63,6 +65,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Employee Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "employee_name", 
    "oldfieldtype": "Data", 
@@ -86,6 +89,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Branch", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "branch", 
    "oldfieldtype": "Select", 
@@ -110,6 +114,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Designation", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "designation", 
    "oldfieldtype": "Select", 
@@ -134,6 +139,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Department", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "department", 
    "oldfieldtype": "Select", 
@@ -157,6 +163,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -179,7 +186,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
-   "label": "Is Active",  
+   "label": "Is Active", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_active", 
    "oldfieldtype": "Select", 
@@ -204,6 +212,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "From Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "from_date", 
    "oldfieldtype": "Date", 
@@ -227,6 +236,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "To Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "to_date", 
    "oldfieldtype": "Date", 
@@ -250,6 +260,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -273,6 +284,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Monthly Earning & Deduction", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "earning_deduction", 
    "oldfieldtype": "Section Break", 
@@ -296,6 +308,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Earning", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "col_brk2", 
    "oldfieldtype": "Column Break", 
@@ -320,6 +333,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Earnings", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "earning_details", 
    "oldfieldtype": "Table", 
@@ -344,6 +358,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Deduction", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "col_brk3", 
    "oldfieldtype": "Column Break", 
@@ -368,6 +383,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Deductions", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "deduction_details", 
    "oldfieldtype": "Table", 
@@ -391,6 +407,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Simple", 
    "permlevel": 0, 
@@ -412,6 +429,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -434,6 +452,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Earning", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "total_earning", 
    "oldfieldtype": "Currency", 
@@ -458,6 +477,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Deduction", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "total_deduction", 
    "oldfieldtype": "Currency", 
@@ -481,6 +501,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -503,6 +524,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Pay", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -524,7 +546,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:08.646657", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:55.695905", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Salary Structure", 
diff --git a/erpnext/hr/doctype/salary_structure_deduction/salary_structure_deduction.json b/erpnext/hr/doctype/salary_structure_deduction/salary_structure_deduction.json
index c9f4b0e..3a718aa 100644
--- a/erpnext/hr/doctype/salary_structure_deduction/salary_structure_deduction.json
+++ b/erpnext/hr/doctype/salary_structure_deduction/salary_structure_deduction.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "d_type", 
    "oldfieldtype": "Select", 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "d_modified_amt", 
    "oldfieldtype": "Currency", 
@@ -68,6 +70,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reduce Deduction for Leave Without Pay (LWP)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "depend_on_lwp", 
    "oldfieldtype": "Check", 
@@ -89,7 +92,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:08.845127", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:55.793274", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Salary Structure Deduction", 
diff --git a/erpnext/hr/doctype/salary_structure_earning/salary_structure_earning.json b/erpnext/hr/doctype/salary_structure_earning/salary_structure_earning.json
index fbad302..8dfcb0a 100644
--- a/erpnext/hr/doctype/salary_structure_earning/salary_structure_earning.json
+++ b/erpnext/hr/doctype/salary_structure_earning/salary_structure_earning.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "e_type", 
    "oldfieldtype": "Data", 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "modified_value", 
    "oldfieldtype": "Currency", 
@@ -68,6 +70,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reduce Earning for Leave Without Pay (LWP)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "depend_on_lwp", 
    "oldfieldtype": "Check", 
@@ -89,7 +92,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:08.956826", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:55.830492", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Salary Structure Earning", 
diff --git a/erpnext/hr/print_format/offer_letter/offer_letter.json b/erpnext/hr/print_format/offer_letter/offer_letter.json
index d480159..40a3fe1 100644
--- a/erpnext/hr/print_format/offer_letter/offer_letter.json
+++ b/erpnext/hr/print_format/offer_letter/offer_letter.json
@@ -5,8 +5,8 @@
  "doc_type": "Offer Letter", 
  "docstatus": 0, 
  "doctype": "Print Format", 
- "html": "{% if letter_head and not no_letterhead -%}\n    <div class=\"letter-head\">{{ letter_head }}</div>\n    <hr>\n{%- endif %}\n\n<div class=\"page-break\">\n<p>\n\n<!-- offer letter content starts here, <br> is used to create new lines -->\nDate: {{ doc.offer_date }}\n<br><br>\n\nDear {{ doc.applicant_name }}, \n\n<br><br>\n\nWe are pleased to appoint you in the services of {{ doc.company }} on the terms and conditions detailed in this letter.\n\n<br><br>\n\nYour designation shall be <b>{{ doc.designation }}</b>.\n\n<br><br>\n\n<!-- offer letter terms and description from the table -->\n\n{%- if doc.offer_terms -%}\n    {%- for row in doc.offer_terms -%}\n        <b>{{ row.offer_term }}:</b> {{ row.value }}\n\n        <br>\n    {%- endfor -%}\n{%- endif -%}\n\n<br>\n\n<!-- offer letter content continues -->\n\n\nPlease read the detailed terms as below. If you have any queries, feel free to get in touch with us.\nWe look forward to your long and fruitful career association with our organisation.\nIf you decide to join us, 'Welcome to {{ doc.company }} !'\n\n<br><br>\n\n<p class=\"strong\">\n\nYours truly,\n\n<br><br><br><br>\n\nAuthorized Signatory\n\n<br>\n\n{{ doc.company }}\n\n<!-- offer letter content ends here -->\n\n</p>\n</div>\n\n<!-- offer letter terms and conditions -->\n<div> {{ doc.terms }} </div>", 
- "modified": "2015-04-01 05:22:51.345050", 
+ "html": "{% set terms_exist = (doc.terms|striptags).strip() %}\n\n{% if letter_head and not no_letterhead -%}\n    <div class=\"letter-head\">{{ letter_head }}</div>\n    <hr>\n{%- endif %}\n\n<div {% if terms_exist -%} class=\"page-break\" {%- endif %}>\n<p>\n\n<!-- offer letter content starts here, <br> is used to create new lines -->\nDate: {{ doc.offer_date }}\n<br><br>\n\nDear {{ doc.applicant_name }}, \n\n<br><br>\n\nWe are pleased to appoint you in the services of {{ doc.company }} on the terms and conditions detailed in this letter.\n\n<br><br>\n\nYour designation shall be <b>{{ doc.designation }}</b>.\n\n<br><br>\n\n<!-- offer letter terms and description from the table -->\n\n{%- if doc.offer_terms -%}\n    {%- for row in doc.offer_terms -%}\n        <b>{{ row.offer_term }}:</b> {{ row.value }}\n\n        <br>\n    {%- endfor -%}\n{%- endif -%}\n\n<br>\n\n<!-- offer letter content continues -->\n\n\nPlease read the detailed terms as below. If you have any queries, feel free to get in touch with us.\nWe look forward to your long and fruitful career association with our organisation.\nIf you decide to join us, 'Welcome to {{ doc.company }} !'\n\n<br><br>\n\n<p class=\"strong\">\n\nYours truly,\n\n<br><br><br><br>\n\nAuthorized Signatory\n\n<br>\n\n{{ doc.company }}\n\n<!-- offer letter content ends here -->\n\n</p>\n</div>\n\n<!-- offer letter terms and conditions -->\n{% if terms_exist %}\n<div> {{ doc.terms }} </div>\n{% endif %}", 
+ "modified": "2015-11-18 12:53:04.997745", 
  "modified_by": "Administrator", 
  "name": "Offer Letter", 
  "owner": "Administrator", 
diff --git a/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py b/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py
index 48fe3ae..8b02348 100644
--- a/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py
+++ b/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py
@@ -43,11 +43,11 @@
 	]
 	
 	earning_types = frappe.db.sql_list("""select distinct e_type from `tabSalary Slip Earning`
-		where ifnull(e_modified_amount, 0) != 0 and parent in (%s)""" % 
+		where e_modified_amount != 0 and parent in (%s)""" % 
 		(', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]))
 		
 	ded_types = frappe.db.sql_list("""select distinct d_type from `tabSalary Slip Deduction`
-		where ifnull(d_modified_amount, 0) != 0 and parent in (%s)""" % 
+		where d_modified_amount != 0 and parent in (%s)""" % 
 		(', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]))
 		
 	columns = columns + [(e + ":Currency:120") for e in earning_types] + \
diff --git a/erpnext/hub_node/doctype/hub_settings/hub_settings.py b/erpnext/hub_node/doctype/hub_settings/hub_settings.py
index cf48381..8522650 100644
--- a/erpnext/hub_node/doctype/hub_settings/hub_settings.py
+++ b/erpnext/hub_node/doctype/hub_settings/hub_settings.py
@@ -78,7 +78,7 @@
 			if item.image:
 				item.image = expand_relative_urls(item.image)
 
-		item_list = frappe.db.sql_list("select name from tabItem where ifnull(publish_in_hub,0)=1")
+		item_list = frappe.db.sql_list("select name from tabItem where publish_in_hub=1")
 
 		if items:
 			response = requests.post(self.hub_url + "/api/method/hub.hub.api.sync", data={
diff --git a/erpnext/manufacturing/doctype/bom/bom.json b/erpnext/manufacturing/doctype/bom/bom.json
index e5abc07..bb74e1d 100644
--- a/erpnext/manufacturing/doctype/bom/bom.json
+++ b/erpnext/manufacturing/doctype/bom/bom.json
@@ -20,6 +20,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item", 
    "oldfieldtype": "Link", 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -66,6 +68,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rate Of Materials Based On", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Valuation Rate\nLast Purchase Rate\nPrice List", 
    "permlevel": 0, 
@@ -89,6 +92,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Price List", 
    "permlevel": 0, 
@@ -110,6 +114,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -132,6 +137,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Is Active", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "is_active", 
    "oldfieldtype": "Select", 
@@ -156,6 +162,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Is Default", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "is_default", 
    "oldfieldtype": "Check", 
@@ -180,6 +187,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "With Operations", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -203,6 +211,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Operations", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -225,6 +234,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Operations", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "bom_operations", 
    "oldfieldtype": "Table", 
@@ -249,6 +259,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Materials", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -271,6 +282,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Items", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "bom_materials", 
    "oldfieldtype": "Table", 
@@ -297,6 +309,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Quantity", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "quantity", 
    "oldfieldtype": "Currency", 
@@ -320,6 +333,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Costing", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -342,6 +356,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Operating Cost", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -364,6 +379,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Raw Material Cost", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -385,6 +401,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -406,6 +423,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Total Cost", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -428,6 +446,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -449,6 +468,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Project Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "project_name", 
    "oldfieldtype": "Link", 
@@ -473,6 +493,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -496,6 +517,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "BOM", 
    "permlevel": 0, 
@@ -517,6 +539,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -538,6 +561,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "UOM", 
    "permlevel": 0, 
@@ -559,6 +583,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -581,6 +606,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Desription", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -601,6 +627,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -623,6 +650,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -645,6 +673,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image View", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "image", 
    "permlevel": 0, 
@@ -669,6 +698,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Materials Required (Exploded)", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -690,6 +720,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Exploded_items", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "flat_bom_details", 
    "oldfieldtype": "Table", 
@@ -713,7 +744,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-19 03:04:50.130520", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:42.637983", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "BOM", 
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index 9a3d318..ff12c04 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -163,7 +163,7 @@
 		if valuation_rate <= 0:
 			last_valuation_rate = frappe.db.sql("""select valuation_rate
 				from `tabStock Ledger Entry`
-				where item_code = %s and ifnull(valuation_rate, 0) > 0
+				where item_code = %s and valuation_rate > 0
 				order by posting_date desc, posting_time desc, name desc limit 1""", args['item_code'])
 
 			valuation_rate = flt(last_valuation_rate[0][0]) if last_valuation_rate else 0
@@ -323,7 +323,7 @@
 		# Did not use qty_consumed_per_unit in the query, as it leads to rounding loss
 		child_fb_items = frappe.db.sql("""select bom_item.item_code, bom_item.item_name, bom_item.description,
 			bom_item.stock_uom, bom_item.qty, bom_item.rate,
-			ifnull(bom_item.qty, 0 ) / ifnull(bom.quantity, 1) as qty_consumed_per_unit
+			bom_item.qty / ifnull(bom.quantity, 1) as qty_consumed_per_unit
 			from `tabBOM Explosion Item` bom_item, tabBOM bom
 			where bom_item.parent = bom.name and bom.name = %s and bom.docstatus = 1""", bom_no, as_dict = 1)
 
@@ -371,7 +371,7 @@
 	query = """select
 				bom_item.item_code,
 				item.item_name,
-				sum(ifnull(bom_item.qty, 0)/ifnull(bom.quantity, 1)) * %(qty)s as qty,
+				sum(bom_item.qty/ifnull(bom.quantity, 1)) * %(qty)s as qty,
 				item.description,
 				item.image,
 				item.stock_uom,
diff --git a/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json b/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json
index f51bdfb..95fe205 100644
--- a/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json
+++ b/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -43,6 +44,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -65,6 +67,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -86,6 +89,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -108,6 +112,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Text", 
@@ -132,6 +137,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -154,6 +160,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -176,6 +183,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image View", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "image", 
    "permlevel": 0, 
@@ -198,6 +206,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -220,6 +229,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "qty", 
    "oldfieldtype": "Currency", 
@@ -243,6 +253,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "standard_rate", 
    "oldfieldtype": "Currency", 
@@ -267,6 +278,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Qty Consumed Per Unit", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -287,6 +299,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -309,6 +322,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Stock UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "stock_uom", 
    "oldfieldtype": "Link", 
@@ -333,6 +347,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "amount_as_per_sr", 
    "oldfieldtype": "Currency", 
@@ -355,7 +370,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-19 03:04:51.159841", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:42.765051", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "BOM Explosion Item", 
diff --git a/erpnext/manufacturing/doctype/bom_item/bom_item.json b/erpnext/manufacturing/doctype/bom_item/bom_item.json
index 89ba0da..f87b381 100644
--- a/erpnext/manufacturing/doctype/bom_item/bom_item.json
+++ b/erpnext/manufacturing/doctype/bom_item/bom_item.json
@@ -18,6 +18,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -63,6 +65,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -85,6 +88,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "BOM No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "bom_no", 
    "oldfieldtype": "Link", 
@@ -110,6 +114,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -132,6 +137,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Text", 
@@ -156,6 +162,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -177,6 +184,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -199,6 +207,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image View", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "image", 
    "permlevel": 0, 
@@ -222,6 +231,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Quantity and Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -243,6 +253,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "qty", 
    "oldfieldtype": "Currency", 
@@ -267,6 +278,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -288,6 +300,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -309,6 +322,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Stock UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "stock_uom", 
    "oldfieldtype": "Data", 
@@ -333,6 +347,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "amount_as_per_mar", 
    "oldfieldtype": "Currency", 
@@ -359,6 +374,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Scrap %", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "scrap", 
    "oldfieldtype": "Currency", 
@@ -382,6 +398,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Qty Consumed Per Unit", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "qty_consumed_per_unit", 
    "oldfieldtype": "Float", 
@@ -403,7 +420,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-19 03:04:51.064785", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:42.842612", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "BOM Item", 
diff --git a/erpnext/manufacturing/doctype/bom_operation/bom_operation.json b/erpnext/manufacturing/doctype/bom_operation/bom_operation.json
index fdeb319..0171c41 100644
--- a/erpnext/manufacturing/doctype/bom_operation/bom_operation.json
+++ b/erpnext/manufacturing/doctype/bom_operation/bom_operation.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Operation", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "operation_no", 
    "oldfieldtype": "Data", 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Workstation", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "workstation", 
    "oldfieldtype": "Link", 
@@ -66,6 +68,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Operation Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "opn_description", 
    "oldfieldtype": "Text", 
@@ -88,6 +91,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -109,6 +113,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Hour Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "hour_rate", 
    "oldfieldtype": "Currency", 
@@ -133,6 +138,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Operation Time ", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "time_in_mins", 
    "oldfieldtype": "Currency", 
@@ -157,6 +163,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Operating Cost", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "operating_cost", 
    "oldfieldtype": "Currency", 
@@ -178,7 +185,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:40.479962", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:42.924201", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "BOM Operation", 
diff --git a/erpnext/manufacturing/doctype/operation/operation.json b/erpnext/manufacturing/doctype/operation/operation.json
index 9331e50..66d0bb6 100644
--- a/erpnext/manufacturing/doctype/operation/operation.json
+++ b/erpnext/manufacturing/doctype/operation/operation.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Default Workstation", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Workstation", 
    "permlevel": 0, 
@@ -42,6 +43,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -64,6 +66,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Operation Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -84,7 +87,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:58.335483", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:50.879598", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "Operation", 
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.json b/erpnext/manufacturing/doctype/production_order/production_order.json
index db1c5fd..ee39e04 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.json
+++ b/erpnext/manufacturing/doctype/production_order/production_order.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-gift", 
    "permlevel": 0, 
@@ -41,7 +42,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Series",  
+   "label": "Series", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "PRO-", 
    "permlevel": 0, 
@@ -65,7 +67,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "status", 
    "oldfieldtype": "Select", 
@@ -90,6 +93,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item To Manufacture", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "production_item", 
    "oldfieldtype": "Link", 
@@ -116,6 +120,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "BOM No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "bom_no", 
    "oldfieldtype": "Link", 
@@ -142,6 +147,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Use Multi-Level BOM", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -162,6 +168,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -186,6 +193,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Qty To Manufacture", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "qty", 
    "oldfieldtype": "Currency", 
@@ -212,6 +220,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Material Transferred for Manufacturing", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -237,6 +246,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Manufactured Qty", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "produced_qty", 
    "oldfieldtype": "Currency", 
@@ -260,6 +270,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Warehouses", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-building", 
    "permlevel": 0, 
@@ -282,6 +293,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Work-in-Progress Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Warehouse", 
    "permlevel": 0, 
@@ -303,6 +315,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -326,6 +339,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Target Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Warehouse", 
    "permlevel": 0, 
@@ -348,6 +362,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Time", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-time", 
    "permlevel": 0, 
@@ -372,6 +387,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Expected Delivery Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -394,6 +410,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Planned Start Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -416,6 +433,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Planned End Date", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -437,6 +455,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -459,6 +478,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Actual Start Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -481,6 +501,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Actual End Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -504,6 +525,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Operations", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-wrench", 
    "permlevel": 0, 
@@ -528,6 +550,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Operations", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Production Order Operation", 
    "permlevel": 0, 
@@ -552,6 +575,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Operation Cost", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "", 
    "permlevel": 0, 
@@ -575,6 +599,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Planned Operating Cost", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -598,6 +623,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Actual Operating Cost", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -621,6 +647,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Operating Cost", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -643,6 +670,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -665,6 +693,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Operating Cost", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -688,6 +717,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "More Information", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-file-text", 
    "permlevel": 0, 
@@ -710,6 +740,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -732,6 +763,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Stock UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "stock_uom", 
    "oldfieldtype": "Data", 
@@ -755,6 +787,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -777,6 +810,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Project Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "project_name", 
    "oldfieldtype": "Link", 
@@ -802,6 +836,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Order", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Sales Order", 
    "permlevel": 0, 
@@ -824,6 +859,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -848,6 +884,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Data", 
@@ -871,7 +908,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:01.425871", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:52.334735", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "Production Order", 
diff --git a/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json b/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json
index 20e24cc..923e534 100644
--- a/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json
+++ b/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -41,6 +42,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Operation", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "operation_no", 
    "oldfieldtype": "Data", 
@@ -66,6 +68,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Operation Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "opn_description", 
    "oldfieldtype": "Text", 
@@ -89,6 +92,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -112,6 +116,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Completed Qty", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -134,7 +139,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Pending\nWork in Progress\nCompleted", 
    "permlevel": 0, 
@@ -158,6 +164,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Workstation", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "workstation", 
    "oldfieldtype": "Link", 
@@ -184,6 +191,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Show Time Logs", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -206,6 +214,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Estimated Time and Cost", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -228,6 +237,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Planned Start Time", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -250,6 +260,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Planned End Time", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -271,6 +282,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -294,6 +306,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Operation Time", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "time_in_mins", 
    "oldfieldtype": "Currency", 
@@ -318,6 +331,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Hour Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "hour_rate", 
    "oldfieldtype": "Currency", 
@@ -342,6 +356,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Planned Operating Cost", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -365,6 +380,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Actual Time and Cost", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -387,6 +403,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Actual Start Time", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -410,6 +427,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Actual End Time", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -431,6 +449,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -454,6 +473,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Actual Operation Time", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -477,6 +497,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Actual Operating Cost", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -501,6 +522,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Make Time Log", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -520,7 +542,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:01.792804", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:52.476364", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "Production Order Operation", 
diff --git a/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.json b/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.json
index 69d09f8..49d31c9 100644
--- a/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.json
+++ b/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -45,6 +46,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "BOM No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "bom_no", 
    "oldfieldtype": "Link", 
@@ -71,6 +73,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Planned Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "planned_qty", 
    "oldfieldtype": "Currency", 
@@ -97,6 +100,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Planned Start Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -119,6 +123,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Sales Order", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "source_docname", 
    "oldfieldtype": "Data", 
@@ -143,6 +148,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "SO Pending Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "prevdoc_reqd_qty", 
    "oldfieldtype": "Currency", 
@@ -169,6 +175,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Warehouse", 
    "permlevel": 0, 
@@ -191,6 +198,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "stock_uom", 
    "oldfieldtype": "Data", 
@@ -217,6 +225,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Text", 
@@ -240,7 +249,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:01.982082", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:52.572122", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "Production Plan Item", 
diff --git a/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.json b/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.json
index c008e0b..d7fdea5 100644
--- a/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.json
+++ b/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Sales Order", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "prevdoc_docname", 
    "oldfieldtype": "Data", 
@@ -45,6 +46,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "SO Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "document_date", 
    "oldfieldtype": "Date", 
@@ -69,6 +71,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -91,6 +94,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Customer", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Customer", 
    "permlevel": 0, 
@@ -115,6 +119,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Grand Total", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -137,7 +142,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:02.081390", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:52.629618", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "Production Plan Sales Order", 
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
index 254b5a5..0fb1e34 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
@@ -59,7 +59,7 @@
 			where so_item.parent = so.name
 				and so.docstatus = 1 and so.status != "Stopped"
 				and so.company = %(company)s
-				and ifnull(so_item.qty, 0) > ifnull(so_item.delivered_qty, 0) {0}
+				and so_item.qty > so_item.delivered_qty {0}
 				and (exists (select name from `tabItem` item where item.name=so_item.item_code
 					and (item.is_pro_applicable = 1 or item.is_sub_contracted_item = 1 {1}))
 					or exists (select name from `tabPacked Item` pi
@@ -108,9 +108,9 @@
 			item_condition = ' and so_item.item_code = "' + self.fg_item + '"'
 
 		items = frappe.db.sql("""select distinct parent, item_code, warehouse,
-			(qty - ifnull(delivered_qty, 0)) as pending_qty
+			(qty - delivered_qty) as pending_qty
 			from `tabSales Order Item` so_item
-			where parent in (%s) and docstatus = 1 and ifnull(qty, 0) > ifnull(delivered_qty, 0)
+			where parent in (%s) and docstatus = 1 and qty > delivered_qty
 			and exists (select * from `tabItem` item where item.name=so_item.item_code
 				and (item.is_pro_applicable = 1
 					or item.is_sub_contracted_item = 1)) %s""" % \
@@ -120,12 +120,12 @@
 			item_condition = ' and pi.item_code = "' + self.fg_item + '"'
 
 		packed_items = frappe.db.sql("""select distinct pi.parent, pi.item_code, pi.warehouse as warehouse,
-			(((so_item.qty - ifnull(so_item.delivered_qty, 0)) * pi.qty) / so_item.qty)
+			(((so_item.qty - so_item.delivered_qty) * pi.qty) / so_item.qty)
 				as pending_qty
 			from `tabSales Order Item` so_item, `tabPacked Item` pi
 			where so_item.parent = pi.parent and so_item.docstatus = 1
 			and pi.parent_item = so_item.item_code
-			and so_item.parent in (%s) and ifnull(so_item.qty, 0) > ifnull(so_item.delivered_qty, 0)
+			and so_item.parent in (%s) and so_item.qty > so_item.delivered_qty
 			and exists (select * from `tabItem` item where item.name=pi.item_code
 				and (item.is_pro_applicable = 1
 					or item.is_sub_contracted_item = 1)) %s""" % \
@@ -243,7 +243,7 @@
 				# get all raw materials with sub assembly childs
 				# Did not use qty_consumed_per_unit in the query, as it leads to rounding loss
 				for d in frappe.db.sql("""select fb.item_code,
-					ifnull(sum(ifnull(fb.qty, 0)/ifnull(bom.quantity, 1)), 0) as qty,
+					ifnull(sum(fb.qty/ifnull(bom.quantity, 1)), 0) as qty,
 					fb.description, fb.stock_uom, it.min_order_qty
 					from `tabBOM Explosion Item` fb, `tabBOM` bom, `tabItem` it
 					where bom.name = fb.parent and it.name = fb.item_code
@@ -257,7 +257,7 @@
 				# Get all raw materials considering SA items as raw materials,
 				# so no childs of SA items
 				for d in frappe.db.sql("""select bom_item.item_code,
-					ifnull(sum(ifnull(bom_item.qty, 0)/ifnull(bom.quantity, 1)), 0) as qty,
+					ifnull(sum(bom_item.qty/ifnull(bom.quantity, 1)), 0) as qty,
 					bom_item.description, bom_item.stock_uom, item.min_order_qty
 					from `tabBOM Item` bom_item, `tabBOM` bom, tabItem item
 					where bom.name = bom_item.parent and bom.name = %s and bom_item.docstatus < 2
diff --git a/erpnext/manufacturing/doctype/workstation/workstation.json b/erpnext/manufacturing/doctype/workstation/workstation.json
index 60fcd85..93cc992 100644
--- a/erpnext/manufacturing/doctype/workstation/workstation.json
+++ b/erpnext/manufacturing/doctype/workstation/workstation.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Workstation Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "workstation_name", 
    "oldfieldtype": "Data", 
@@ -65,6 +67,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Text", 
@@ -88,6 +91,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -111,6 +115,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Holiday List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Holiday List", 
    "permlevel": 0, 
@@ -134,6 +139,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Operating Costs", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -157,6 +163,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Electricity Cost", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "hour_rate_electricity", 
    "oldfieldtype": "Currency", 
@@ -181,6 +188,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Consumable Cost", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "hour_rate_consumable", 
    "oldfieldtype": "Currency", 
@@ -203,6 +211,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -226,6 +235,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rent Cost", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "hour_rate_rent", 
    "oldfieldtype": "Currency", 
@@ -250,6 +260,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Wages", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "hour_rate_labour", 
    "oldfieldtype": "Currency", 
@@ -274,6 +285,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Hour Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "hour_rate", 
    "oldfieldtype": "Currency", 
@@ -297,6 +309,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Working Hours", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -319,6 +332,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Working Hours", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Workstation Working Hour", 
    "permlevel": 0, 
@@ -341,7 +355,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:20.400900", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:30:01.041198", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "Workstation", 
diff --git a/erpnext/manufacturing/doctype/workstation_working_hour/workstation_working_hour.json b/erpnext/manufacturing/doctype/workstation_working_hour/workstation_working_hour.json
index 51a14be..1a4c9ea 100644
--- a/erpnext/manufacturing/doctype/workstation_working_hour/workstation_working_hour.json
+++ b/erpnext/manufacturing/doctype/workstation_working_hour/workstation_working_hour.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Start Time", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -40,6 +41,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -62,6 +64,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "End Time", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -83,6 +86,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -105,7 +109,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Enabled",  
+   "label": "Enabled", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -125,7 +130,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:20.706021", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:30:01.107577", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "Workstation Working Hour", 
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 05723ca..1bf3e4b 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -233,3 +233,4 @@
 erpnext.patches.v6_6.remove_fiscal_year_from_leave_allocation
 execute:frappe.delete_doc_if_exists("DocType", "Stock UOM Replace Utility")
 erpnext.patches.v6_8.make_webform_standard
+erpnext.patches.v6_8.move_drop_ship_to_po_items
diff --git a/erpnext/patches/v6_8/move_drop_ship_to_po_items.py b/erpnext/patches/v6_8/move_drop_ship_to_po_items.py
new file mode 100644
index 0000000..c935831
--- /dev/null
+++ b/erpnext/patches/v6_8/move_drop_ship_to_po_items.py
@@ -0,0 +1,37 @@
+import frappe
+
+def execute():
+	frappe.reload_doctype("Purchase Order Item")
+	for po in frappe.get_all("Purchase Order", filters={"delivered_by_supplier": 1}, fields=["name"]):
+		purchase_order = frappe.get_doc("Purchase Order", po)
+		
+		for item in purchase_order.items:
+			if item.prevdoc_doctype == "Sales Order":
+				delivered_by_supplier = frappe.get_value("Sales Order Item", item.prevdoc_detail_docname, 
+					"delivered_by_supplier")
+				
+				if delivered_by_supplier:
+					frappe.db.sql("""update `tabPurchase Order Item` 
+						set delivered_by_supplier=1, billed_amt=amount, received_qty=qty
+						where name=%s """, item.name)
+						
+		update_per_received(purchase_order)
+		update_per_billed(purchase_order)
+	
+def update_per_received(po):
+	frappe.db.sql(""" update `tabPurchase Order` 
+				set per_received = round((select sum(if(qty > ifnull(received_qty, 0), 
+					ifnull(received_qty, 0), qty)) / sum(qty) *100 
+				from `tabPurchase Order Item` 
+				where parent = %(name)s), 2) 
+			where name = %(name)s """, {"name": po.name})
+
+def update_per_billed(po):
+	frappe.db.sql(""" update `tabPurchase Order` 
+				set per_billed = round((select sum( if(amount > ifnull(billed_amt, 0), 
+					ifnull(billed_amt, 0), amount)) / sum(amount) *100 
+				from `tabPurchase Order Item` 
+				where parent = %(name)s), 2) 
+			where name = %(name)s """, {"name": po.name})
+
+				
diff --git a/erpnext/projects/doctype/activity_cost/activity_cost.json b/erpnext/projects/doctype/activity_cost/activity_cost.json
index daa73ae..00ca43f 100644
--- a/erpnext/projects/doctype/activity_cost/activity_cost.json
+++ b/erpnext/projects/doctype/activity_cost/activity_cost.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Activity Type", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Activity Type", 
    "permlevel": 0, 
@@ -42,6 +43,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -64,6 +66,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Employee", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Employee", 
    "permlevel": 0, 
@@ -87,6 +90,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Employee Name", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "", 
    "permlevel": 0, 
@@ -109,6 +113,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -133,6 +138,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Billing Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -154,6 +160,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -178,6 +185,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Costing Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -200,6 +208,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "title", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -219,7 +228,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:37.693260", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:41.623039", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Activity Cost", 
diff --git a/erpnext/projects/doctype/activity_type/activity_type.json b/erpnext/projects/doctype/activity_type/activity_type.json
index 3834efb..020b685 100644
--- a/erpnext/projects/doctype/activity_type/activity_type.json
+++ b/erpnext/projects/doctype/activity_type/activity_type.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Activity Type", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -41,6 +42,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Costing Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -62,6 +64,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -84,6 +87,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Billing Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -105,7 +109,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:37.799221", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:41.673241", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Activity Type", 
diff --git a/erpnext/projects/doctype/dependent_task/dependent_task.json b/erpnext/projects/doctype/dependent_task/dependent_task.json
index 9f9eec8..6b660ca 100644
--- a/erpnext/projects/doctype/dependent_task/dependent_task.json
+++ b/erpnext/projects/doctype/dependent_task/dependent_task.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Task", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Task", 
    "permlevel": 0, 
@@ -39,7 +40,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:45.602997", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:45.201217", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Dependent Task", 
diff --git a/erpnext/projects/doctype/project/project.json b/erpnext/projects/doctype/project/project.json
index e4540ec..f1e59a4 100644
--- a/erpnext/projects/doctype/project/project.json
+++ b/erpnext/projects/doctype/project/project.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Project Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "project_name", 
    "oldfieldtype": "Data", 
@@ -44,7 +45,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "status", 
    "oldfieldtype": "Select", 
@@ -68,7 +70,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Project Type",  
+   "label": "Project Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "project_type", 
    "oldfieldtype": "Data", 
@@ -92,6 +95,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -113,7 +117,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Is Active",  
+   "label": "Is Active", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_active", 
    "oldfieldtype": "Select", 
@@ -137,7 +142,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Priority",  
+   "label": "Priority", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "priority", 
    "oldfieldtype": "Select", 
@@ -161,6 +167,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -183,6 +190,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Expected Start Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "project_start_date", 
    "oldfieldtype": "Date", 
@@ -205,6 +213,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -227,6 +236,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Expected End Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "completion_date", 
    "oldfieldtype": "Date", 
@@ -250,6 +260,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-user", 
@@ -273,6 +284,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer", 
    "oldfieldtype": "Link", 
@@ -296,6 +308,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -318,6 +331,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Order", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Sales Order", 
    "permlevel": 0, 
@@ -341,6 +355,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Tasks", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-flag", 
@@ -364,6 +379,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Tasks", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Project Task", 
    "permlevel": 0, 
@@ -387,6 +403,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "% Tasks Completed", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -408,6 +425,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-list", 
@@ -431,6 +449,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Notes", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "notes", 
    "oldfieldtype": "Text Editor", 
@@ -453,6 +472,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -475,6 +495,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Actual Start Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -497,6 +518,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Actual Time (in Hours)", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -518,6 +540,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -540,6 +563,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Actual End Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "act_completion_date", 
    "oldfieldtype": "Date", 
@@ -562,6 +586,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -584,6 +609,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Estimated Costing", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "project_value", 
    "oldfieldtype": "Currency", 
@@ -607,6 +633,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -629,6 +656,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -651,6 +679,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Cost Center", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Cost Center", 
    "permlevel": 0, 
@@ -673,6 +702,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-money", 
@@ -697,6 +727,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Costing Amount (via Time Logs)", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -720,6 +751,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Expense Claim (via Expense Claims)", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -741,6 +773,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -764,6 +797,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Billing Amount (via Time Logs)", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -786,6 +820,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Purchase Cost (via Purchase Invoice)", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -808,6 +843,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -831,6 +867,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Gross Margin", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "gross_margin_value", 
    "oldfieldtype": "Currency", 
@@ -854,6 +891,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -876,6 +914,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Gross Margin %", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "per_gross_margin", 
    "oldfieldtype": "Currency", 
@@ -900,7 +939,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 4, 
- "modified": "2015-10-02 07:39:02.200080", 
+ "modified": "2015-11-16 06:29:52.684371", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Project", 
diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py
index bb43419..368c9d5 100644
--- a/erpnext/projects/doctype/project/project.py
+++ b/erpnext/projects/doctype/project/project.py
@@ -90,15 +90,15 @@
 
 	def update_costing(self):
 		from_time_log = frappe.db.sql("""select
-			sum(ifnull(costing_amount, 0)) as costing_amount,
-			sum(ifnull(billing_amount, 0)) as billing_amount,
+			sum(costing_amount) as costing_amount,
+			sum(billing_amount) as billing_amount,
 			min(from_time) as start_date,
 			max(to_time) as end_date,
 			sum(hours) as time
 			from `tabTime Log` where project = %s and docstatus = 1""", self.name, as_dict=1)[0]
 
 		from_expense_claim = frappe.db.sql("""select
-			sum(ifnull(total_sanctioned_amount, 0)) as total_sanctioned_amount
+			sum(total_sanctioned_amount) as total_sanctioned_amount
 			from `tabExpense Claim` where project = %s and approval_status='Approved'
 			and docstatus = 1""",
 			self.name, as_dict=1)[0]
@@ -118,7 +118,7 @@
 			self.per_gross_margin = (self.gross_margin / flt(self.total_billing_amount)) *100
 
 	def update_purchase_costing(self):
-		total_purchase_cost = frappe.db.sql("""select sum(ifnull(base_net_amount, 0))
+		total_purchase_cost = frappe.db.sql("""select sum(base_net_amount)
 			from `tabPurchase Invoice Item` where project_name = %s and docstatus=1""", self.name)
 
 		self.total_purchase_cost = total_purchase_cost and total_purchase_cost[0][0] or 0
diff --git a/erpnext/projects/doctype/project_task/project_task.json b/erpnext/projects/doctype/project_task/project_task.json
index 1aa401f..51a4662 100644
--- a/erpnext/projects/doctype/project_task/project_task.json
+++ b/erpnext/projects/doctype/project_task/project_task.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Title", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -41,7 +42,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Open\nWorking\nPending Review\nClosed\nCancelled", 
    "permlevel": 0, 
@@ -66,6 +68,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "View Task", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -87,6 +90,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -109,6 +113,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Start Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -132,6 +137,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "End Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -153,6 +159,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -175,6 +182,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -197,6 +205,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Task ID", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Task", 
    "permlevel": 0, 
@@ -217,7 +226,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-12 10:24:11.748792", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:52.824820", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Project Task", 
diff --git a/erpnext/projects/doctype/task/task.json b/erpnext/projects/doctype/task/task.json
index 1d58af6..1dd2a5c 100644
--- a/erpnext/projects/doctype/task/task.json
+++ b/erpnext/projects/doctype/task/task.json
@@ -20,6 +20,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Subject", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "subject", 
    "oldfieldtype": "Data", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Project", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "project", 
    "oldfieldtype": "Link", 
@@ -66,6 +68,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -89,7 +92,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "status", 
    "oldfieldtype": "Select", 
@@ -113,7 +117,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
-   "label": "Priority",  
+   "label": "Priority", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "priority", 
    "oldfieldtype": "Select", 
@@ -137,6 +142,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "Simple", 
@@ -160,6 +166,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Details", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Text Editor", 
@@ -185,6 +192,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Depends On", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -207,6 +215,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "depends_on", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Task Depends On", 
    "permlevel": 0, 
@@ -229,6 +238,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -251,6 +261,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Expected Start Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "exp_start_date", 
    "oldfieldtype": "Date", 
@@ -276,6 +287,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Expected Time (in hours)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "exp_total_hrs", 
    "oldfieldtype": "Data", 
@@ -298,6 +310,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -320,6 +333,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Expected End Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "exp_end_date", 
    "oldfieldtype": "Date", 
@@ -344,6 +358,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -368,6 +383,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Actual Start Date (via Time Logs)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "act_start_date", 
    "oldfieldtype": "Date", 
@@ -393,6 +409,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Actual Time (in hours)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "", 
    "permlevel": 0, 
@@ -415,6 +432,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -437,6 +455,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Actual End Date (via Time Logs)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "act_end_date", 
    "oldfieldtype": "Date", 
@@ -459,6 +478,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -481,6 +501,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Costing Amount (via Time Logs)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "actual_budget", 
    "oldfieldtype": "Currency", 
@@ -505,6 +526,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Expense Claim (via Expense Claim)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -527,6 +549,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -549,6 +572,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Billing Amount (via Time Logs)", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -571,6 +595,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -593,6 +618,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Review Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "review_date", 
    "oldfieldtype": "Date", 
@@ -617,6 +643,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Closing Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "closing_date", 
    "oldfieldtype": "Date", 
@@ -639,6 +666,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -660,6 +688,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -682,7 +711,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 5, 
- "modified": "2015-10-02 07:39:16.010028", 
+ "modified": "2015-11-16 06:29:59.063379", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Task", 
diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py
index e5b3355..cd0aabe 100644
--- a/erpnext/projects/doctype/task/task.py
+++ b/erpnext/projects/doctype/task/task.py
@@ -53,7 +53,7 @@
 
 	def update_total_expense_claim(self):
 		self.total_expense_claim = frappe.db.sql("""select sum(total_sanctioned_amount) from `tabExpense Claim`
-			where project = %s and task = %s and approval_status = "Approved" and docstatus=1""",(self.project, self.name))
+			where project = %s and task = %s and approval_status = "Approved" and docstatus=1""",(self.project, self.name))[0][0]
 
 	def update_time_and_costing(self):
 		tl = frappe.db.sql("""select min(from_time) as start_date, max(to_time) as end_date,
diff --git a/erpnext/projects/doctype/task_depends_on/task_depends_on.json b/erpnext/projects/doctype/task_depends_on/task_depends_on.json
index 3d3914d..12782ea 100644
--- a/erpnext/projects/doctype/task_depends_on/task_depends_on.json
+++ b/erpnext/projects/doctype/task_depends_on/task_depends_on.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Task", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Task", 
    "permlevel": 0, 
@@ -41,6 +42,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -63,6 +65,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Subject", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "", 
    "permlevel": 0, 
@@ -83,7 +86,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:16.216665", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:59.161882", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Task Depends On", 
diff --git a/erpnext/projects/doctype/time_log/time_log.json b/erpnext/projects/doctype/time_log/time_log.json
index e4f57c5..4490f97 100644
--- a/erpnext/projects/doctype/time_log/time_log.json
+++ b/erpnext/projects/doctype/time_log/time_log.json
@@ -20,7 +20,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Series",  
+   "label": "Series", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "TL-", 
    "permlevel": 0, 
@@ -42,6 +43,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -63,7 +65,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Draft\nSubmitted\nBatched for Billing\nBilled\nCancelled", 
    "permlevel": 0, 
@@ -85,6 +88,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -107,6 +111,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "From Time", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -129,6 +134,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Hours", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -150,6 +156,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "To Time", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -170,6 +177,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -193,6 +201,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Activity Type", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Activity Type", 
    "permlevel": 0, 
@@ -216,6 +225,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Project", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Project", 
    "permlevel": 0, 
@@ -239,6 +249,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Task", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Task", 
    "permlevel": 0, 
@@ -260,6 +271,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -282,6 +294,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "User", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "User", 
    "permlevel": 0, 
@@ -305,6 +318,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Employee", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Employee", 
    "permlevel": 0, 
@@ -327,6 +341,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -348,6 +363,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "For Manufacturing", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -370,6 +386,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Billable", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -391,6 +408,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -414,6 +432,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Production Order", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Production Order", 
    "permlevel": 0, 
@@ -438,6 +457,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Operation", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Operation", 
    "permlevel": 0, 
@@ -462,6 +482,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Operation ID", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "", 
    "permlevel": 0, 
@@ -484,6 +505,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -507,6 +529,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Workstation", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Workstation", 
    "permlevel": 0, 
@@ -532,6 +555,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Completed Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -553,6 +577,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -574,6 +599,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Note", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -595,6 +621,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -619,6 +646,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Costing Rate based on Activity Type (per hour)", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -642,6 +670,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Costing Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -663,6 +692,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -687,6 +717,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Billing Rate based on Activity Type (per hour)", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -711,6 +742,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Billing Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -732,6 +764,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -755,6 +788,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Time Log Batch", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Time Log Batch", 
    "permlevel": 0, 
@@ -778,6 +812,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Invoice", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Sales Invoice", 
    "permlevel": 0, 
@@ -800,6 +835,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Time Log", 
    "permlevel": 1, 
@@ -822,6 +858,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Title", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -843,7 +880,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:16.759881", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:59.410559", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Time Log", 
diff --git a/erpnext/projects/doctype/time_log/time_log.py b/erpnext/projects/doctype/time_log/time_log.py
index cde733d..cd20036 100644
--- a/erpnext/projects/doctype/time_log/time_log.py
+++ b/erpnext/projects/doctype/time_log/time_log.py
@@ -203,7 +203,7 @@
 	def get_time_log_summary(self):
 		"""Returns 'Actual Operating Time'. """
 		return frappe.db.sql("""select
-			sum(hours*60) as mins, sum(ifnull(completed_qty, 0)) as completed_qty
+			sum(hours*60) as mins, sum(completed_qty) as completed_qty
 			from `tabTime Log`
 			where production_order = %s and operation_id = %s and docstatus=1""",
 			(self.production_order, self.operation_id), as_dict=1)[0]
diff --git a/erpnext/projects/doctype/time_log_batch/time_log_batch.json b/erpnext/projects/doctype/time_log_batch/time_log_batch.json
index 039190f..3ee6dee 100644
--- a/erpnext/projects/doctype/time_log_batch/time_log_batch.json
+++ b/erpnext/projects/doctype/time_log_batch/time_log_batch.json
@@ -20,7 +20,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Series",  
+   "label": "Series", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "TLB-", 
    "permlevel": 0, 
@@ -43,7 +44,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Draft\nSubmitted\nBilled\nCancelled", 
    "permlevel": 0, 
@@ -65,6 +67,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -87,6 +90,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Invoice", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Sales Invoice", 
    "permlevel": 0, 
@@ -108,6 +112,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -129,6 +134,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Time Logs", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Time Log Batch Detail", 
    "permlevel": 0, 
@@ -150,6 +156,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -174,6 +181,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Total Hours", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -194,6 +202,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -218,6 +227,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Billing Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -240,6 +250,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Time Log Batch", 
    "permlevel": 0, 
@@ -261,7 +272,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:17.042383", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:59.535984", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Time Log Batch", 
diff --git a/erpnext/projects/doctype/time_log_batch_detail/time_log_batch_detail.json b/erpnext/projects/doctype/time_log_batch_detail/time_log_batch_detail.json
index fe97937..ad89b74 100644
--- a/erpnext/projects/doctype/time_log_batch_detail/time_log_batch_detail.json
+++ b/erpnext/projects/doctype/time_log_batch_detail/time_log_batch_detail.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Time Log", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Time Log", 
    "permlevel": 0, 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Hours", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -62,6 +64,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -84,6 +87,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Activity Type", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -105,6 +109,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Billing Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -115,27 +120,6 @@
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
-  },
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "note", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Note", 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
   }
  ], 
  "hide_heading": 0, 
@@ -146,7 +130,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:17.158572", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:59.590738", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Time Log Batch Detail", 
@@ -154,4 +139,4 @@
  "permissions": [], 
  "read_only": 0, 
  "read_only_onload": 0
-}
+}
\ No newline at end of file
diff --git a/erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py b/erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py
index 5800156..559b02d 100644
--- a/erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py
+++ b/erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py
@@ -64,8 +64,8 @@
 
 	si_items = frappe.db.sql("""select si.project_name, sum(si_item.base_net_amount) as amount
 		from `tabSales Invoice` si, `tabSales Invoice Item` si_item
-		where si.name = si_item.parent and si.docstatus = 1 and ifnull(si.update_stock, 0) = 1
-		and ifnull(si.is_pos, 0) = 1 and ifnull(si.project_name, '') != ''
+		where si.name = si_item.parent and si.docstatus = 1 and si.update_stock = 1
+		and si.is_pos = 1 and ifnull(si.project_name, '') != ''
 		group by si.project_name""", as_dict=1)
 
 
diff --git a/erpnext/projects/utils.py b/erpnext/projects/utils.py
index fdd0b52..1f6e2b3 100644
--- a/erpnext/projects/utils.py
+++ b/erpnext/projects/utils.py
@@ -13,12 +13,12 @@
 @frappe.whitelist()
 def query_task(doctype, txt, searchfield, start, page_len, filters):
 	from frappe.desk.reportview import build_match_conditions
-	
+
 	search_string = "%%%s%%" % txt
 	order_by_string = "%s%%" % txt
 	match_conditions = build_match_conditions("Task")
 	match_conditions = ("and" + match_conditions) if match_conditions else ""
-	
+
 	return frappe.db.sql("""select name, subject from `tabTask`
 		where (`%s` like %s or `subject` like %s) %s
 		order by
@@ -26,7 +26,7 @@
 			case when `%s` like %s then 0 else 1 end,
 			`%s`,
 			subject
-		limit %s, %s""" % 
-		(searchfield, "%s", "%s", match_conditions, "%s", 
-			searchfield, "%s", searchfield, "%s", "%s"),
-		(search_string, search_string, order_by_string, order_by_string, start, page_len))
\ No newline at end of file
+		limit %s, %s""" %
+		(frappe.db.escape(searchfield), "%s", "%s", match_conditions, "%s",
+			frappe.db.escape(searchfield), "%s", frappe.db.escape(searchfield), "%s", "%s"),
+		(search_string, search_string, order_by_string, order_by_string, start, page_len))
diff --git a/erpnext/selling/doctype/campaign/campaign.json b/erpnext/selling/doctype/campaign/campaign.json
index 48f93e1..7283926 100644
--- a/erpnext/selling/doctype/campaign/campaign.json
+++ b/erpnext/selling/doctype/campaign/campaign.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Campaign", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Campaign Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "campaign_name", 
    "oldfieldtype": "Data", 
@@ -65,7 +67,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Naming Series",  
+   "label": "Naming Series", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Campaign-.####", 
    "permlevel": 0, 
@@ -88,6 +91,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Text", 
@@ -111,7 +115,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:41.191975", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:43.265411", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Campaign", 
diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json
index 7d6ad8f..e8efd5c 100644
--- a/erpnext/selling/doctype/customer/customer.json
+++ b/erpnext/selling/doctype/customer/customer.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-user", 
@@ -43,7 +44,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Series",  
+   "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "CUST-", 
    "permlevel": 0, 
@@ -66,6 +68,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Full Name", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "customer_name", 
    "oldfieldtype": "Data", 
@@ -88,7 +91,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Type",  
+   "label": "Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer_type", 
    "oldfieldtype": "Select", 
@@ -113,6 +117,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "From Lead", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "lead_name", 
    "oldfieldtype": "Link", 
@@ -136,6 +141,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -159,6 +165,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Customer Group", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer_group", 
    "oldfieldtype": "Link", 
@@ -184,6 +191,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Territory", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "territory", 
    "oldfieldtype": "Link", 
@@ -208,6 +216,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Tax ID", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -230,6 +239,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Frozen", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -252,6 +262,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -274,6 +285,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Billing Currency", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Currency", 
    "permlevel": 0, 
@@ -296,6 +308,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Price List", 
    "permlevel": 0, 
@@ -317,6 +330,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -339,6 +353,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Sales Taxes and Charges Template", 
    "permlevel": 0, 
@@ -362,6 +377,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address and Contact", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-map-marker", 
    "permlevel": 0, 
@@ -384,6 +400,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address HTML", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -404,6 +421,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -426,6 +444,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact HTML", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "HTML", 
    "permlevel": 0, 
@@ -449,6 +468,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Receivable Accounts", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -472,6 +492,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Accounts", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Party Account", 
    "permlevel": 0, 
@@ -495,6 +516,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Credit Limit", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -516,7 +538,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Credit Days Based On",  
+   "label": "Credit Days Based On", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nFixed Days\nLast Day of the Next Month", 
    "permlevel": 0, 
@@ -541,6 +564,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Credit Days", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "credit_days", 
    "oldfieldtype": "Int", 
@@ -564,6 +588,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Credit Limit", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "credit_limit", 
    "oldfieldtype": "Currency", 
@@ -589,6 +614,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Details", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-file-text", 
@@ -613,6 +639,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Details", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer_details", 
    "oldfieldtype": "Code", 
@@ -636,6 +663,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Website", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -658,6 +686,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Partner and Commission", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-group", 
@@ -681,6 +710,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Partner", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "default_sales_partner", 
    "oldfieldtype": "Link", 
@@ -705,6 +735,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Commission Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "default_commission_rate", 
    "oldfieldtype": "Currency", 
@@ -729,6 +760,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Team", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -751,6 +783,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Team Details", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "sales_team", 
    "oldfieldtype": "Table", 
@@ -775,6 +808,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Communications", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Communication", 
    "permlevel": 0, 
@@ -796,7 +830,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:43.465791", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:44.236132", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Customer", 
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index 01e4813..0dd60ae 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -137,7 +137,7 @@
 			{"customer": customer, "docstatus": ["!=", 2] }, "count(*)")
 
 	billing_this_year = frappe.db.sql("""
-		select sum(ifnull(debit_in_account_currency, 0)) - sum(ifnull(credit_in_account_currency, 0))
+		select sum(debit_in_account_currency) - sum(credit_in_account_currency)
 		from `tabGL Entry`
 		where voucher_type='Sales Invoice' and party_type = 'Customer'
 			and party=%s and fiscal_year = %s""",
@@ -189,17 +189,17 @@
 
 def get_customer_outstanding(customer, company):
 	# Outstanding based on GL Entries
-	outstanding_based_on_gle = frappe.db.sql("""select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
+	outstanding_based_on_gle = frappe.db.sql("""select sum(debit) - sum(credit)
 		from `tabGL Entry` where party_type = 'Customer' and party = %s and company=%s""", (customer, company))
 
 	outstanding_based_on_gle = flt(outstanding_based_on_gle[0][0]) if outstanding_based_on_gle else 0
 
 	# Outstanding based on Sales Order
 	outstanding_based_on_so = frappe.db.sql("""
-		select sum(base_grand_total*(100 - ifnull(per_billed, 0))/100)
+		select sum(base_grand_total*(100 - per_billed)/100)
 		from `tabSales Order`
 		where customer=%s and docstatus = 1 and company=%s
-		and ifnull(per_billed, 0) < 100 and status != 'Stopped'""", (customer, company))
+		and per_billed < 100 and status != 'Stopped'""", (customer, company))
 
 	outstanding_based_on_so = flt(outstanding_based_on_so[0][0]) if outstanding_based_on_so else 0.0
 
@@ -217,7 +217,7 @@
 	outstanding_based_on_dn = 0.0
 
 	for dn_item in unmarked_delivery_note_items:
-		si_amount = frappe.db.sql("""select sum(ifnull(amount, 0))
+		si_amount = frappe.db.sql("""select sum(amount)
 			from `tabSales Invoice Item`
 			where dn_detail = %s and docstatus = 1""", dn_item.name)[0][0]
 
diff --git a/erpnext/selling/doctype/industry_type/industry_type.json b/erpnext/selling/doctype/industry_type/industry_type.json
index 7ce9a87..6c592b5 100644
--- a/erpnext/selling/doctype/industry_type/industry_type.json
+++ b/erpnext/selling/doctype/industry_type/industry_type.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Industry", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "industry", 
    "oldfieldtype": "Data", 
@@ -42,7 +43,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:51.531817", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:47.569394", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Industry Type", 
diff --git a/erpnext/selling/doctype/installation_note/installation_note.json b/erpnext/selling/doctype/installation_note/installation_note.json
index 3dfd2ed..27b6ac4 100644
--- a/erpnext/selling/doctype/installation_note/installation_note.json
+++ b/erpnext/selling/doctype/installation_note/installation_note.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Installation Note", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -40,6 +41,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -62,7 +64,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Series",  
+   "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "naming_series", 
    "oldfieldtype": "Select", 
@@ -87,6 +90,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer", 
    "oldfieldtype": "Link", 
@@ -112,6 +116,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Address", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Address", 
    "permlevel": 0, 
@@ -135,6 +140,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Person", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Contact", 
    "permlevel": 0, 
@@ -157,6 +163,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer_name", 
    "oldfieldtype": "Data", 
@@ -180,6 +187,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -201,6 +209,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -223,6 +232,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Mobile No", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -245,6 +255,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Email", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -268,6 +279,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Territory", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Territory", 
    "permlevel": 0, 
@@ -292,6 +304,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Group", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Customer Group", 
    "permlevel": 0, 
@@ -313,6 +326,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -336,6 +350,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Installation Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "inst_date", 
    "oldfieldtype": "Date", 
@@ -359,6 +374,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Installation Time", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "inst_time", 
    "oldfieldtype": "Time", 
@@ -382,7 +398,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "status", 
    "oldfieldtype": "Select", 
@@ -408,6 +425,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Select", 
@@ -432,6 +450,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -456,6 +475,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Data", 
@@ -480,6 +500,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Remarks", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "remarks", 
    "oldfieldtype": "Small Text", 
@@ -503,6 +524,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "Simple", 
@@ -526,6 +548,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Items", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "installed_item_details", 
    "oldfieldtype": "Table", 
@@ -549,7 +572,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:51.611044", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:47.610773", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Installation Note", 
diff --git a/erpnext/selling/doctype/installation_note_item/installation_note_item.json b/erpnext/selling/doctype/installation_note_item/installation_note_item.json
index 3666517..758c47f 100644
--- a/erpnext/selling/doctype/installation_note_item/installation_note_item.json
+++ b/erpnext/selling/doctype/installation_note_item/installation_note_item.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Data", 
@@ -68,6 +70,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Serial No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "serial_no", 
    "oldfieldtype": "Small Text", 
@@ -93,6 +96,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Against Document Detail No", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "prevdoc_detail_docname", 
    "oldfieldtype": "Data", 
@@ -118,6 +122,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Against Document No", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "prevdoc_docname", 
    "oldfieldtype": "Data", 
@@ -143,6 +148,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Document Type", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "prevdoc_doctype", 
    "oldfieldtype": "Data", 
@@ -168,6 +174,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Installed Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "qty", 
    "oldfieldtype": "Currency", 
@@ -189,7 +196,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:51.804947", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:47.713471", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Installation Note Item", 
diff --git a/erpnext/selling/doctype/product_bundle/product_bundle.json b/erpnext/selling/doctype/product_bundle/product_bundle.json
index 30259ad..7ec3df8 100644
--- a/erpnext/selling/doctype/product_bundle/product_bundle.json
+++ b/erpnext/selling/doctype/product_bundle/product_bundle.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Parent Item", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "new_item_code", 
    "oldfieldtype": "Data", 
@@ -67,6 +69,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -88,6 +91,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Items", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "sales_bom_items", 
    "oldfieldtype": "Table", 
@@ -111,7 +115,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:01.166099", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:52.231105", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Product Bundle", 
diff --git a/erpnext/selling/doctype/product_bundle_item/product_bundle_item.json b/erpnext/selling/doctype/product_bundle_item/product_bundle_item.json
index f84ceec..fadf198 100644
--- a/erpnext/selling/doctype/product_bundle_item/product_bundle_item.json
+++ b/erpnext/selling/doctype/product_bundle_item/product_bundle_item.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "qty", 
    "oldfieldtype": "Currency", 
@@ -65,6 +67,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Text", 
@@ -89,6 +92,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "rate", 
    "oldfieldtype": "Currency", 
@@ -112,6 +116,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "uom", 
    "oldfieldtype": "Link", 
@@ -134,7 +139,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:01.323333", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:52.274925", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Product Bundle Item", 
diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json
index 68b5c8d..a4ca4ff 100644
--- a/erpnext/selling/doctype/quotation/quotation.json
+++ b/erpnext/selling/doctype/quotation/quotation.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-user", 
    "permlevel": 0, 
@@ -41,6 +42,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -64,6 +66,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Title", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -85,7 +88,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Series",  
+   "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "naming_series", 
    "oldfieldtype": "Select", 
@@ -110,7 +114,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
-   "label": "Quotation To",  
+   "label": "Quotation To", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "quotation_to", 
    "oldfieldtype": "Select", 
@@ -136,6 +141,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer", 
    "oldfieldtype": "Link", 
@@ -161,6 +167,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Lead", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "lead", 
    "oldfieldtype": "Link", 
@@ -185,6 +192,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer / Lead Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -206,6 +214,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer_address", 
    "oldfieldtype": "Small Text", 
@@ -229,6 +238,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -250,6 +260,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Mobile No", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -271,6 +282,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Email", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -291,6 +303,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -314,6 +327,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Data", 
@@ -340,6 +354,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -366,6 +381,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "transaction_date", 
    "oldfieldtype": "Date", 
@@ -390,7 +406,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
-   "label": "Order Type",  
+   "label": "Order Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "order_type", 
    "oldfieldtype": "Select", 
@@ -415,6 +432,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Currency and Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-tag", 
    "permlevel": 0, 
@@ -437,6 +455,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "currency", 
    "oldfieldtype": "Select", 
@@ -463,6 +482,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Exchange Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "conversion_rate", 
    "oldfieldtype": "Currency", 
@@ -487,6 +507,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -509,6 +530,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "price_list_name", 
    "oldfieldtype": "Select", 
@@ -534,6 +556,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Currency", 
    "permlevel": 0, 
@@ -557,6 +580,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Exchange Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "9", 
@@ -579,6 +603,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Ignore Pricing Rule", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 1, 
    "print_hide": 1, 
@@ -600,6 +625,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-shopping-cart", 
@@ -623,6 +649,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Items", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "quotation_details", 
    "oldfieldtype": "Table", 
@@ -647,6 +674,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -668,6 +696,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -691,6 +720,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "net_total", 
    "oldfieldtype": "Currency", 
@@ -715,6 +745,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -736,6 +767,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -759,6 +791,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Total", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -781,6 +814,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-money", 
@@ -804,6 +838,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "charge", 
    "oldfieldtype": "Link", 
@@ -827,6 +862,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -848,6 +884,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Shipping Rule", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Button", 
    "options": "Shipping Rule", 
@@ -870,6 +907,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -891,6 +929,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges", 
    "oldfieldtype": "Table", 
@@ -915,6 +954,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges Calculation", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "HTML", 
    "permlevel": 0, 
@@ -936,6 +976,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -957,6 +998,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Taxes and Charges (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges_total", 
    "oldfieldtype": "Currency", 
@@ -980,6 +1022,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1001,6 +1044,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -1024,6 +1068,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1046,7 +1091,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Apply Additional Discount On",  
+   "label": "Apply Additional Discount On", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nGrand Total\nNet Total", 
    "permlevel": 0, 
@@ -1069,6 +1115,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1091,6 +1138,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -1113,6 +1161,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -1136,6 +1185,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-money", 
@@ -1159,6 +1209,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Grand Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "grand_total", 
    "oldfieldtype": "Currency", 
@@ -1184,6 +1235,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rounded Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "rounded_total", 
    "oldfieldtype": "Currency", 
@@ -1210,6 +1262,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "In Words (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "in_words", 
    "oldfieldtype": "Data", 
@@ -1233,6 +1286,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -1256,6 +1310,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Grand Total", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "grand_total_export", 
    "oldfieldtype": "Currency", 
@@ -1281,6 +1336,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rounded Total", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "rounded_total_export", 
    "oldfieldtype": "Currency", 
@@ -1306,6 +1362,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "In Words", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "in_words_export", 
    "oldfieldtype": "Data", 
@@ -1331,6 +1388,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms and Conditions", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-legal", 
@@ -1354,6 +1412,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "tc_name", 
    "oldfieldtype": "Link", 
@@ -1378,6 +1437,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Term Details", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "terms", 
    "oldfieldtype": "Text Editor", 
@@ -1401,6 +1461,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Details", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-bullhorn", 
    "permlevel": 0, 
@@ -1424,6 +1485,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Territory", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Territory", 
    "permlevel": 0, 
@@ -1448,6 +1510,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer Group", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer_group", 
    "oldfieldtype": "Link", 
@@ -1472,6 +1535,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Shipping Address", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Address", 
    "permlevel": 0, 
@@ -1494,6 +1558,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Shipping Address", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -1515,6 +1580,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1537,6 +1603,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer Address", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Address", 
    "permlevel": 0, 
@@ -1560,6 +1627,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Contact Person", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "contact_person", 
    "oldfieldtype": "Link", 
@@ -1584,6 +1652,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Print Settings", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1606,6 +1675,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Letter Head", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "letter_head", 
    "oldfieldtype": "Select", 
@@ -1630,6 +1700,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Print Heading", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "select_print_heading", 
    "oldfieldtype": "Link", 
@@ -1654,6 +1725,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "More Information", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-file-text", 
@@ -1677,6 +1749,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Campaign", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "campaign", 
    "oldfieldtype": "Link", 
@@ -1700,7 +1773,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Source",  
+   "label": "Source", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "source", 
    "oldfieldtype": "Select", 
@@ -1726,6 +1800,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Quotation Lost Reason", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "order_lost_reason", 
    "oldfieldtype": "Small Text", 
@@ -1748,6 +1823,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -1771,7 +1847,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "status", 
    "oldfieldtype": "Select", 
@@ -1796,6 +1873,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -1820,6 +1898,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Opportunity Item", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "enq_det", 
    "oldfieldtype": "Text", 
@@ -1843,7 +1922,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 1, 
- "modified": "2015-10-02 07:39:07.058085", 
+ "modified": "2015-11-16 06:29:54.958329", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Quotation", 
diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.json b/erpnext/selling/doctype/quotation_item/quotation_item.json
index 8af8e1c..b1d441c 100644
--- a/erpnext/selling/doctype/quotation_item/quotation_item.json
+++ b/erpnext/selling/doctype/quotation_item/quotation_item.json
@@ -19,6 +19,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -45,6 +46,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer's Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -65,6 +67,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -86,6 +89,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_name", 
    "oldfieldtype": "Data", 
@@ -110,6 +114,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -132,6 +137,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Small Text", 
@@ -156,6 +162,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -178,6 +185,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -200,6 +208,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image View", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "image", 
    "permlevel": 0, 
@@ -223,6 +232,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Quantity and Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -244,6 +254,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Quantity", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "qty", 
    "oldfieldtype": "Currency", 
@@ -269,6 +280,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "ref_rate", 
    "oldfieldtype": "Currency", 
@@ -296,6 +308,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Discount on Price List Rate (%)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "adj_rate", 
    "oldfieldtype": "Float", 
@@ -320,6 +333,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -341,6 +355,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "stock_uom", 
    "oldfieldtype": "Data", 
@@ -367,6 +382,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Rate (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "base_ref_rate", 
    "oldfieldtype": "Currency", 
@@ -392,6 +408,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -413,6 +430,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "export_rate", 
    "oldfieldtype": "Currency", 
@@ -439,6 +457,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -461,6 +480,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "export_amount", 
    "oldfieldtype": "Currency", 
@@ -487,6 +507,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -509,6 +530,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -530,6 +552,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rate (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "basic_rate", 
    "oldfieldtype": "Currency", 
@@ -556,6 +579,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Rate (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -578,6 +602,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "amount", 
    "oldfieldtype": "Currency", 
@@ -604,6 +629,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -627,6 +653,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Pricing Rule", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Pricing Rule", 
    "permlevel": 0, 
@@ -649,6 +676,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reference", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -670,6 +698,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Against Doctype", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "prevdoc_doctype", 
    "oldfieldtype": "Data", 
@@ -696,6 +725,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Against Docname", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "prevdoc_docname", 
    "oldfieldtype": "Data", 
@@ -722,6 +752,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Tax Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_tax_rate", 
    "oldfieldtype": "Small Text", 
@@ -744,6 +775,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -765,6 +797,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Page Break", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "page_break", 
    "oldfieldtype": "Check", 
@@ -789,6 +822,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Item Group", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_group", 
    "oldfieldtype": "Link", 
@@ -813,6 +847,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Brand", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "brand", 
    "oldfieldtype": "Link", 
@@ -837,7 +872,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-19 03:04:51.443832", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:55.206667", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Quotation Item", 
diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json
index ed661f8..40337bf 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.json
+++ b/erpnext/selling/doctype/sales_order/sales_order.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-user", 
    "permlevel": 0, 
@@ -41,6 +42,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -65,6 +67,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Title", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -87,6 +90,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "naming_series", 
    "oldfieldtype": "Select", 
@@ -111,6 +115,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer", 
    "oldfieldtype": "Link", 
@@ -135,6 +140,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -156,6 +162,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -177,6 +184,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -198,6 +206,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Mobile No", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -219,6 +228,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Email", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -242,6 +252,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Order Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "order_type", 
    "oldfieldtype": "Select", 
@@ -265,6 +276,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -288,6 +300,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Data", 
@@ -314,6 +327,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -340,6 +354,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "transaction_date", 
    "oldfieldtype": "Date", 
@@ -365,6 +380,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Delivery Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "delivery_date", 
    "oldfieldtype": "Date", 
@@ -391,6 +407,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer's Purchase Order", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "po_no", 
    "oldfieldtype": "Data", 
@@ -417,6 +434,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer's Purchase Order Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "po_date", 
    "oldfieldtype": "Date", 
@@ -441,6 +459,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Shipping Address Name", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Address", 
    "permlevel": 0, 
@@ -463,6 +482,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Shipping Address", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -484,6 +504,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Currency and Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-tag", 
    "permlevel": 0, 
@@ -506,6 +527,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "currency", 
    "oldfieldtype": "Select", 
@@ -532,6 +554,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Exchange Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "conversion_rate", 
    "oldfieldtype": "Currency", 
@@ -556,6 +579,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -578,6 +602,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "price_list_name", 
    "oldfieldtype": "Select", 
@@ -603,6 +628,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Currency", 
    "permlevel": 0, 
@@ -626,6 +652,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Exchange Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "9", 
@@ -648,6 +675,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Ignore Pricing Rule", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 1, 
    "print_hide": 1, 
@@ -669,6 +697,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-shopping-cart", 
@@ -692,6 +721,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Items", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "sales_order_details", 
    "oldfieldtype": "Table", 
@@ -715,6 +745,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -735,6 +766,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -756,6 +788,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -779,6 +812,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "net_total", 
    "oldfieldtype": "Currency", 
@@ -803,6 +837,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -824,6 +859,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -847,6 +883,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Total", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -869,6 +906,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-money", 
@@ -892,6 +930,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "charge", 
    "oldfieldtype": "Link", 
@@ -915,6 +954,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -936,6 +976,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Shipping Rule", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Button", 
    "options": "Shipping Rule", 
@@ -958,6 +999,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -979,6 +1021,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges", 
    "oldfieldtype": "Table", 
@@ -1003,6 +1046,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges Calculation", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "HTML", 
    "permlevel": 0, 
@@ -1024,6 +1068,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1045,6 +1090,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Taxes and Charges (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges_total", 
    "oldfieldtype": "Currency", 
@@ -1069,6 +1115,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1091,6 +1138,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -1114,6 +1162,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1137,6 +1186,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Apply Additional Discount On", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nGrand Total\nNet Total", 
    "permlevel": 0, 
@@ -1159,6 +1209,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1180,6 +1231,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -1202,6 +1254,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -1225,6 +1278,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-money", 
@@ -1248,6 +1302,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Grand Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "grand_total", 
    "oldfieldtype": "Currency", 
@@ -1273,6 +1328,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rounded Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "rounded_total", 
    "oldfieldtype": "Currency", 
@@ -1299,6 +1355,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "In Words (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "in_words", 
    "oldfieldtype": "Data", 
@@ -1322,6 +1379,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -1345,6 +1403,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Grand Total", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "grand_total_export", 
    "oldfieldtype": "Currency", 
@@ -1370,6 +1429,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rounded Total", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "rounded_total_export", 
    "oldfieldtype": "Currency", 
@@ -1395,6 +1455,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "In Words", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "in_words_export", 
    "oldfieldtype": "Data", 
@@ -1419,6 +1480,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Advance Paid", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -1443,6 +1505,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Packing List", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-suitcase", 
@@ -1466,6 +1529,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Packed Items", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "packing_details", 
    "oldfieldtype": "Table", 
@@ -1491,6 +1555,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms and Conditions", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-legal", 
@@ -1514,6 +1579,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "tc_name", 
    "oldfieldtype": "Link", 
@@ -1538,6 +1604,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms and Conditions Details", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "terms", 
    "oldfieldtype": "Text Editor", 
@@ -1562,6 +1629,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Details", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-bullhorn", 
    "permlevel": 0, 
@@ -1583,6 +1651,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1606,6 +1675,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Territory", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Territory", 
    "permlevel": 0, 
@@ -1629,6 +1699,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer Group", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Customer Group", 
    "permlevel": 0, 
@@ -1650,6 +1721,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1672,6 +1744,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer Address", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Address", 
    "permlevel": 0, 
@@ -1694,6 +1767,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Contact Person", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Contact", 
    "permlevel": 0, 
@@ -1717,6 +1791,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "More Information", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-file-text", 
@@ -1741,6 +1816,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Project Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "project_name", 
    "oldfieldtype": "Link", 
@@ -1765,6 +1841,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -1789,6 +1866,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1811,6 +1889,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Source", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "source", 
    "oldfieldtype": "Select", 
@@ -1836,6 +1915,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Campaign", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "campaign", 
    "oldfieldtype": "Link", 
@@ -1860,6 +1940,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Printing Details", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1882,6 +1963,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Letter Head", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "letter_head", 
    "oldfieldtype": "Select", 
@@ -1905,6 +1987,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -1928,6 +2011,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Print Heading", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "select_print_heading", 
    "oldfieldtype": "Link", 
@@ -1952,6 +2036,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Billing and Delivery Status", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -1976,6 +2061,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "status", 
    "oldfieldtype": "Select", 
@@ -2001,6 +2087,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Delivery Status", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Not Delivered\nFully Delivered\nPartly Delivered\nClosed\nNot Applicable", 
    "permlevel": 0, 
@@ -2025,6 +2112,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "%  Delivered", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "per_delivered", 
    "oldfieldtype": "Currency", 
@@ -2048,6 +2136,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -2071,6 +2160,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "% Amount Billed", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "per_billed", 
    "oldfieldtype": "Currency", 
@@ -2095,6 +2185,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Billing Status", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Not Billed\nFully Billed\nPartly Billed\nClosed", 
    "permlevel": 0, 
@@ -2118,6 +2209,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Commission", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-group", 
@@ -2141,6 +2233,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Sales Partner", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "sales_partner", 
    "oldfieldtype": "Link", 
@@ -2165,6 +2258,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2187,6 +2281,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Commission Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "commission_rate", 
    "oldfieldtype": "Currency", 
@@ -2211,6 +2306,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Commission", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "total_commission", 
    "oldfieldtype": "Currency", 
@@ -2236,6 +2332,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Team", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2257,6 +2354,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Team1", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "sales_team", 
    "oldfieldtype": "Table", 
@@ -2282,6 +2380,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Recurring Order", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-time", 
    "permlevel": 0, 
@@ -2306,6 +2405,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Recurring", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2329,6 +2429,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Recurring Type", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "\nMonthly\nQuarterly\nHalf-yearly\nYearly", 
    "permlevel": 0, 
@@ -2353,6 +2454,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "From Date", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -2376,6 +2478,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "To Date", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -2399,6 +2502,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Repeat on Day of Month", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2422,6 +2526,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "End Date", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2443,6 +2548,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2466,6 +2572,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Next Date", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2488,6 +2595,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Recurring Id", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2511,6 +2619,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Notification Email Address", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2533,6 +2642,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Recurring Print Format", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Print Format", 
    "permlevel": 0, 
@@ -2555,7 +2665,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-22 16:32:34.339835", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:56.599677", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Sales Order", 
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 2f4884b..d2b1653 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -66,12 +66,6 @@
 		for d in self.get('items'):
 			check_list.append(cstr(d.item_code))
 
-			if (frappe.db.get_value("Item", d.item_code, "is_stock_item")==1 or
-				(self.has_product_bundle(d.item_code) and self.product_bundle_has_stock_item(d.item_code))) \
-				and not d.warehouse and not cint(d.delivered_by_supplier):
-				frappe.throw(_("Delivery warehouse required for stock item {0}").format(d.item_code),
-					WarehouseRequired)
-
 			# used for production plan
 			d.transaction_date = self.transaction_date
 
@@ -116,14 +110,15 @@
 				frappe.throw(_("Customer {0} does not belong to project {1}").format(self.customer, self.project_name))
 
 	def validate_warehouse(self):
-		from erpnext.stock.utils import validate_warehouse_company
-
-		warehouses = list(set([d.warehouse for d in
-			self.get("items") if d.warehouse]))
-
-		for w in warehouses:
-			validate_warehouse_company(w, self.company)
-
+		super(SalesOrder, self).validate_warehouse()
+		
+		for d in self.get("items"):
+			if (frappe.db.get_value("Item", d.item_code, "is_stock_item")==1 or
+				(self.has_product_bundle(d.item_code) and self.product_bundle_has_stock_item(d.item_code))) \
+				and not d.warehouse and not cint(d.delivered_by_supplier):
+				frappe.throw(_("Delivery warehouse required for stock item {0}").format(d.item_code),
+					WarehouseRequired)
+			
 	def validate_with_previous_doc(self):
 		super(SalesOrder, self).validate_with_previous_doc({
 			"Quotation": {
@@ -236,13 +231,13 @@
 					item_wh_list.append([item_code, warehouse])
 
 		for d in self.get("items"):
-			if (not so_item_rows or d.name in so_item_rows):
-				_valid_for_reserve(d.item_code, d.warehouse)
-
+			if (not so_item_rows or d.name in so_item_rows) and not d.delivered_by_supplier:
 				if self.has_product_bundle(d.item_code):
 					for p in self.get("packed_items"):
 						if p.parent_detail_docname == d.name and p.parent_item == d.item_code:
 							_valid_for_reserve(p.item_code, p.warehouse)
+				else:
+					_valid_for_reserve(d.item_code, d.warehouse)
 
 		for item_code, warehouse in item_wh_list:
 			update_bin_qty(item_code, warehouse, {
@@ -607,7 +602,7 @@
 			name, supplier_name
 		limit %(start)s, %(page_len)s """.format(**{
 			'field': fields,
-			'key': searchfield
+			'key': frappe.db.escape(searchfield)
 		}), {
 			'txt': "%%%s%%" % txt,
 			'_txt': txt.replace("%", ""),
diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py
index 61ee110..3501f52 100644
--- a/erpnext/selling/doctype/sales_order/test_sales_order.py
+++ b/erpnext/selling/doctype/sales_order/test_sales_order.py
@@ -355,10 +355,13 @@
 		self.assertEquals(dn.items[0].item_code, dn_item.item_code)
 
 		#test ordered_qty and reserved_qty
-		ordered_qty, reserved_qty = frappe.db.get_value("Bin",
-			{"item_code": po_item.item_code, "warehouse": "_Test Warehouse - _TC"}, ["ordered_qty", "reserved_qty"])
+		bin = frappe.get_all("Bin", filters={"item_code": po_item.item_code, "warehouse": "_Test Warehouse - _TC"},
+			fields=["ordered_qty", "reserved_qty"])
 
-		self.assertEquals(abs(flt(ordered_qty)), existing_ordered_qty + so_items[0]['qty'])
+		ordered_qty = bin[0].ordered_qty if bin else 0.0
+		reserved_qty = bin[0].reserved_qty if bin else 0.0
+
+		self.assertEquals(abs(flt(ordered_qty)), existing_ordered_qty)
 		self.assertEquals(abs(flt(reserved_qty)), existing_reserved_qty)
 
 		reserved_qty = frappe.db.get_value("Bin",
@@ -384,8 +387,11 @@
 		so.db_set('status', "Closed")
 		so.update_reserved_qty()
 
-		ordered_qty, reserved_qty = frappe.db.get_value("Bin",
-			{"item_code": po_item.item_code, "warehouse": "_Test Warehouse - _TC"}, ["ordered_qty", "reserved_qty"])
+		bin = frappe.get_all("Bin", filters={"item_code": po_item.item_code, "warehouse": "_Test Warehouse - _TC"},
+			fields=["ordered_qty", "reserved_qty"])
+
+		ordered_qty = bin[0].ordered_qty if bin else 0.0
+		reserved_qty = bin[0].reserved_qty if bin else 0.0
 
 		self.assertEquals(abs(flt(ordered_qty)), existing_ordered_qty)
 		self.assertEquals(abs(flt(reserved_qty)), existing_reserved_qty)
@@ -393,7 +399,7 @@
 		reserved_qty = frappe.db.get_value("Bin",
 			{"item_code": dn_item.item_code, "warehouse": "_Test Warehouse - _TC"}, "reserved_qty")
 
-		self.assertEquals(abs(flt(reserved_qty)), existing_reserved_qty)
+		self.assertEquals(abs(flt(reserved_qty)), existing_reserved_qty_for_dn_item)
 
 	def test_reserved_qty_for_closing_so(self):
 		bin = frappe.get_all("Bin", filters={"item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC"},
diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
index 7f4e400..693863c 100644
--- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
@@ -1,1200 +1,1251 @@
 {
- "allow_copy": 0,
- "allow_import": 0,
- "allow_rename": 0,
- "autoname": "hash",
- "creation": "2013-03-07 11:42:58",
- "custom": 0,
- "docstatus": 0,
- "doctype": "DocType",
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "autoname": "hash", 
+ "creation": "2013-03-07 11:42:58", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
  "fields": [
   {
-   "allow_on_submit": 0,
-   "bold": 1,
-   "collapsible": 0,
-   "fieldname": "item_code",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 1,
-   "in_list_view": 1,
-   "label": "Item Code",
-   "no_copy": 0,
-   "oldfieldname": "item_code",
-   "oldfieldtype": "Link",
-   "options": "Item",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_width": "150px",
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 1,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "fieldname": "item_code", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 1, 
+   "in_list_view": 1, 
+   "label": "Item Code", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "item_code", 
+   "oldfieldtype": "Link", 
+   "options": "Item", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_width": "150px", 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "150px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "customer_item_code",
-   "fieldtype": "Data",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Customer's Item Code",
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "customer_item_code", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Customer's Item Code", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "col_break1",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "col_break1", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "item_name",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "Item Name",
-   "no_copy": 0,
-   "oldfieldname": "item_name",
-   "oldfieldtype": "Data",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_width": "150",
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "item_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Item Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "item_name", 
+   "oldfieldtype": "Data", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_width": "150", 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "150"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "fieldname": "section_break_5",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Description",
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "fieldname": "section_break_5", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Description", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "description",
-   "fieldtype": "Text Editor",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 1,
-   "in_list_view": 1,
-   "label": "Description",
-   "no_copy": 0,
-   "oldfieldname": "description",
-   "oldfieldtype": "Small Text",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_width": "300px",
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "description", 
+   "fieldtype": "Text Editor", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 1, 
+   "in_list_view": 1, 
+   "label": "Description", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "description", 
+   "oldfieldtype": "Small Text", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_width": "300px", 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "300px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "column_break_7",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "column_break_7", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "image",
-   "fieldtype": "Attach",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Image",
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "image", 
+   "fieldtype": "Attach", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Image", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "image_view",
-   "fieldtype": "Image",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Image View",
-   "no_copy": 0,
-   "options": "image",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "image_view", 
+   "fieldtype": "Image", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Image View", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "image", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "quantity_and_rate",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Quantity and Rate",
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "quantity_and_rate", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Quantity and Rate", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "qty",
-   "fieldtype": "Float",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "Quantity",
-   "no_copy": 0,
-   "oldfieldname": "qty",
-   "oldfieldtype": "Currency",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_width": "100px",
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "qty", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Quantity", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "qty", 
+   "oldfieldtype": "Currency", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_width": "100px", 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "100px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "price_list_rate",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Price List Rate",
-   "no_copy": 0,
-   "oldfieldname": "ref_rate",
-   "oldfieldtype": "Currency",
-   "options": "currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_width": "70px",
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "price_list_rate", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Price List Rate", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "ref_rate", 
+   "oldfieldtype": "Currency", 
+   "options": "currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_width": "70px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "70px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "depends_on": "price_list_rate",
-   "fieldname": "discount_percentage",
-   "fieldtype": "Percent",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "Discount on Price List Rate (%)",
-   "no_copy": 0,
-   "oldfieldname": "adj_rate",
-   "oldfieldtype": "Float",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_width": "70px",
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "depends_on": "price_list_rate", 
+   "fieldname": "discount_percentage", 
+   "fieldtype": "Percent", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Discount on Price List Rate (%)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "adj_rate", 
+   "oldfieldtype": "Float", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_width": "70px", 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "70px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "col_break2",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "col_break2", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "stock_uom",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "UOM",
-   "no_copy": 0,
-   "oldfieldname": "stock_uom",
-   "oldfieldtype": "Data",
-   "options": "UOM",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_width": "70px",
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "stock_uom", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "UOM", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "stock_uom", 
+   "oldfieldtype": "Data", 
+   "options": "UOM", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_width": "70px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "70px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "base_price_list_rate",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Price List Rate (Company Currency)",
-   "no_copy": 0,
-   "oldfieldname": "base_ref_rate",
-   "oldfieldtype": "Currency",
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_width": "100px",
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "base_price_list_rate", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Price List Rate (Company Currency)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "base_ref_rate", 
+   "oldfieldtype": "Currency", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_width": "100px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "100px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "section_break_simple1",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "section_break_simple1", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "rate",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "Rate",
-   "no_copy": 0,
-   "oldfieldname": "export_rate",
-   "oldfieldtype": "Currency",
-   "options": "currency",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_width": "100px",
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "rate", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Rate", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "export_rate", 
+   "oldfieldtype": "Currency", 
+   "options": "currency", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_width": "100px", 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "100px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "amount",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "Amount",
-   "no_copy": 0,
-   "oldfieldname": "export_amount",
-   "oldfieldtype": "Currency",
-   "options": "currency",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_width": "100px",
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Amount", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "export_amount", 
+   "oldfieldtype": "Currency", 
+   "options": "currency", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_width": "100px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "100px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "col_break3",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "col_break3", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "base_rate",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Basic Rate (Company Currency)",
-   "no_copy": 0,
-   "oldfieldname": "basic_rate",
-   "oldfieldtype": "Currency",
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_width": "100px",
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "base_rate", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Basic Rate (Company Currency)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "basic_rate", 
+   "oldfieldtype": "Currency", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_width": "100px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "100px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "base_amount",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Amount (Company Currency)",
-   "no_copy": 0,
-   "oldfieldname": "amount",
-   "oldfieldtype": "Currency",
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_width": "100px",
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "base_amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Amount (Company Currency)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "amount", 
+   "oldfieldtype": "Currency", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_width": "100px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "100px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "pricing_rule",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Pricing Rule",
-   "no_copy": 0,
-   "options": "Pricing Rule",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "pricing_rule", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Pricing Rule", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Pricing Rule", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "section_break_24",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "section_break_24", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "net_rate",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Net Rate",
-   "no_copy": 0,
-   "options": "currency",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "net_rate", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Net Rate", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "net_amount",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Net Amount",
-   "no_copy": 0,
-   "options": "currency",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "net_amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Net Amount", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "column_break_27",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "column_break_27", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "base_net_rate",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Net Rate (Company Currency)",
-   "no_copy": 0,
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "base_net_rate", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Net Rate (Company Currency)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "base_net_amount",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Net Amount (Company Currency)",
-   "no_copy": 0,
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "base_net_amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Net Amount (Company Currency)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "collapsible_depends_on": "eval:doc.delivered_by_supplier==1||doc.supplier",
-   "fieldname": "drop_ship_section",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Drop Ship",
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "collapsible_depends_on": "eval:doc.delivered_by_supplier==1||doc.supplier", 
+   "fieldname": "drop_ship_section", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Drop Ship", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "delivered_by_supplier",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Supplier delivers to Customer",
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "delivered_by_supplier", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Supplier delivers to Customer", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 1,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "supplier",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Supplier",
-   "no_copy": 0,
-   "options": "Supplier",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "supplier", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Supplier", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Supplier", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "warehouse_and_reference",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Warehouse and Reference",
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "warehouse_and_reference", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Warehouse and Reference", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "depends_on": "eval:doc.delivered_by_supplier!=1",
-   "fieldname": "warehouse",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "Delivery Warehouse",
-   "no_copy": 0,
-   "oldfieldname": "reserved_warehouse",
-   "oldfieldtype": "Link",
-   "options": "Warehouse",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_width": "150px",
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "depends_on": "eval:doc.delivered_by_supplier!=1", 
+   "fieldname": "warehouse", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Delivery Warehouse", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "reserved_warehouse", 
+   "oldfieldtype": "Link", 
+   "options": "Warehouse", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_width": "150px", 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "150px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "depends_on": "eval:doc.delivered_by_supplier!=1",
-   "fieldname": "target_warehouse",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Target Warehouse",
-   "no_copy": 0,
-   "options": "Warehouse",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "depends_on": "eval:doc.delivered_by_supplier!=1", 
+   "fieldname": "target_warehouse", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Target Warehouse", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Warehouse", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "prevdoc_docname",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 1,
-   "in_list_view": 0,
-   "label": "Quotation",
-   "no_copy": 1,
-   "oldfieldname": "prevdoc_docname",
-   "oldfieldtype": "Link",
-   "options": "Quotation",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 1,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "prevdoc_docname", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "Quotation", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "prevdoc_docname", 
+   "oldfieldtype": "Link", 
+   "options": "Quotation", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "brand",
-   "fieldtype": "Link",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "in_filter": 1,
-   "in_list_view": 0,
-   "label": "Brand Name",
-   "no_copy": 0,
-   "oldfieldname": "brand",
-   "oldfieldtype": "Link",
-   "options": "Brand",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 1,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "brand", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "Brand Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "brand", 
+   "oldfieldtype": "Link", 
+   "options": "Brand", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "description": "",
-   "fieldname": "item_group",
-   "fieldtype": "Link",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "in_filter": 1,
-   "in_list_view": 0,
-   "label": "Item Group",
-   "no_copy": 0,
-   "oldfieldname": "item_group",
-   "oldfieldtype": "Link",
-   "options": "Item Group",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 1,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "description": "", 
+   "fieldname": "item_group", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "Item Group", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "item_group", 
+   "oldfieldtype": "Link", 
+   "options": "Item Group", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 1,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "page_break",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Page Break",
-   "no_copy": 0,
-   "oldfieldname": "page_break",
-   "oldfieldtype": "Check",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
-   "report_hide": 1,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "page_break", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Page Break", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "page_break", 
+   "oldfieldtype": "Check", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "report_hide": 1, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "col_break4",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "col_break4", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 1,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "projected_qty",
-   "fieldtype": "Float",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Projected Qty",
-   "no_copy": 1,
-   "oldfieldname": "projected_qty",
-   "oldfieldtype": "Currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_width": "70px",
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "projected_qty", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Projected Qty", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "projected_qty", 
+   "oldfieldtype": "Currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_width": "70px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "70px"
-  },
+  }, 
   {
-   "allow_on_submit": 1,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "actual_qty",
-   "fieldtype": "Float",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Actual Qty",
-   "no_copy": 1,
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_width": "70px",
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "actual_qty", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Actual Qty", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_width": "70px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "70px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "ordered_qty",
-   "fieldtype": "Float",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Ordered Qty",
-   "no_copy": 1,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "ordered_qty", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Ordered Qty", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "delivered_qty",
-   "fieldtype": "Float",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Delivered Qty",
-   "no_copy": 1,
-   "oldfieldname": "delivered_qty",
-   "oldfieldtype": "Currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_width": "100px",
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "delivered_qty", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Delivered Qty", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "delivered_qty", 
+   "oldfieldtype": "Currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_width": "100px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "100px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "depends_on": "returned_qty",
-   "fieldname": "returned_qty",
-   "fieldtype": "Float",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Returned Qty",
-   "no_copy": 1,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "depends_on": "returned_qty", 
+   "fieldname": "returned_qty", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Returned Qty", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "billed_amt",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Billed Amt",
-   "no_copy": 1,
-   "options": "currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "billed_amt", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Billed Amt", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "description": "For Production",
-   "fieldname": "planned_qty",
-   "fieldtype": "Float",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Planned Quantity",
-   "no_copy": 1,
-   "oldfieldname": "planned_qty",
-   "oldfieldtype": "Currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_width": "50px",
-   "read_only": 1,
-   "report_hide": 1,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "description": "For Production", 
+   "fieldname": "planned_qty", 
+   "fieldtype": "Float", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Planned Quantity", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "planned_qty", 
+   "oldfieldtype": "Currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_width": "50px", 
+   "read_only": 1, 
+   "report_hide": 1, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "50px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "description": "For Production",
-   "fieldname": "produced_qty",
-   "fieldtype": "Float",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Produced Quantity",
-   "no_copy": 0,
-   "oldfieldname": "produced_qty",
-   "oldfieldtype": "Currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_width": "50px",
-   "read_only": 1,
-   "report_hide": 1,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "description": "For Production", 
+   "fieldname": "produced_qty", 
+   "fieldtype": "Float", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Produced Quantity", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "produced_qty", 
+   "oldfieldtype": "Currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_width": "50px", 
+   "read_only": 1, 
+   "report_hide": 1, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "50px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "item_tax_rate",
-   "fieldtype": "Small Text",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Item Tax Rate",
-   "no_copy": 0,
-   "oldfieldname": "item_tax_rate",
-   "oldfieldtype": "Small Text",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 1,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "item_tax_rate", 
+   "fieldtype": "Small Text", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Item Tax Rate", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "item_tax_rate", 
+   "oldfieldtype": "Small Text", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 1, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "description": "Used for Production Plan",
-   "fieldname": "transaction_date",
-   "fieldtype": "Date",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Sales Order Date",
-   "no_copy": 0,
-   "oldfieldname": "transaction_date",
-   "oldfieldtype": "Date",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 1,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "description": "Used for Production Plan", 
+   "fieldname": "transaction_date", 
+   "fieldtype": "Date", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Sales Order Date", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "transaction_date", 
+   "oldfieldtype": "Date", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 1, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
   }
- ],
- "hide_heading": 0,
- "hide_toolbar": 0,
- "idx": 1,
- "in_create": 0,
- "in_dialog": 0,
- "is_submittable": 0,
- "issingle": 0,
- "istable": 1,
- "modified": "2015-11-04 11:29:57.645383",
- "modified_by": "Administrator",
- "module": "Selling",
- "name": "Sales Order Item",
- "owner": "Administrator",
- "permissions": [],
- "read_only": 0,
- "read_only_onload": 0,
- "sort_field": "modified",
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 1, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:56.933782", 
+ "modified_by": "Administrator", 
+ "module": "Selling", 
+ "name": "Sales Order Item", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "sort_field": "modified", 
  "sort_order": "DESC"
-}
+}
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_team/sales_team.json b/erpnext/selling/doctype/sales_team/sales_team.json
index b2e3719..d15ce08 100644
--- a/erpnext/selling/doctype/sales_team/sales_team.json
+++ b/erpnext/selling/doctype/sales_team/sales_team.json
@@ -18,6 +18,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Sales Person", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "sales_person", 
    "oldfieldtype": "Link", 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Contact No.", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "contact_no", 
    "oldfieldtype": "Data", 
@@ -68,6 +70,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -89,6 +92,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Contribution (%)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "allocated_percentage", 
    "oldfieldtype": "Currency", 
@@ -114,6 +118,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Contribution to Net Total", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "allocated_amount", 
    "oldfieldtype": "Currency", 
@@ -140,6 +145,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Incentives", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "incentives", 
    "oldfieldtype": "Currency", 
@@ -164,6 +170,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Parenttype", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "parenttype", 
    "oldfieldtype": "Data", 
@@ -185,7 +192,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:12.258972", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:57.395852", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Sales Team", 
diff --git a/erpnext/selling/page/sales_browser/sales_browser.py b/erpnext/selling/page/sales_browser/sales_browser.py
index cfb283e..018ba3b 100644
--- a/erpnext/selling/page/sales_browser/sales_browser.py
+++ b/erpnext/selling/page/sales_browser/sales_browser.py
@@ -8,16 +8,16 @@
 @frappe.whitelist()
 def get_children():
 	ctype = frappe.local.form_dict.get('ctype')
-	frappe.local.form_dict['parent_field'] = 'parent_' + ctype.lower().replace(' ', '_')
-	if not frappe.form_dict.get('parent'):
-		frappe.local.form_dict['parent'] = ''
+	parent_field = 'parent_' + ctype.lower().replace(' ', '_')
+	parent = frappe.form_dict.get("parent") or ""
 
 	return frappe.db.sql("""select name as value,
 		if(is_group='Yes', 1, 0) as expandable
-		from `tab%(ctype)s`
+		from `tab{ctype}`
 		where docstatus < 2
-		and ifnull(%(parent_field)s,'') = "%(parent)s"
-		order by name""" % frappe.local.form_dict, as_dict=1)
+		and ifnull(`{parent_field}`,'') = %s
+		order by name""".format(ctype=frappe.db.escape(ctype), parent_field=frappe.db.escape(parent_field)),
+		parent, as_dict=1)
 
 @frappe.whitelist()
 def add_node():
diff --git a/erpnext/setup/doctype/authorization_rule/authorization_rule.json b/erpnext/setup/doctype/authorization_rule/authorization_rule.json
index 45c290e..9b08398 100644
--- a/erpnext/setup/doctype/authorization_rule/authorization_rule.json
+++ b/erpnext/setup/doctype/authorization_rule/authorization_rule.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Transaction", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "transaction", 
    "oldfieldtype": "Select", 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Based On", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "based_on", 
    "oldfieldtype": "Select", 
@@ -68,6 +70,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer or Item", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Customer\nItem", 
    "permlevel": 0, 
@@ -91,6 +94,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Customer / Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "master_name", 
    "oldfieldtype": "Link", 
@@ -114,6 +118,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -136,6 +141,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -159,6 +165,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -181,6 +188,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Authorized Value", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "value", 
    "oldfieldtype": "Currency", 
@@ -203,6 +211,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -225,6 +234,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Applicable To (Role)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "system_role", 
    "oldfieldtype": "Link", 
@@ -250,6 +260,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Applicable To (Employee)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "to_emp", 
    "oldfieldtype": "Link", 
@@ -273,6 +284,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -295,6 +307,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Applicable To (User)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "system_user", 
    "oldfieldtype": "Link", 
@@ -320,6 +333,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Applicable To (Designation)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "to_designation", 
    "oldfieldtype": "Link", 
@@ -343,6 +357,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -365,6 +380,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Approving Role (above authorized value)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "approving_role", 
    "oldfieldtype": "Link", 
@@ -388,6 +404,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -410,6 +427,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Approving User  (above authorized value)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "approving_user", 
    "oldfieldtype": "Link", 
@@ -433,7 +451,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-11-09 00:57:05.515494", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:42.164233", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Authorization Rule", 
diff --git a/erpnext/setup/doctype/brand/brand.json b/erpnext/setup/doctype/brand/brand.json
index 117462e..e31dd9d 100644
--- a/erpnext/setup/doctype/brand/brand.json
+++ b/erpnext/setup/doctype/brand/brand.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Brand Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "brand", 
    "oldfieldtype": "Data", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Text", 
@@ -66,7 +68,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:40.649074", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:43.008609", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Brand", 
diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json
index bfa4bcc..4c9f53d 100644
--- a/erpnext/setup/doctype/company/company.json
+++ b/erpnext/setup/doctype/company/company.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company_name", 
    "oldfieldtype": "Data", 
@@ -67,6 +69,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Abbr", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "abbr", 
    "oldfieldtype": "Data", 
@@ -91,6 +94,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Change Abbreviation", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -111,6 +115,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -131,7 +136,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Domain",  
+   "label": "Domain", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Distribution\nManufacturing\nRetail\nServices", 
    "permlevel": 0, 
@@ -154,6 +160,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Values", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -175,6 +182,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Letter Head", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Letter Head", 
    "permlevel": 0, 
@@ -198,6 +206,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Holiday List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Holiday List", 
    "permlevel": 0, 
@@ -221,6 +230,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Country", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Country", 
    "permlevel": 0, 
@@ -242,6 +252,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -264,6 +275,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Currency", 
    "permlevel": 0, 
@@ -286,6 +298,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Chart of Accounts", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "", 
    "permlevel": 0, 
@@ -308,6 +321,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Terms", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Terms and Conditions", 
    "permlevel": 0, 
@@ -331,6 +345,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Accounts Settings", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -354,6 +369,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Bank Account", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "default_bank_account", 
    "oldfieldtype": "Link", 
@@ -379,6 +395,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Cash Account", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Account", 
    "permlevel": 0, 
@@ -402,6 +419,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Receivable Account", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "receivables_group", 
    "oldfieldtype": "Link", 
@@ -426,6 +444,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Round Off Account", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Account", 
    "permlevel": 0, 
@@ -448,6 +467,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -472,6 +492,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Payable Account", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "payables_group", 
    "oldfieldtype": "Link", 
@@ -497,6 +518,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Cost of Goods Sold Account", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Account", 
    "permlevel": 0, 
@@ -520,6 +542,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Income Account", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Account", 
    "permlevel": 0, 
@@ -542,6 +565,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Round Off Cost Center", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Cost Center", 
    "permlevel": 0, 
@@ -564,6 +588,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -587,6 +612,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Cost Center", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Cost Center", 
    "permlevel": 0, 
@@ -608,7 +634,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Credit Days Based On",  
+   "label": "Credit Days Based On", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nFixed Days\nLast Day of the Next Month", 
    "permlevel": 0, 
@@ -633,6 +660,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Credit Days", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "credit_days", 
    "oldfieldtype": "Int", 
@@ -657,6 +685,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Credit Limit", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "credit_limit", 
    "oldfieldtype": "Currency", 
@@ -680,6 +709,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -702,7 +732,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "If Yearly Budget Exceeded (for expense account)",  
+   "label": "If Yearly Budget Exceeded (for expense account)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "yearly_bgt_flag", 
    "oldfieldtype": "Select", 
@@ -727,7 +758,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "If Monthly Budget Exceeded (for expense account)",  
+   "label": "If Monthly Budget Exceeded (for expense account)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "monthly_bgt_flag", 
    "oldfieldtype": "Select", 
@@ -753,6 +785,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Stock Settings", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -774,6 +807,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Stock Received But Not Billed", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Account", 
    "permlevel": 0, 
@@ -796,6 +830,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Stock Adjustment Account", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Account", 
    "permlevel": 0, 
@@ -817,6 +852,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -839,6 +875,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Expenses Included In Valuation", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Account", 
    "permlevel": 0, 
@@ -862,6 +899,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Company Info", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -883,6 +921,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "address", 
    "oldfieldtype": "Small Text", 
@@ -905,6 +944,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -928,6 +968,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Phone No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "phone_no", 
    "oldfieldtype": "Data", 
@@ -952,6 +993,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Fax", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fax", 
    "oldfieldtype": "Data", 
@@ -976,6 +1018,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Email", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "email", 
    "oldfieldtype": "Data", 
@@ -1000,6 +1043,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Website", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "website", 
    "oldfieldtype": "Data", 
@@ -1024,6 +1068,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -1048,6 +1093,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Registration Details", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "registration_details", 
    "oldfieldtype": "Code", 
@@ -1071,6 +1117,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Delete Company Transactions", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1092,7 +1139,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-13 09:15:29.028637", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:43.539356", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Company", 
diff --git a/erpnext/setup/doctype/currency_exchange/currency_exchange.json b/erpnext/setup/doctype/currency_exchange/currency_exchange.json
index f96eea7..ca0be3e 100644
--- a/erpnext/setup/doctype/currency_exchange/currency_exchange.json
+++ b/erpnext/setup/doctype/currency_exchange/currency_exchange.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "From Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Currency", 
    "permlevel": 0, 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "To Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Currency", 
    "permlevel": 0, 
@@ -64,6 +66,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Exchange Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "9", 
@@ -85,7 +88,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:42.981242", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:44.028262", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Currency Exchange", 
diff --git a/erpnext/setup/doctype/customer_group/customer_group.json b/erpnext/setup/doctype/customer_group/customer_group.json
index 6af2941..34d13bd 100644
--- a/erpnext/setup/doctype/customer_group/customer_group.json
+++ b/erpnext/setup/doctype/customer_group/customer_group.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Customer Group Name", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "customer_group_name", 
    "oldfieldtype": "Data", 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Parent Customer Group", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "parent_customer_group", 
    "oldfieldtype": "Link", 
@@ -68,7 +70,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Has Child Node",  
+   "label": "Has Child Node", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_group", 
    "oldfieldtype": "Select", 
@@ -92,6 +95,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -113,6 +117,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Price List", 
    "permlevel": 0, 
@@ -134,7 +139,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Credit Days Based On",  
+   "label": "Credit Days Based On", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nFixed Days\nLast Day of the Next Month", 
    "permlevel": 0, 
@@ -159,6 +165,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Credit Days", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 1, 
    "print_hide": 0, 
@@ -180,6 +187,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Credit Limit", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 1, 
    "print_hide": 0, 
@@ -201,6 +209,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "lft", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "lft", 
    "oldfieldtype": "Int", 
@@ -224,6 +233,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "rgt", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "rgt", 
    "oldfieldtype": "Int", 
@@ -248,6 +258,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "old_parent", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "old_parent", 
    "oldfieldtype": "Data", 
@@ -272,6 +283,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Receivable Account", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -295,6 +307,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Accounts", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Party Account", 
    "permlevel": 0, 
@@ -316,7 +329,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:43.817644", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:44.374615", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Customer Group", 
diff --git a/erpnext/setup/doctype/email_digest/email_digest.json b/erpnext/setup/doctype/email_digest/email_digest.json
index ceec47a8..c47ebae 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.json
+++ b/erpnext/setup/doctype/email_digest/email_digest.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Email Digest Settings", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -41,6 +42,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -62,6 +64,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Enabled", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -83,6 +86,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "For Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -104,7 +108,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "How frequently?",  
+   "label": "How frequently?", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Daily\nWeekly\nMonthly", 
    "permlevel": 0, 
@@ -128,6 +133,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Next email will be sent on:", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -148,6 +154,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -170,6 +177,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Recipients", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -191,6 +199,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Add/Remove Recipients", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -212,6 +221,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Accounts", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -233,6 +243,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Income / Expense", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -255,6 +266,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Income", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -277,6 +289,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Expense", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -299,6 +312,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Bank Balance", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -320,6 +334,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Annual Income", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -341,6 +356,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Annual Expense", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -364,6 +380,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Receivables / Payables", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -386,6 +403,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Receivables", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -408,6 +426,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Payables", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -428,7 +447,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-12 07:38:48.323418", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:46.135437", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Email Digest", 
diff --git a/erpnext/setup/doctype/email_digest/templates/default.html b/erpnext/setup/doctype/email_digest/templates/default.html
index bd88baf..a931fbb 100644
--- a/erpnext/setup/doctype/email_digest/templates/default.html
+++ b/erpnext/setup/doctype/email_digest/templates/default.html
@@ -117,8 +117,7 @@
 
 <div style="text-align: center; margin: 50px; line-height: 1.5">
     {{ quote.text }}<br><i>- {{ quote.author }}</i>
-    <br><br><br>
-    <span style="color: {{ text_muted }}; font-size: 12px;">Have an intersting thought, quote to share? Email it at hello@erpnext.com</span>
+    <br>
 </div>
 
 </div>
diff --git a/erpnext/setup/doctype/item_group/item_group.json b/erpnext/setup/doctype/item_group/item_group.json
index d0677e0..a1ccee2 100644
--- a/erpnext/setup/doctype/item_group/item_group.json
+++ b/erpnext/setup/doctype/item_group/item_group.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "General Settings", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Group Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_group_name", 
    "oldfieldtype": "Data", 
@@ -66,6 +68,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Parent Item Group", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "parent_item_group", 
    "oldfieldtype": "Link", 
@@ -90,7 +93,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Has Child Node",  
+   "label": "Has Child Node", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_group", 
    "oldfieldtype": "Select", 
@@ -114,6 +118,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -135,6 +140,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Income Account", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Account", 
    "permlevel": 0, 
@@ -157,6 +163,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Expense Account", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Account", 
    "permlevel": 0, 
@@ -179,6 +186,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Cost Center", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Cost Center", 
    "permlevel": 0, 
@@ -201,6 +209,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Website Settings", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -223,6 +232,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Show in Website", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -245,6 +255,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Page Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -267,6 +278,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Parent Website Route", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "", 
    "permlevel": 0, 
@@ -291,6 +303,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Slideshow", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Website Slideshow", 
    "permlevel": 0, 
@@ -315,6 +328,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -337,6 +351,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Website Specifications", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Item Website Specification", 
    "permlevel": 0, 
@@ -359,6 +374,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "lft", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "lft", 
    "oldfieldtype": "Int", 
@@ -382,6 +398,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "rgt", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "rgt", 
    "oldfieldtype": "Int", 
@@ -406,6 +423,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "old_parent", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "old_parent", 
    "oldfieldtype": "Data", 
@@ -430,7 +448,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 3, 
- "modified": "2015-10-02 07:38:53.048954", 
+ "modified": "2015-11-16 06:29:48.316308", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Item Group", 
diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py
index 9a4497b..ed7da9c 100644
--- a/erpnext/setup/doctype/item_group/item_group.py
+++ b/erpnext/setup/doctype/item_group/item_group.py
@@ -111,7 +111,7 @@
 	item_group = frappe.get_doc("Item Group", item_group_name)
 	return frappe.db.sql("""select name, page_name from `tabItem Group`
 		where lft <= %s and rgt >= %s
-		and ifnull(show_in_website,0)=1
+		and show_in_website=1
 		order by lft asc""", (item_group.lft, item_group.rgt), as_dict=True)
 
 def invalidate_cache_for(doc, item_group=None):
diff --git a/erpnext/setup/doctype/print_heading/print_heading.json b/erpnext/setup/doctype/print_heading/print_heading.json
index af88721..d9c01a1 100644
--- a/erpnext/setup/doctype/print_heading/print_heading.json
+++ b/erpnext/setup/doctype/print_heading/print_heading.json
@@ -20,6 +20,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Print Heading", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "print_heading", 
    "oldfieldtype": "Data", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Small Text", 
@@ -66,7 +68,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:01.094104", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:52.194195", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Print Heading", 
diff --git a/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.json b/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.json
index c1df93d..eb7f044 100644
--- a/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.json
+++ b/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Quotation Lost Reason", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "order_lost_reason", 
    "oldfieldtype": "Data", 
@@ -42,7 +43,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:07.868834", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:55.325868", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Quotation Lost Reason", 
diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.json b/erpnext/setup/doctype/sales_partner/sales_partner.json
index ec1cbd2..956f39f 100644
--- a/erpnext/setup/doctype/sales_partner/sales_partner.json
+++ b/erpnext/setup/doctype/sales_partner/sales_partner.json
@@ -21,6 +21,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Sales Partner Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "partner_name", 
    "oldfieldtype": "Data", 
@@ -44,6 +45,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Partner Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "partner_type", 
    "oldfieldtype": "Select", 
@@ -69,6 +71,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Territory", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Territory", 
    "permlevel": 0, 
@@ -90,6 +93,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -113,6 +117,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Commission Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "commission_rate", 
    "oldfieldtype": "Currency", 
@@ -136,6 +141,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address & Contacts", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -158,6 +164,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address Desc", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "<em>Addresses will appear only when you save the customer</em>", 
    "permlevel": 0, 
@@ -180,6 +187,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address HTML", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -200,6 +208,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -222,6 +231,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Desc", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "<em>Contact Details will appear only when you save the customer</em>", 
    "permlevel": 0, 
@@ -244,6 +254,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact HTML", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -265,6 +276,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Partner Target", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -287,6 +299,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Targets", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "partner_target_details", 
    "oldfieldtype": "Table", 
@@ -312,6 +325,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Target Distribution", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "distribution_id", 
    "oldfieldtype": "Link", 
@@ -336,6 +350,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Website", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -357,6 +372,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Show In Website", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -378,6 +394,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -399,6 +416,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Logo", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "", 
    "permlevel": 0, 
@@ -421,6 +439,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Partner's Website", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -441,6 +460,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -462,6 +482,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Page Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -483,6 +504,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -504,6 +526,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Introduction", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -525,6 +548,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -547,6 +571,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Parent Website Route", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "", 
    "permlevel": 0, 
@@ -568,7 +593,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-19 03:04:48.999751", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:57.096980", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Sales Partner", 
diff --git a/erpnext/setup/doctype/sales_person/sales_person.json b/erpnext/setup/doctype/sales_person/sales_person.json
index 5b8e82e..adb4c67 100644
--- a/erpnext/setup/doctype/sales_person/sales_person.json
+++ b/erpnext/setup/doctype/sales_person/sales_person.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Name and Employee ID", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-user", 
    "permlevel": 0, 
@@ -43,6 +44,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Sales Person Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "sales_person_name", 
    "oldfieldtype": "Data", 
@@ -67,6 +69,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Parent Sales Person", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "parent_sales_person", 
    "oldfieldtype": "Link", 
@@ -90,7 +93,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Has Child Node",  
+   "label": "Has Child Node", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_group", 
    "oldfieldtype": "Select", 
@@ -114,6 +118,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -135,6 +140,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Employee", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Employee", 
    "permlevel": 0, 
@@ -157,6 +163,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "lft", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "lft", 
    "oldfieldtype": "Int", 
@@ -180,6 +187,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "rgt", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "rgt", 
    "oldfieldtype": "Int", 
@@ -203,6 +211,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "old_parent", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "old_parent", 
    "oldfieldtype": "Data", 
@@ -227,6 +236,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Person Targets", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-bullseye", 
@@ -250,6 +260,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Targets", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "target_details", 
    "oldfieldtype": "Table", 
@@ -275,6 +286,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Target Distribution", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "distribution_id", 
    "oldfieldtype": "Link", 
@@ -299,6 +311,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Communications", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Communication", 
    "permlevel": 0, 
@@ -320,7 +333,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:11.827879", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:57.194163", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Sales Person", 
diff --git a/erpnext/setup/doctype/sms_parameter/sms_parameter.json b/erpnext/setup/doctype/sms_parameter/sms_parameter.json
index bc948c7..2ccdf9a 100755
--- a/erpnext/setup/doctype/sms_parameter/sms_parameter.json
+++ b/erpnext/setup/doctype/sms_parameter/sms_parameter.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Parameter", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -41,6 +42,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Value", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -62,7 +64,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:13.345489", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:57.845086", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "SMS Parameter", 
diff --git a/erpnext/setup/doctype/sms_settings/sms_settings.py b/erpnext/setup/doctype/sms_settings/sms_settings.py
index 9099863..d0df33a 100644
--- a/erpnext/setup/doctype/sms_settings/sms_settings.py
+++ b/erpnext/setup/doctype/sms_settings/sms_settings.py
@@ -42,7 +42,7 @@
 def get_contact_number(contact_name, value, key):
 	"returns mobile number of the contact"
 	number = frappe.db.sql("""select mobile_no, phone from tabContact where name=%s and %s=%s""" %
-		('%s', key, '%s'), (contact_name, value))
+		('%s', frappe.db.escape(key), '%s'), (contact_name, value))
 	return number and (number[0][0] or number[0][1]) or ''
 
 @frappe.whitelist()
@@ -94,7 +94,7 @@
 	headers = {}
 	headers['Accept'] = "text/plain, text/html, */*"
 	conn.request('GET', api_url + urllib.urlencode(args), headers = headers)    # send request
-	resp = conn.getresponse()     # get response		
+	resp = conn.getresponse()     # get response
 	return resp.status
 
 # Split gateway url to server and api url
diff --git a/erpnext/setup/doctype/supplier_type/supplier_type.json b/erpnext/setup/doctype/supplier_type/supplier_type.json
index b04e9c7..c6849b7 100644
--- a/erpnext/setup/doctype/supplier_type/supplier_type.json
+++ b/erpnext/setup/doctype/supplier_type/supplier_type.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Supplier Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "supplier_type", 
    "oldfieldtype": "Data", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Credit Days", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 1, 
    "print_hide": 0, 
@@ -64,6 +66,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Payable Account", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -87,6 +90,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Accounts", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Party Account", 
    "permlevel": 0, 
@@ -108,7 +112,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:15.811805", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:58.970888", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Supplier Type", 
diff --git a/erpnext/setup/doctype/target_detail/target_detail.json b/erpnext/setup/doctype/target_detail/target_detail.json
index db1bd79..0ad842d 100644
--- a/erpnext/setup/doctype/target_detail/target_detail.json
+++ b/erpnext/setup/doctype/target_detail/target_detail.json
@@ -19,6 +19,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item Group", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_group", 
    "oldfieldtype": "Link", 
@@ -43,6 +44,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -67,6 +69,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Target Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "target_qty", 
    "oldfieldtype": "Currency", 
@@ -90,6 +93,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Target  Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "target_amount", 
    "oldfieldtype": "Currency", 
@@ -111,7 +115,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:15.903411", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:59.015624", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Target Detail", 
diff --git a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.json b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.json
index b126aa8..5fb635e 100644
--- a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.json
+++ b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.json
@@ -21,6 +21,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Title", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "title", 
    "oldfieldtype": "Data", 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms and Conditions", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "terms", 
    "oldfieldtype": "Text Editor", 
@@ -66,7 +68,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:16.489390", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:59.292943", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Terms and Conditions", 
diff --git a/erpnext/setup/doctype/territory/territory.json b/erpnext/setup/doctype/territory/territory.json
index c5e4fff..4ce0fff 100644
--- a/erpnext/setup/doctype/territory/territory.json
+++ b/erpnext/setup/doctype/territory/territory.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Territory Name", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "territory_name", 
    "oldfieldtype": "Data", 
@@ -45,6 +46,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Parent Territory", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "parent_territory", 
    "oldfieldtype": "Link", 
@@ -69,7 +71,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Has Child Node",  
+   "label": "Has Child Node", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_group", 
    "oldfieldtype": "Select", 
@@ -93,6 +96,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -115,6 +119,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Territory Manager", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "territory_manager", 
    "oldfieldtype": "Link", 
@@ -139,6 +144,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "lft", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "lft", 
    "oldfieldtype": "Int", 
@@ -162,6 +168,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "rgt", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "rgt", 
    "oldfieldtype": "Int", 
@@ -186,6 +193,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "old_parent", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "old_parent", 
    "oldfieldtype": "Data", 
@@ -211,6 +219,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Territory Targets", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -233,6 +242,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Targets", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "target_details", 
    "oldfieldtype": "Table", 
@@ -258,6 +268,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Target Distribution", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "distribution_id", 
    "oldfieldtype": "Link", 
@@ -281,7 +292,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:16.582674", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:59.337250", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Territory", 
diff --git a/erpnext/setup/doctype/uom/uom.json b/erpnext/setup/doctype/uom/uom.json
index b879fc6..d3255d2 100644
--- a/erpnext/setup/doctype/uom/uom.json
+++ b/erpnext/setup/doctype/uom/uom.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "UOM Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "uom_name", 
    "oldfieldtype": "Data", 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Must be Whole Number", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -64,7 +66,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:17.551613", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:59.741239", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "UOM", 
diff --git a/erpnext/setup/doctype/website_item_group/website_item_group.json b/erpnext/setup/doctype/website_item_group/website_item_group.json
index 132c351..b0af70c 100644
--- a/erpnext/setup/doctype/website_item_group/website_item_group.json
+++ b/erpnext/setup/doctype/website_item_group/website_item_group.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Group", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Item Group", 
    "permlevel": 0, 
@@ -41,7 +42,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:19.409021", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:30:00.586322", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Website Item Group", 
diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py
index 474af2c..445c09d 100644
--- a/erpnext/startup/boot.py
+++ b/erpnext/startup/boot.py
@@ -39,12 +39,12 @@
 		bootinfo.docs += [frappe.get_doc("Country", country)]
 
 	bootinfo.docs += frappe.db.sql("""select * from tabCurrency
-		where ifnull(enabled,0)=1""", as_dict=1, update={"doctype":":Currency"})
+		where enabled=1""", as_dict=1, update={"doctype":":Currency"})
 
 def get_letter_heads():
 	import frappe
 	ret = frappe.db.sql("""select name, content from `tabLetter Head`
-		where ifnull(disabled,0)=0""")
+		where disabled=0""")
 	return dict(ret)
 
 def update_page_info(bootinfo):
diff --git a/erpnext/startup/report_data_map.py b/erpnext/startup/report_data_map.py
index b8653cd..7e209b6 100644
--- a/erpnext/startup/report_data_map.py
+++ b/erpnext/startup/report_data_map.py
@@ -78,7 +78,7 @@
 	"Stock Ledger Entry": {
 		"columns": ["name", "posting_date", "posting_time", "item_code", "warehouse",
 			"actual_qty as qty", "voucher_type", "voucher_no", "project",
-			"ifnull(incoming_rate,0) as incoming_rate", "stock_uom", "serial_no",
+			"incoming_rate as incoming_rate", "stock_uom", "serial_no",
 			"qty_after_transaction", "valuation_rate"],
 		"order_by": "posting_date, posting_time, name",
 		"links": {
@@ -100,10 +100,10 @@
 	},
 	"Production Order": {
 		"columns": ["name", "production_item as item_code",
-			"(ifnull(qty, 0) - ifnull(produced_qty, 0)) as qty",
+			"(qty - produced_qty) as qty",
 			"fg_warehouse as warehouse"],
 		"conditions": ["docstatus=1", "status != 'Stopped'", "ifnull(fg_warehouse, '')!=''",
-			"ifnull(qty, 0) > ifnull(produced_qty, 0)"],
+			"qty > produced_qty"],
 		"links": {
 			"item_code": ["Item", "name"],
 			"warehouse": ["Warehouse", "name"]
@@ -111,10 +111,10 @@
 	},
 	"Material Request Item": {
 		"columns": ["item.name as name", "item_code", "warehouse",
-			"(ifnull(qty, 0) - ifnull(ordered_qty, 0)) as qty"],
+			"(qty - ordered_qty) as qty"],
 		"from": "`tabMaterial Request Item` item, `tabMaterial Request` main",
 		"conditions": ["item.parent = main.name", "main.docstatus=1", "main.status != 'Stopped'",
-			"ifnull(warehouse, '')!=''", "ifnull(qty, 0) > ifnull(ordered_qty, 0)"],
+			"ifnull(warehouse, '')!=''", "qty > ordered_qty"],
 		"links": {
 			"item_code": ["Item", "name"],
 			"warehouse": ["Warehouse", "name"]
@@ -122,10 +122,10 @@
 	},
 	"Purchase Order Item": {
 		"columns": ["item.name as name", "item_code", "warehouse",
-			"(ifnull(qty, 0) - ifnull(received_qty, 0)) as qty"],
+			"(qty - received_qty) as qty"],
 		"from": "`tabPurchase Order Item` item, `tabPurchase Order` main",
 		"conditions": ["item.parent = main.name", "main.docstatus=1", "main.status != 'Stopped'",
-			"ifnull(warehouse, '')!=''", "ifnull(qty, 0) > ifnull(received_qty, 0)"],
+			"ifnull(warehouse, '')!=''", "qty > received_qty"],
 		"links": {
 			"item_code": ["Item", "name"],
 			"warehouse": ["Warehouse", "name"]
@@ -133,10 +133,10 @@
 	},
 
 	"Sales Order Item": {
-		"columns": ["item.name as name", "item_code", "(ifnull(qty, 0) - ifnull(delivered_qty, 0)) as qty", "warehouse"],
+		"columns": ["item.name as name", "item_code", "(qty - delivered_qty) as qty", "warehouse"],
 		"from": "`tabSales Order Item` item, `tabSales Order` main",
 		"conditions": ["item.parent = main.name", "main.docstatus=1", "main.status != 'Stopped'",
-			"ifnull(warehouse, '')!=''", "ifnull(qty, 0) > ifnull(delivered_qty, 0)"],
+			"ifnull(warehouse, '')!=''", "qty > delivered_qty"],
 		"links": {
 			"item_code": ["Item", "name"],
 			"warehouse": ["Warehouse", "name"]
diff --git a/erpnext/stock/doctype/batch/batch.json b/erpnext/stock/doctype/batch/batch.json
index 31ab1b0..1abe9b3 100644
--- a/erpnext/stock/doctype/batch/batch.json
+++ b/erpnext/stock/doctype/batch/batch.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Batch ID", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "batch_id", 
    "oldfieldtype": "Data", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item", 
    "oldfieldtype": "Link", 
@@ -66,6 +68,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -88,6 +91,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Expiry Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "expiry_date", 
    "oldfieldtype": "Date", 
@@ -110,6 +114,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -132,6 +137,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Batch Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Small Text", 
@@ -156,7 +162,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 5, 
- "modified": "2015-10-02 07:38:39.257122", 
+ "modified": "2015-11-16 06:29:42.315839", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Batch", 
diff --git a/erpnext/stock/doctype/bin/bin.json b/erpnext/stock/doctype/bin/bin.json
index 7231d75..37fe0a4 100644
--- a/erpnext/stock/doctype/bin/bin.json
+++ b/erpnext/stock/doctype/bin/bin.json
@@ -19,6 +19,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "warehouse", 
    "oldfieldtype": "Link", 
@@ -43,6 +44,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -68,6 +70,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Reserved Quantity", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "reserved_qty", 
    "oldfieldtype": "Currency", 
@@ -92,6 +95,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Actual Quantity", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "actual_qty", 
    "oldfieldtype": "Currency", 
@@ -116,6 +120,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Ordered Quantity", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "ordered_qty", 
    "oldfieldtype": "Currency", 
@@ -140,6 +145,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Quantity Requested for Purchase", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "indented_qty", 
    "oldfieldtype": "Currency", 
@@ -163,6 +169,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Planned Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "planned_qty", 
    "oldfieldtype": "Currency", 
@@ -186,6 +193,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Projected Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "projected_qty", 
    "oldfieldtype": "Currency", 
@@ -209,6 +217,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Moving Average Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "ma_rate", 
    "oldfieldtype": "Currency", 
@@ -232,6 +241,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "stock_uom", 
    "oldfieldtype": "Data", 
@@ -256,6 +266,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "FCFS Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fcfs_rate", 
    "oldfieldtype": "Currency", 
@@ -279,6 +290,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Valuation Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "valuation_rate", 
    "oldfieldtype": "Currency", 
@@ -302,6 +314,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Stock Value", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "stock_value", 
    "oldfieldtype": "Currency", 
@@ -323,7 +336,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:39.346727", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:42.363502", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Bin", 
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json
index 16c1e6d..b776ee2 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.json
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Delivery To", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-user", 
    "permlevel": 0, 
@@ -41,6 +42,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -66,6 +68,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Title", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -88,6 +91,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "naming_series", 
    "oldfieldtype": "Select", 
@@ -112,6 +116,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer", 
    "oldfieldtype": "Link", 
@@ -137,6 +142,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -159,6 +165,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Billing Address Name", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Address", 
    "permlevel": 0, 
@@ -181,6 +188,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Billing Address", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -202,6 +210,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Shipping Address", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Address", 
    "permlevel": 0, 
@@ -224,6 +233,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Shipping Address", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -245,6 +255,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -266,6 +277,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Mobile No", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -287,6 +299,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Email", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -307,6 +320,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -329,6 +343,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Data", 
@@ -356,6 +371,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -383,6 +399,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "posting_date", 
    "oldfieldtype": "Date", 
@@ -408,6 +425,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer's Purchase Order No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "po_no", 
    "oldfieldtype": "Data", 
@@ -434,6 +452,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer's Purchase Order Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "po_date", 
    "oldfieldtype": "Data", 
@@ -459,6 +478,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Return", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -482,6 +502,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Return Against Delivery Note", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Delivery Note", 
    "permlevel": 0, 
@@ -505,6 +526,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Currency and Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-tag", 
    "permlevel": 0, 
@@ -527,6 +549,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "currency", 
    "oldfieldtype": "Select", 
@@ -552,6 +575,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Exchange Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "conversion_rate", 
    "oldfieldtype": "Currency", 
@@ -575,6 +599,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -596,6 +621,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "price_list_name", 
    "oldfieldtype": "Select", 
@@ -620,6 +646,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Currency", 
    "permlevel": 0, 
@@ -643,6 +670,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Exchange Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "9", 
@@ -665,6 +693,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Ignore Pricing Rule", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 1, 
    "print_hide": 1, 
@@ -686,6 +715,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-shopping-cart", 
@@ -709,6 +739,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Items", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "delivery_note_details", 
    "oldfieldtype": "Table", 
@@ -734,6 +765,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Packing List", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-suitcase", 
@@ -757,6 +789,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Packed Items", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "packing_details", 
    "oldfieldtype": "Table", 
@@ -781,6 +814,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Product Bundle Help", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -801,6 +835,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -822,6 +857,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -845,6 +881,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "net_total", 
    "oldfieldtype": "Currency", 
@@ -870,6 +907,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -891,6 +929,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -914,6 +953,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Total", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -936,6 +976,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-money", 
@@ -960,6 +1001,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "charge", 
    "oldfieldtype": "Link", 
@@ -983,6 +1025,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1004,6 +1047,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Shipping Rule", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Button", 
    "options": "Shipping Rule", 
@@ -1026,6 +1070,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1047,6 +1092,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges", 
    "oldfieldtype": "Table", 
@@ -1071,6 +1117,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges Calculation", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "HTML", 
    "permlevel": 0, 
@@ -1092,6 +1139,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1113,6 +1161,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Taxes and Charges (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges_total", 
    "oldfieldtype": "Currency", 
@@ -1138,6 +1187,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1160,6 +1210,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -1183,6 +1234,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1206,6 +1258,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Apply Additional Discount On", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nGrand Total\nNet Total", 
    "permlevel": 0, 
@@ -1228,6 +1281,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1249,6 +1303,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -1271,6 +1326,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -1294,6 +1350,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-money", 
@@ -1317,6 +1374,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Grand Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "grand_total", 
    "oldfieldtype": "Currency", 
@@ -1343,6 +1401,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rounded Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "rounded_total", 
    "oldfieldtype": "Currency", 
@@ -1370,6 +1429,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "In Words (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "in_words", 
    "oldfieldtype": "Data", 
@@ -1394,6 +1454,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -1416,6 +1477,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Grand Total", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "grand_total_export", 
    "oldfieldtype": "Currency", 
@@ -1442,6 +1504,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rounded Total", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "rounded_total_export", 
    "oldfieldtype": "Currency", 
@@ -1469,6 +1532,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "In Words", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "in_words_export", 
    "oldfieldtype": "Data", 
@@ -1495,6 +1559,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms and Conditions", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-legal", 
@@ -1518,6 +1583,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "tc_name", 
    "oldfieldtype": "Link", 
@@ -1542,6 +1608,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms and Conditions Details", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "terms", 
    "oldfieldtype": "Text Editor", 
@@ -1566,6 +1633,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Transporter Info", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-truck", 
    "permlevel": 0, 
@@ -1588,6 +1656,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Transporter Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "transporter_name", 
    "oldfieldtype": "Data", 
@@ -1612,6 +1681,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1636,6 +1706,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Vehicle No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "lr_no", 
    "oldfieldtype": "Data", 
@@ -1663,6 +1734,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Vehicle Dispatch Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "lr_date", 
    "oldfieldtype": "Date", 
@@ -1689,6 +1761,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Details", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-bullhorn", 
    "permlevel": 0, 
@@ -1712,6 +1785,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Territory", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Territory", 
    "permlevel": 0, 
@@ -1735,6 +1809,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer Group", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Customer Group", 
    "permlevel": 0, 
@@ -1756,6 +1831,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1779,6 +1855,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Contact Person", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Contact", 
    "permlevel": 0, 
@@ -1801,6 +1878,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "More Information", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-file-text", 
@@ -1825,6 +1903,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Project Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "project_name", 
    "oldfieldtype": "Link", 
@@ -1850,6 +1929,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Campaign", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "campaign", 
    "oldfieldtype": "Link", 
@@ -1874,6 +1954,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Source", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "source", 
    "oldfieldtype": "Select", 
@@ -1897,6 +1978,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -1922,6 +2004,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Posting Time", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "posting_time", 
    "oldfieldtype": "Time", 
@@ -1947,6 +2030,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -1973,6 +2057,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Printing Details", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1995,6 +2080,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Letter Head", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "letter_head", 
    "oldfieldtype": "Link", 
@@ -2019,6 +2105,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Print Heading", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "select_print_heading", 
    "oldfieldtype": "Link", 
@@ -2042,6 +2129,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -2064,6 +2152,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Print Without Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "print_without_amount", 
    "oldfieldtype": "Check", 
@@ -2087,6 +2176,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Status", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -2109,6 +2199,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "status", 
    "oldfieldtype": "Select", 
@@ -2137,6 +2228,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "% Installed", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "per_installed", 
    "oldfieldtype": "Currency", 
@@ -2160,6 +2252,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Installation Status", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2180,6 +2273,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -2202,6 +2296,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "To Warehouse", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "to_warehouse", 
    "oldfieldtype": "Link", 
@@ -2226,6 +2321,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Excise Page Number", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "excise_page", 
    "oldfieldtype": "Data", 
@@ -2249,6 +2345,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Instructions", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "instructions", 
    "oldfieldtype": "Text", 
@@ -2273,6 +2370,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Commission", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-group", 
@@ -2296,6 +2394,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Partner", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "sales_partner", 
    "oldfieldtype": "Link", 
@@ -2321,6 +2420,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2344,6 +2444,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Commission Rate (%)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "commission_rate", 
    "oldfieldtype": "Currency", 
@@ -2369,6 +2470,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Commission", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "total_commission", 
    "oldfieldtype": "Currency", 
@@ -2394,6 +2496,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Team", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -2415,6 +2518,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Team1", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "sales_team", 
    "oldfieldtype": "Table", 
@@ -2438,7 +2542,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-11-02 01:20:58.934509", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:44.673451", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Delivery Note", 
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index 60cc430..fd3742e 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -37,7 +37,7 @@
 			'second_join_field': 'so_detail',
 			'overflow_type': 'delivery',
 			'second_source_extra_cond': """ and exists(select name from `tabSales Invoice`
-				where name=`tabSales Invoice Item`.parent and ifnull(update_stock, 0) = 1)"""
+				where name=`tabSales Invoice Item`.parent and update_stock = 1)"""
 		},
 		{
 			'source_dt': 'Delivery Note Item',
@@ -65,7 +65,7 @@
 		}]
 
 	def onload(self):
-		billed_qty = frappe.db.sql("""select sum(ifnull(qty, 0)) from `tabSales Invoice Item`
+		billed_qty = frappe.db.sql("""select sum(qty) from `tabSales Invoice Item`
 			where docstatus=1 and delivery_note=%s""", self.name)
 		if billed_qty:
 			total_qty = sum((item.qty for item in self.get("items")))
@@ -170,6 +170,8 @@
 					chk_dupl_itm.append(f)
 
 	def validate_warehouse(self):
+		super(DeliveryNote, self).validate_warehouse()
+		
 		for d in self.get_item_list():
 			if frappe.db.get_value("Item", d['item_code'], "is_stock_item") == 1:
 				if not d['warehouse']:
diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
index c1d4591..2dbdd96 100644
--- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Barcode", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -40,6 +41,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -66,6 +68,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_name", 
    "oldfieldtype": "Data", 
@@ -90,6 +93,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -111,6 +115,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer's Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -132,6 +137,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -154,6 +160,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Small Text", 
@@ -178,6 +185,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -200,6 +208,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -222,6 +231,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image View", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "image", 
    "permlevel": 0, 
@@ -245,6 +255,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Quantity and Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -266,6 +277,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Quantity", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "qty", 
    "oldfieldtype": "Currency", 
@@ -291,6 +303,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "ref_rate", 
    "oldfieldtype": "Currency", 
@@ -318,6 +331,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Discount on Price List Rate (%)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "adj_rate", 
    "oldfieldtype": "Float", 
@@ -342,6 +356,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -363,6 +378,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "stock_uom", 
    "oldfieldtype": "Data", 
@@ -389,6 +405,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Rate (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "base_ref_rate", 
    "oldfieldtype": "Currency", 
@@ -414,6 +431,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -435,6 +453,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "export_rate", 
    "oldfieldtype": "Currency", 
@@ -461,6 +480,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "export_amount", 
    "oldfieldtype": "Currency", 
@@ -486,6 +506,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -507,6 +528,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rate (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "basic_rate", 
    "oldfieldtype": "Currency", 
@@ -533,6 +555,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "amount", 
    "oldfieldtype": "Currency", 
@@ -559,6 +582,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Pricing Rule", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Pricing Rule", 
    "permlevel": 0, 
@@ -580,6 +604,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -602,6 +627,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -625,6 +651,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -647,6 +674,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -669,6 +697,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Rate (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -692,6 +721,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -715,6 +745,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Warehouse and Reference", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -736,6 +767,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "From Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "warehouse", 
    "oldfieldtype": "Link", 
@@ -764,6 +796,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "To Warehouse (Optional)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Warehouse", 
    "permlevel": 0, 
@@ -787,6 +820,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Serial No", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "serial_no", 
    "oldfieldtype": "Text", 
@@ -810,6 +844,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Batch No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "batch_no", 
    "oldfieldtype": "Link", 
@@ -834,6 +869,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Available Qty at From Warehouse", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "actual_qty", 
    "oldfieldtype": "Currency", 
@@ -860,6 +896,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Available Batch Qty at From Warehouse", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -885,6 +922,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Group", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_group", 
    "oldfieldtype": "Link", 
@@ -909,6 +947,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Brand Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "brand", 
    "oldfieldtype": "Link", 
@@ -935,6 +974,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Tax Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_tax_rate", 
    "oldfieldtype": "Small Text", 
@@ -957,6 +997,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -978,6 +1019,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Expense Account", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Account", 
    "permlevel": 0, 
@@ -1002,6 +1044,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Cost Center", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Cost Center", 
    "permlevel": 0, 
@@ -1025,6 +1068,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Against Sales Order", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Sales Order", 
    "permlevel": 0, 
@@ -1047,6 +1091,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Against Sales Invoice", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Sales Invoice", 
    "permlevel": 0, 
@@ -1069,6 +1114,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Against Sales Order Item", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "prevdoc_detail_docname", 
    "oldfieldtype": "Data", 
@@ -1094,6 +1140,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Against Sales Invoice Item", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -1116,6 +1163,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Installed Qty", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "installed_qty", 
    "oldfieldtype": "Currency", 
@@ -1141,6 +1189,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Page Break", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "page_break", 
    "oldfieldtype": "Check", 
@@ -1162,7 +1211,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-28 12:41:53.738462", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:45.014492", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Delivery Note Item", 
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json
index c05170d..4b53b0e 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -22,6 +22,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-flag", 
@@ -45,6 +46,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Series", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "ITEM-", 
    "permlevel": 0, 
@@ -68,6 +70,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Data", 
@@ -93,6 +96,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Variant Of", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Item", 
    "permlevel": 0, 
@@ -116,6 +120,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_name", 
    "oldfieldtype": "Data", 
@@ -140,6 +145,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item Group", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_group", 
    "oldfieldtype": "Link", 
@@ -165,6 +171,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Unit of Measure", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "stock_uom", 
    "oldfieldtype": "Link", 
@@ -188,6 +195,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -211,6 +219,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Maintain Stock", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_stock_item", 
    "oldfieldtype": "Select", 
@@ -235,6 +244,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Disabled", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -257,6 +267,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "image", 
    "permlevel": 0, 
@@ -280,6 +291,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Image View", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "image", 
    "permlevel": 0, 
@@ -303,6 +315,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -325,6 +338,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Brand", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "brand", 
    "oldfieldtype": "Link", 
@@ -349,6 +363,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Barcode", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -370,6 +385,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Text", 
@@ -395,6 +411,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Inventory", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-truck", 
@@ -420,6 +437,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "default_warehouse", 
    "oldfieldtype": "Link", 
@@ -446,6 +464,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "End of Life", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "end_of_life", 
    "oldfieldtype": "Date", 
@@ -471,6 +490,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Has Batch No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "has_batch_no", 
    "oldfieldtype": "Select", 
@@ -498,6 +518,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Has Serial No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "has_serial_no", 
    "oldfieldtype": "Select", 
@@ -524,6 +545,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Serial Number Series", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -548,6 +570,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Fixed Asset Item", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_asset_item", 
    "oldfieldtype": "Select", 
@@ -572,6 +595,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -597,6 +621,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Allow over delivery or receipt upto this percent", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "tolerance", 
    "oldfieldtype": "Currency", 
@@ -621,6 +646,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Valuation Method", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nFIFO\nMoving Average", 
    "permlevel": 0, 
@@ -644,6 +670,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Warranty Period (in days)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "warranty_period", 
    "oldfieldtype": "Data", 
@@ -669,6 +696,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Weight", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -691,6 +719,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Weight UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "UOM", 
    "permlevel": 0, 
@@ -715,6 +744,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Auto re-order", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-rss", 
    "permlevel": 0, 
@@ -739,6 +769,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Re-order Level", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "re_order_level", 
    "oldfieldtype": "Currency", 
@@ -763,6 +794,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Re-order Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -785,6 +817,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Apply Warehouse-wise Reorder Level", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -809,6 +842,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reorder level based on Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -832,6 +866,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reorder level based on Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Item Reorder", 
    "permlevel": 0, 
@@ -856,6 +891,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Variants", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -881,6 +917,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Has Variants", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "", 
    "permlevel": 0, 
@@ -905,6 +942,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Attributes", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Item Variant Attribute", 
    "permlevel": 0, 
@@ -928,6 +966,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Purchase Details", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-shopping-cart", 
@@ -953,6 +992,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Purchase Item", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_purchase_item", 
    "oldfieldtype": "Select", 
@@ -980,6 +1020,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Minimum Order Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "min_order_qty", 
    "oldfieldtype": "Currency", 
@@ -1005,6 +1046,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Lead Time in days", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "lead_time_days", 
    "oldfieldtype": "Int", 
@@ -1030,6 +1072,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Buying Cost Center", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "cost_center", 
    "oldfieldtype": "Link", 
@@ -1056,6 +1099,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Expense Account", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "purchase_account", 
    "oldfieldtype": "Link", 
@@ -1081,6 +1125,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Unit of Measure Conversion", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1105,6 +1150,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "UOMs", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "uom_conversion_details", 
    "oldfieldtype": "Table", 
@@ -1130,6 +1176,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Last Purchase Rate", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "last_purchase_rate", 
    "oldfieldtype": "Currency", 
@@ -1154,6 +1201,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier Details", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1177,6 +1225,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Supplier", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Supplier", 
    "permlevel": 0, 
@@ -1199,6 +1248,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Delivered by Supplier (Drop Ship)", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1222,6 +1272,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Manufacturer", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1244,6 +1295,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Manufacturer Part Number", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1266,6 +1318,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Code for Suppliers", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -1290,6 +1343,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier Items", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Item Supplier", 
    "permlevel": 0, 
@@ -1312,6 +1366,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Details", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-tag", 
@@ -1337,6 +1392,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Is Sales Item", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_sales_item", 
    "oldfieldtype": "Select", 
@@ -1364,6 +1420,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Is Service Item", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_service_item", 
    "oldfieldtype": "Select", 
@@ -1390,6 +1447,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Publish in Hub", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1413,6 +1471,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Synced With Hub", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1436,6 +1495,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Income Account", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Account", 
    "permlevel": 0, 
@@ -1459,6 +1519,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Selling Cost Center", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Cost Center", 
    "permlevel": 0, 
@@ -1482,6 +1543,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Item Codes", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -1507,6 +1569,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Items", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Item Customer Detail", 
    "permlevel": 0, 
@@ -1530,6 +1593,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Max Discount (%)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "max_discount", 
    "oldfieldtype": "Currency", 
@@ -1553,6 +1617,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Tax", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-money", 
@@ -1577,6 +1642,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_tax", 
    "oldfieldtype": "Table", 
@@ -1601,6 +1667,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Inspection Criteria", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-search", 
@@ -1625,6 +1692,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Inspection Required", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "inspection_required", 
    "oldfieldtype": "Select", 
@@ -1651,6 +1719,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Quality Parameters", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_specification_details", 
    "oldfieldtype": "Table", 
@@ -1675,6 +1744,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Manufacturing", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-cogs", 
@@ -1701,6 +1771,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Allow Production Order", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_pro_applicable", 
    "oldfieldtype": "Select", 
@@ -1727,6 +1798,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supply Raw Materials for Purchase", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_sub_contracted_item", 
    "oldfieldtype": "Select", 
@@ -1750,6 +1822,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1773,6 +1846,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default BOM", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "default_bom", 
    "oldfieldtype": "Link", 
@@ -1797,6 +1871,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer Code", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -1818,6 +1893,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Website", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-globe", 
    "permlevel": 0, 
@@ -1840,6 +1916,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Show in Website", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1863,6 +1940,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Page Name", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1886,6 +1964,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Weightage", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1909,6 +1988,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Slideshow", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Website Slideshow", 
    "permlevel": 0, 
@@ -1933,6 +2013,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "", 
    "permlevel": 0, 
@@ -1955,6 +2036,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Thumbnail", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1976,6 +2058,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1999,6 +2082,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Website Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Warehouse", 
    "permlevel": 0, 
@@ -2023,6 +2107,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Website Item Groups", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Website Item Group", 
    "permlevel": 0, 
@@ -2047,6 +2132,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Website Specifications", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -2069,6 +2155,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Copy From Item Group", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -2091,6 +2178,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Website Specifications", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Item Website Specification", 
    "permlevel": 0, 
@@ -2114,6 +2202,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Website Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -2135,6 +2224,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Parent Website Route", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "", 
    "permlevel": 0, 
@@ -2157,7 +2247,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 1, 
- "modified": "2015-11-04 04:50:02.051468", 
+ "modified": "2015-11-16 06:29:47.912365", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item", 
diff --git a/erpnext/stock/doctype/item_attribute/item_attribute.json b/erpnext/stock/doctype/item_attribute/item_attribute.json
index 0440419..338a0bc 100644
--- a/erpnext/stock/doctype/item_attribute/item_attribute.json
+++ b/erpnext/stock/doctype/item_attribute/item_attribute.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Attribute Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Numeric Values", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -65,6 +67,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -88,6 +91,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "From Range", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -111,6 +115,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Increment", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -132,6 +137,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -155,6 +161,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "To Range", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -177,6 +184,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -200,6 +208,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Attribute Values", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Item Attribute Value", 
    "permlevel": 0, 
@@ -221,7 +230,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:52.797977", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:48.198647", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item Attribute", 
diff --git a/erpnext/stock/doctype/item_attribute_value/item_attribute_value.json b/erpnext/stock/doctype/item_attribute_value/item_attribute_value.json
index 4ace69d..9aaab18 100644
--- a/erpnext/stock/doctype/item_attribute_value/item_attribute_value.json
+++ b/erpnext/stock/doctype/item_attribute_value/item_attribute_value.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Attribute Value", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Abbreviation", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -63,7 +65,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:52.915941", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:48.249491", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item Attribute Value", 
diff --git a/erpnext/stock/doctype/item_customer_detail/item_customer_detail.json b/erpnext/stock/doctype/item_customer_detail/item_customer_detail.json
index b81e29c..4e9e042 100644
--- a/erpnext/stock/doctype/item_customer_detail/item_customer_detail.json
+++ b/erpnext/stock/doctype/item_customer_detail/item_customer_detail.json
@@ -20,6 +20,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Customer Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "price_list_name", 
    "oldfieldtype": "Select", 
@@ -46,6 +47,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Ref Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "ref_rate", 
    "oldfieldtype": "Currency", 
@@ -69,7 +71,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:52.972943", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:48.280253", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item Customer Detail", 
diff --git a/erpnext/stock/doctype/item_price/item_price.json b/erpnext/stock/doctype/item_price/item_price.json
index 53f06dc..0dcf264 100644
--- a/erpnext/stock/doctype/item_price/item_price.json
+++ b/erpnext/stock/doctype/item_price/item_price.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-tags", 
    "permlevel": 0, 
@@ -43,6 +44,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Price List", 
    "permlevel": 0, 
@@ -65,6 +67,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Buying", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -86,6 +89,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Selling", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -107,6 +111,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-tag", 
    "permlevel": 0, 
@@ -129,6 +134,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "price_list_name", 
    "oldfieldtype": "Select", 
@@ -153,6 +159,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "ref_rate", 
    "oldfieldtype": "Currency", 
@@ -177,6 +184,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Currency", 
    "permlevel": 0, 
@@ -198,6 +206,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -219,6 +228,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -240,6 +250,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -260,6 +271,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -282,6 +294,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Bulk Import Help", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -303,7 +316,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:53.239250", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:48.400288", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item Price", 
diff --git a/erpnext/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.json b/erpnext/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.json
index 74df6ea..044a0dd 100644
--- a/erpnext/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.json
+++ b/erpnext/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Parameter", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "specification", 
    "oldfieldtype": "Data", 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Acceptance Criteria", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "value", 
    "oldfieldtype": "Data", 
@@ -65,7 +67,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:53.360347", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:48.461235", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item Quality Inspection Parameter", 
diff --git a/erpnext/stock/doctype/item_reorder/item_reorder.json b/erpnext/stock/doctype/item_reorder/item_reorder.json
index db30b74..fea8bf0 100644
--- a/erpnext/stock/doctype/item_reorder/item_reorder.json
+++ b/erpnext/stock/doctype/item_reorder/item_reorder.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Warehouse", 
    "permlevel": 0, 
@@ -41,6 +42,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Re-order Level", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -62,6 +64,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Re-order Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -82,7 +85,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Material Request Type",  
+   "label": "Material Request Type", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Purchase\nTransfer", 
    "permlevel": 0, 
@@ -103,7 +107,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:53.419555", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:48.492627", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item Reorder", 
diff --git a/erpnext/stock/doctype/item_supplier/item_supplier.json b/erpnext/stock/doctype/item_supplier/item_supplier.json
index 3cd6349..5388481 100644
--- a/erpnext/stock/doctype/item_supplier/item_supplier.json
+++ b/erpnext/stock/doctype/item_supplier/item_supplier.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Supplier", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Supplier", 
    "permlevel": 0, 
@@ -40,6 +41,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Supplier Part Number", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -61,7 +63,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:53.505057", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:48.527271", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item Supplier", 
diff --git a/erpnext/stock/doctype/item_tax/item_tax.json b/erpnext/stock/doctype/item_tax/item_tax.json
index f78d41e..c199ec0 100644
--- a/erpnext/stock/doctype/item_tax/item_tax.json
+++ b/erpnext/stock/doctype/item_tax/item_tax.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Tax", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "tax_type", 
    "oldfieldtype": "Link", 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Tax Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "tax_rate", 
    "oldfieldtype": "Currency", 
@@ -63,7 +65,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:53.564643", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:48.557063", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item Tax", 
diff --git a/erpnext/stock/doctype/item_variant/item_variant.json b/erpnext/stock/doctype/item_variant/item_variant.json
index 10b93b5..e51635a 100644
--- a/erpnext/stock/doctype/item_variant/item_variant.json
+++ b/erpnext/stock/doctype/item_variant/item_variant.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Attribute", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Item Attribute", 
    "permlevel": 0, 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Attribute Value", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "", 
    "permlevel": 0, 
@@ -64,7 +66,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:53.623476", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:48.592686", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item Variant", 
diff --git a/erpnext/stock/doctype/item_variant_attribute/item_variant_attribute.json b/erpnext/stock/doctype/item_variant_attribute/item_variant_attribute.json
index 87899c8..740a514 100644
--- a/erpnext/stock/doctype/item_variant_attribute/item_variant_attribute.json
+++ b/erpnext/stock/doctype/item_variant_attribute/item_variant_attribute.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Attribute", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Item Attribute", 
    "permlevel": 0, 
@@ -42,6 +43,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -65,6 +67,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Attribute Value", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "", 
    "permlevel": 0, 
@@ -89,6 +92,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Numeric Values", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -111,6 +115,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -134,6 +139,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "From Range", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -157,6 +163,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Increment", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -178,6 +185,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -201,6 +209,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "To Range", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -221,7 +230,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:53.682190", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:48.641487", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item Variant Attribute", 
diff --git a/erpnext/stock/doctype/item_website_specification/item_website_specification.json b/erpnext/stock/doctype/item_website_specification/item_website_specification.json
index fdd5583..7fc83df 100644
--- a/erpnext/stock/doctype/item_website_specification/item_website_specification.json
+++ b/erpnext/stock/doctype/item_website_specification/item_website_specification.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Label", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -63,7 +65,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:53.782911", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:48.689782", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item Website Specification", 
diff --git a/erpnext/stock/doctype/landed_cost_item/landed_cost_item.json b/erpnext/stock/doctype/landed_cost_item/landed_cost_item.json
index 24a57f6..9c1a74f 100644
--- a/erpnext/stock/doctype/landed_cost_item/landed_cost_item.json
+++ b/erpnext/stock/doctype/landed_cost_item/landed_cost_item.json
@@ -1,227 +1,237 @@
 {
- "allow_copy": 0,
- "allow_import": 0,
- "allow_rename": 0,
- "creation": "2013-02-22 01:28:02",
- "custom": 0,
- "docstatus": 0,
- "doctype": "DocType",
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "creation": "2013-02-22 01:28:02", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
  "fields": [
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "item_code",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "Item Code",
-   "no_copy": 0,
-   "options": "Item",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "item_code", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Item Code", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Item", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "100px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "description",
-   "fieldtype": "Text Editor",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "Description",
-   "no_copy": 0,
-   "oldfieldname": "description",
-   "oldfieldtype": "Data",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_width": "300px",
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "description", 
+   "fieldtype": "Text Editor", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Description", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "description", 
+   "oldfieldtype": "Data", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_width": "300px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "120px"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "purchase_receipt",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Purchase Receipt",
-   "no_copy": 1,
-   "options": "Purchase Receipt",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "purchase_receipt", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Purchase Receipt", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Purchase Receipt", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "col_break2",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "col_break2", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "qty",
-   "fieldtype": "Float",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "Qty",
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "qty", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Qty", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "rate",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Rate",
-   "no_copy": 0,
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "rate", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Rate", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "amount",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "Amount",
-   "no_copy": 0,
-   "oldfieldname": "amount",
-   "oldfieldtype": "Currency",
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Amount", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "amount", 
+   "oldfieldtype": "Currency", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "applicable_charges",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "Applicable Charges",
-   "no_copy": 0,
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "applicable_charges", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Applicable Charges", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "purchase_receipt_item",
-   "fieldtype": "Data",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Purchase Receipt Item",
-   "no_copy": 1,
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "purchase_receipt_item", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Purchase Receipt Item", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
   }
- ],
- "hide_heading": 0,
- "hide_toolbar": 0,
- "idx": 1,
- "in_create": 0,
- "in_dialog": 0,
- "is_submittable": 0,
- "issingle": 0,
- "istable": 1,
- "modified": "2015-10-20 12:16:35.511560",
- "modified_by": "Administrator",
- "module": "Stock",
- "name": "Landed Cost Item",
- "owner": "wasim@webnotestech.com",
- "permissions": [],
- "read_only": 0,
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 1, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:49.057949", 
+ "modified_by": "Administrator", 
+ "module": "Stock", 
+ "name": "Landed Cost Item", 
+ "owner": "wasim@webnotestech.com", 
+ "permissions": [], 
+ "read_only": 0, 
  "read_only_onload": 0
-}
+}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.json b/erpnext/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.json
index 84e7045..165982f 100644
--- a/erpnext/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.json
+++ b/erpnext/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Purchase Receipt", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "purchase_receipt_no", 
    "oldfieldtype": "Link", 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Supplier", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Supplier", 
    "permlevel": 0, 
@@ -65,6 +67,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -87,6 +90,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Posting Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -108,6 +112,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Grand Total", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -127,7 +132,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:54.711750", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:49.106523", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Landed Cost Purchase Receipt", 
diff --git a/erpnext/stock/doctype/landed_cost_taxes_and_charges/landed_cost_taxes_and_charges.json b/erpnext/stock/doctype/landed_cost_taxes_and_charges/landed_cost_taxes_and_charges.json
index 2149802..28b6e02 100644
--- a/erpnext/stock/doctype/landed_cost_taxes_and_charges/landed_cost_taxes_and_charges.json
+++ b/erpnext/stock/doctype/landed_cost_taxes_and_charges/landed_cost_taxes_and_charges.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -39,6 +40,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -61,6 +63,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -80,7 +83,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:54.789411", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:49.144789", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Landed Cost Taxes and Charges", 
diff --git a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.json b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.json
index 3b84292..8f552bf 100644
--- a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.json
+++ b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Purchase Receipts", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Landed Cost Purchase Receipt", 
    "permlevel": 0, 
@@ -64,6 +66,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Get Items From Purchase Receipts", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -85,6 +88,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Purchase Receipt Items", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Landed Cost Item", 
    "permlevel": 0, 
@@ -107,6 +111,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Landed Cost Taxes and Charges", 
    "permlevel": 0, 
@@ -128,6 +133,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Simple", 
    "permlevel": 0, 
@@ -151,6 +157,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -173,6 +180,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Landed Cost Voucher", 
    "permlevel": 0, 
@@ -194,6 +202,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -216,7 +225,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Distribute Charges Based On",  
+   "label": "Distribute Charges Based On", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nQty\nAmount", 
    "permlevel": 0, 
@@ -239,6 +249,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -261,6 +272,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Landed Cost Help", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "", 
    "permlevel": 0, 
@@ -281,7 +293,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:54.866437", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:49.180775", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Landed Cost Voucher", 
diff --git a/erpnext/stock/doctype/material_request/material_request.json b/erpnext/stock/doctype/material_request/material_request.json
index 757d8a7..85eaafd 100644
--- a/erpnext/stock/doctype/material_request/material_request.json
+++ b/erpnext/stock/doctype/material_request/material_request.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-pushpin", 
    "permlevel": 0, 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Title", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -63,7 +65,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Type",  
+   "label": "Type", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Purchase\nMaterial Transfer\nMaterial Issue", 
    "permlevel": 0, 
@@ -85,6 +88,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -105,7 +109,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Series",  
+   "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "naming_series", 
    "oldfieldtype": "Select", 
@@ -130,6 +135,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Data", 
@@ -157,6 +163,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -183,6 +190,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-shopping-cart", 
@@ -206,6 +214,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Items", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "indent_details", 
    "oldfieldtype": "Table", 
@@ -230,6 +239,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "More Information", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-file-text", 
@@ -253,6 +263,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Requested For", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -274,6 +285,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Transaction Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "transaction_date", 
    "oldfieldtype": "Date", 
@@ -298,6 +310,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -321,7 +334,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "status", 
    "oldfieldtype": "Select", 
@@ -349,6 +363,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "% Ordered", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "per_ordered", 
    "oldfieldtype": "Currency", 
@@ -372,6 +387,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Printing Details", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -394,6 +410,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Letter Head", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "letter_head", 
    "oldfieldtype": "Select", 
@@ -418,6 +435,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Print Heading", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Print Heading", 
    "permlevel": 0, 
@@ -441,6 +459,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms and Conditions", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-legal", 
@@ -464,6 +483,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "tc_name", 
    "oldfieldtype": "Link", 
@@ -488,6 +508,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms and Conditions Content", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "terms", 
    "oldfieldtype": "Text Editor", 
@@ -510,7 +531,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:56.920451", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:50.143668", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Material Request", 
diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py
index e65cc4b..fd82784 100644
--- a/erpnext/stock/doctype/material_request/material_request.py
+++ b/erpnext/stock/doctype/material_request/material_request.py
@@ -40,13 +40,13 @@
 
 		for so_no in so_items.keys():
 			for item in so_items[so_no].keys():
-				already_indented = frappe.db.sql("""select sum(ifnull(qty, 0))
+				already_indented = frappe.db.sql("""select sum(qty)
 					from `tabMaterial Request Item`
 					where item_code = %s and sales_order_no = %s and
 					docstatus = 1 and parent != %s""", (item, so_no, self.name))
 				already_indented = already_indented and flt(already_indented[0][0]) or 0
 
-				actual_so_qty = frappe.db.sql("""select sum(ifnull(qty, 0)) from `tabSales Order Item`
+				actual_so_qty = frappe.db.sql("""select sum(qty) from `tabSales Order Item`
 					where parent = %s and item_code = %s and docstatus = 1""", (so_no, item))
 				actual_so_qty = actual_so_qty and flt(actual_so_qty[0][0]) or 0
 
@@ -250,7 +250,7 @@
 			where mr.name = mr_item.parent
 			and mr_item.item_code in (%s)
 			and mr.material_request_type = 'Purchase'
-			and ifnull(mr.per_ordered, 0) < 99.99
+			and mr.per_ordered < 99.99
 			and mr.docstatus = 1
 			and mr.status != 'Stopped'""" % ', '.join(['%s']*len(supplier_items)),
 			tuple(supplier_items))
diff --git a/erpnext/stock/doctype/material_request/test_material_request.py b/erpnext/stock/doctype/material_request/test_material_request.py
index 99815dd..5cd7de1 100644
--- a/erpnext/stock/doctype/material_request/test_material_request.py
+++ b/erpnext/stock/doctype/material_request/test_material_request.py
@@ -106,7 +106,7 @@
 		mr.submit()
 
 		# check if per complete is None
-		self.assertEquals(mr.per_ordered, None)
+		self.assertEquals(mr.per_ordered, 0)
 		self.assertEquals(mr.get("items")[0].ordered_qty, 0)
 		self.assertEquals(mr.get("items")[1].ordered_qty, 0)
 
@@ -152,9 +152,9 @@
 		po.cancel()
 		# check if per complete is as expected
 		mr.load_from_db()
-		self.assertEquals(mr.per_ordered, None)
-		self.assertEquals(mr.get("items")[0].ordered_qty, None)
-		self.assertEquals(mr.get("items")[1].ordered_qty, None)
+		self.assertEquals(mr.per_ordered, 0)
+		self.assertEquals(mr.get("items")[0].ordered_qty, 0)
+		self.assertEquals(mr.get("items")[1].ordered_qty, 0)
 
 		current_requested_qty_item1 = self._get_requested_qty("_Test Item Home Desktop 100", "_Test Warehouse - _TC")
 		current_requested_qty_item2 = self._get_requested_qty("_Test Item Home Desktop 200", "_Test Warehouse - _TC")
@@ -173,7 +173,7 @@
 		mr.submit()
 
 		# check if per complete is None
-		self.assertEquals(mr.per_ordered, None)
+		self.assertEquals(mr.per_ordered, 0)
 		self.assertEquals(mr.get("items")[0].ordered_qty, 0)
 		self.assertEquals(mr.get("items")[1].ordered_qty, 0)
 
@@ -262,7 +262,7 @@
 		mr.submit()
 
 		# check if per complete is None
-		self.assertEquals(mr.per_ordered, None)
+		self.assertEquals(mr.per_ordered, 0)
 		self.assertEquals(mr.get("items")[0].ordered_qty, 0)
 		self.assertEquals(mr.get("items")[1].ordered_qty, 0)
 
diff --git a/erpnext/stock/doctype/material_request_item/material_request_item.json b/erpnext/stock/doctype/material_request_item/material_request_item.json
index a90b35b..3e26065 100644
--- a/erpnext/stock/doctype/material_request_item/material_request_item.json
+++ b/erpnext/stock/doctype/material_request_item/material_request_item.json
@@ -19,6 +19,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -44,6 +45,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -65,6 +67,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_name", 
    "oldfieldtype": "Data", 
@@ -90,6 +93,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -112,6 +116,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Text", 
@@ -136,6 +141,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -158,6 +164,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -180,6 +187,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image View", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "image", 
    "permlevel": 0, 
@@ -203,6 +211,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Quantity and Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -224,6 +233,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Quantity", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "qty", 
    "oldfieldtype": "Currency", 
@@ -249,6 +259,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Stock UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "uom", 
    "oldfieldtype": "Link", 
@@ -275,6 +286,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "For Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "warehouse", 
    "oldfieldtype": "Link", 
@@ -300,6 +312,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -321,6 +334,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Required Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "schedule_date", 
    "oldfieldtype": "Date", 
@@ -346,6 +360,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "More Information", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -368,6 +383,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Item Group", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_group", 
    "oldfieldtype": "Link", 
@@ -392,6 +408,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Brand", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "brand", 
    "oldfieldtype": "Link", 
@@ -418,6 +435,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Lead Time Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "lead_time_date", 
    "oldfieldtype": "Date", 
@@ -441,6 +459,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Order No", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Sales Order", 
    "permlevel": 0, 
@@ -462,6 +481,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -483,6 +503,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Min Order Qty", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "min_order_qty", 
    "oldfieldtype": "Currency", 
@@ -508,6 +529,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Projected Qty", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "projected_qty", 
    "oldfieldtype": "Currency", 
@@ -533,6 +555,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Completed Qty", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "ordered_qty", 
    "oldfieldtype": "Currency", 
@@ -556,6 +579,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Page Break", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "page_break", 
    "oldfieldtype": "Check", 
@@ -577,7 +601,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-19 03:04:50.737233", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:50.238167", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Material Request Item", 
diff --git a/erpnext/stock/doctype/packed_item/packed_item.json b/erpnext/stock/doctype/packed_item/packed_item.json
index 88e11d7..b09765d 100644
--- a/erpnext/stock/doctype/packed_item/packed_item.json
+++ b/erpnext/stock/doctype/packed_item/packed_item.json
@@ -18,6 +18,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Parent Item", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "parent_item", 
    "oldfieldtype": "Link", 
@@ -42,6 +43,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -66,6 +68,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_name", 
    "oldfieldtype": "Data", 
@@ -88,6 +91,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -110,6 +114,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Text", 
@@ -134,6 +139,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -156,6 +162,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "From Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "warehouse", 
    "oldfieldtype": "Link", 
@@ -180,6 +187,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "To Warehouse (Optional)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Warehouse", 
    "permlevel": 0, 
@@ -202,6 +210,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -224,6 +233,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "qty", 
    "oldfieldtype": "Currency", 
@@ -246,6 +256,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -268,6 +279,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Serial No", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -288,6 +300,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -310,6 +323,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Batch No", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Batch", 
    "permlevel": 0, 
@@ -331,6 +345,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -353,6 +368,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Actual Qty", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "actual_qty", 
    "oldfieldtype": "Currency", 
@@ -376,6 +392,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Projected Qty", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "projected_qty", 
    "oldfieldtype": "Currency", 
@@ -398,6 +415,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -420,6 +438,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "uom", 
    "oldfieldtype": "Link", 
@@ -444,6 +463,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Page Break", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "page_break", 
    "oldfieldtype": "Check", 
@@ -467,6 +487,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Prevdoc DocType", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "prevdoc_doctype", 
    "oldfieldtype": "Data", 
@@ -490,6 +511,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Parent Detail docname", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "parent_detail_docname", 
    "oldfieldtype": "Data", 
@@ -511,7 +533,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-26 02:25:47.718911", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:51.130504", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Packed Item", 
diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.json b/erpnext/stock/doctype/packing_slip/packing_slip.json
index cacb036..5a59d94 100644
--- a/erpnext/stock/doctype/packing_slip/packing_slip.json
+++ b/erpnext/stock/doctype/packing_slip/packing_slip.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -41,6 +42,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -63,6 +65,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Delivery Note", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Delivery Note", 
    "permlevel": 0, 
@@ -84,6 +87,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -104,7 +108,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Series",  
+   "label": "Series", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "PS-", 
    "permlevel": 0, 
@@ -126,6 +131,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -146,6 +152,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -168,6 +175,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "From Package No.", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -189,6 +197,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -211,6 +220,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "To Package No.", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -233,6 +243,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -254,6 +265,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Get Items", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -275,6 +287,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Items", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Packing Slip Item", 
    "permlevel": 0, 
@@ -297,6 +310,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Package Weight Details", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -319,6 +333,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Weight", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -340,6 +355,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Weight UOM", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "UOM", 
    "permlevel": 0, 
@@ -361,6 +377,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -383,6 +400,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Gross Weight", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -404,6 +422,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Gross Weight UOM", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "UOM", 
    "permlevel": 0, 
@@ -426,6 +445,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Letter Head", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -448,6 +468,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Letter Head", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Letter Head", 
    "permlevel": 0, 
@@ -471,6 +492,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -492,6 +514,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Packing Slip", 
    "permlevel": 0, 
@@ -513,7 +536,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:59.079733", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:51.222925", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Packing Slip", 
diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.py b/erpnext/stock/doctype/packing_slip/packing_slip.py
index 70e143e..6a7b559 100644
--- a/erpnext/stock/doctype/packing_slip/packing_slip.py
+++ b/erpnext/stock/doctype/packing_slip/packing_slip.py
@@ -91,8 +91,8 @@
 			condition = " and item_code in (%s)" % (", ".join(["%s"]*len(rows)))
 
 		# gets item code, qty per item code, latest packed qty per item code and stock uom
-		res = frappe.db.sql("""select item_code, ifnull(sum(qty), 0) as qty,
-			(select sum(ifnull(psi.qty, 0) * (abs(ps.to_case_no - ps.from_case_no) + 1))
+		res = frappe.db.sql("""select item_code, sum(qty) as qty,
+			(select sum(psi.qty * (abs(ps.to_case_no - ps.from_case_no) + 1))
 				from `tabPacking Slip` ps, `tabPacking Slip Item` psi
 				where ps.name = psi.parent and ps.docstatus = 1
 				and ps.delivery_note = dni.parent and psi.item_code=dni.item_code) as packed_qty,
diff --git a/erpnext/stock/doctype/packing_slip_item/packing_slip_item.json b/erpnext/stock/doctype/packing_slip_item/packing_slip_item.json
index 57aa2a4..be92998 100644
--- a/erpnext/stock/doctype/packing_slip_item/packing_slip_item.json
+++ b/erpnext/stock/doctype/packing_slip_item/packing_slip_item.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Item", 
    "permlevel": 0, 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -66,6 +68,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Batch No", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Batch", 
    "permlevel": 0, 
@@ -89,6 +92,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -111,6 +115,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Quantity", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -134,6 +139,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "UOM", 
    "permlevel": 0, 
@@ -158,6 +164,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Net Weight", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -181,6 +188,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Weight UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "UOM", 
    "permlevel": 0, 
@@ -205,6 +213,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Page Break", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -226,6 +235,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "DN Detail", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -245,7 +255,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:59.283902", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:51.313759", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Packing Slip Item", 
diff --git a/erpnext/stock/doctype/price_list/price_list.json b/erpnext/stock/doctype/price_list/price_list.json
index f2e45a8..cc323fa 100644
--- a/erpnext/stock/doctype/price_list/price_list.json
+++ b/erpnext/stock/doctype/price_list/price_list.json
@@ -22,6 +22,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Enabled", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -42,6 +43,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -63,6 +65,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Name", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "price_list_name", 
    "oldfieldtype": "Data", 
@@ -86,6 +89,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Currency", 
    "permlevel": 0, 
@@ -108,6 +112,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Buying", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -129,6 +134,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Selling", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -149,6 +155,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -170,6 +177,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Applicable for Countries", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Price List Country", 
    "permlevel": 0, 
@@ -193,7 +201,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 1, 
- "modified": "2015-10-02 07:39:00.425037", 
+ "modified": "2015-11-16 06:29:51.852676", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Price List", 
diff --git a/erpnext/stock/doctype/price_list_country/price_list_country.json b/erpnext/stock/doctype/price_list_country/price_list_country.json
index 47d2b44..ef13baf 100644
--- a/erpnext/stock/doctype/price_list_country/price_list_country.json
+++ b/erpnext/stock/doctype/price_list_country/price_list_country.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Country", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Country", 
    "permlevel": 0, 
@@ -39,7 +40,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:00.549005", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:51.913575", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Price List Country", 
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
index adb2761..fc6dfc4 100755
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-user", 
    "permlevel": 0, 
@@ -41,6 +42,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -66,6 +68,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Title", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -89,6 +92,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "naming_series", 
    "oldfieldtype": "Select", 
@@ -113,6 +117,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Supplier", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "supplier", 
    "oldfieldtype": "Link", 
@@ -140,6 +145,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -161,6 +167,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -182,6 +189,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -203,6 +211,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Mobile No", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -224,6 +233,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Email", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -244,6 +254,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -268,6 +279,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "posting_date", 
    "oldfieldtype": "Date", 
@@ -294,6 +306,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Posting Time", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "posting_time", 
    "oldfieldtype": "Time", 
@@ -319,6 +332,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Return", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -342,6 +356,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Return Against Purchase Receipt", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Purchase Receipt", 
    "permlevel": 0, 
@@ -365,6 +380,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Currency and Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-tag", 
    "permlevel": 0, 
@@ -387,6 +403,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "currency", 
    "oldfieldtype": "Select", 
@@ -412,6 +429,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Exchange Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "conversion_rate", 
    "oldfieldtype": "Currency", 
@@ -435,6 +453,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -459,6 +478,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Price List", 
    "permlevel": 0, 
@@ -482,6 +502,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Currency", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Currency", 
    "permlevel": 0, 
@@ -505,6 +526,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Exchange Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "9", 
@@ -527,6 +549,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Ignore Pricing Rule", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 1, 
    "print_hide": 1, 
@@ -548,6 +571,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-shopping-cart", 
@@ -571,6 +595,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Items", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "purchase_receipt_details", 
    "oldfieldtype": "Table", 
@@ -595,6 +620,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Get Current Stock", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Button", 
    "options": "get_current_stock", 
@@ -617,6 +643,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -639,6 +666,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -662,6 +690,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "net_total", 
    "oldfieldtype": "Currency", 
@@ -687,6 +716,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -708,6 +738,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -731,6 +762,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Total", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "net_total_import", 
    "oldfieldtype": "Currency", 
@@ -756,6 +788,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-money", 
@@ -780,6 +813,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "purchase_other_charges", 
    "oldfieldtype": "Link", 
@@ -804,6 +838,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Purchase Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "purchase_tax_details", 
    "oldfieldtype": "Table", 
@@ -828,6 +863,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges Calculation", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "HTML", 
    "permlevel": 0, 
@@ -851,6 +887,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-money", 
@@ -874,6 +911,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges Added (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges_added", 
    "oldfieldtype": "Currency", 
@@ -898,6 +936,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges Deducted (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges_deducted", 
    "oldfieldtype": "Currency", 
@@ -922,6 +961,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Taxes and Charges (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "total_tax", 
    "oldfieldtype": "Currency", 
@@ -945,6 +985,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -968,6 +1009,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges Added", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges_added_import", 
    "oldfieldtype": "Currency", 
@@ -992,6 +1034,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Taxes and Charges Deducted", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "other_charges_deducted_import", 
    "oldfieldtype": "Currency", 
@@ -1016,6 +1059,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Taxes and Charges", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -1040,6 +1084,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1063,6 +1108,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Apply Additional Discount On", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nGrand Total\nNet Total", 
    "permlevel": 0, 
@@ -1085,6 +1131,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1107,6 +1154,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -1130,6 +1178,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Discount Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -1152,6 +1201,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1174,6 +1224,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Grand Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "grand_total", 
    "oldfieldtype": "Currency", 
@@ -1199,6 +1250,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "In Words (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "in_words", 
    "oldfieldtype": "Data", 
@@ -1222,6 +1274,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rounded Total (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "rounded_total", 
    "oldfieldtype": "Currency", 
@@ -1245,6 +1298,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1267,6 +1321,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Grand Total", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "grand_total_import", 
    "oldfieldtype": "Currency", 
@@ -1291,6 +1346,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "In Words", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "in_words_import", 
    "oldfieldtype": "Data", 
@@ -1315,6 +1371,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms and Conditions", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-legal", 
@@ -1338,6 +1395,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "tc_name", 
    "oldfieldtype": "Link", 
@@ -1362,6 +1420,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Terms and Conditions", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "terms", 
    "oldfieldtype": "Text Editor", 
@@ -1386,6 +1445,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Details", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-bullhorn", 
    "permlevel": 0, 
@@ -1408,6 +1468,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier Address", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Address", 
    "permlevel": 0, 
@@ -1429,6 +1490,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1450,6 +1512,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Person", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Contact", 
    "permlevel": 0, 
@@ -1474,6 +1537,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Raw Materials Supplied", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-table", 
@@ -1499,6 +1563,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Raw Materials Supplied", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_subcontracted", 
    "oldfieldtype": "Select", 
@@ -1524,6 +1589,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier Warehouse", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "supplier_warehouse", 
    "oldfieldtype": "Link", 
@@ -1550,6 +1616,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplied Items", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "pr_raw_material_details", 
    "oldfieldtype": "Table", 
@@ -1574,6 +1641,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Bill No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "bill_no", 
    "oldfieldtype": "Data", 
@@ -1597,6 +1665,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Bill Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "bill_date", 
    "oldfieldtype": "Date", 
@@ -1620,6 +1689,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "More Information", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-file-text", 
@@ -1644,6 +1714,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "status", 
    "oldfieldtype": "Select", 
@@ -1671,6 +1742,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rejected Warehouse", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "rejected_warehouse", 
    "oldfieldtype": "Link", 
@@ -1695,6 +1767,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Data", 
@@ -1721,6 +1794,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Range", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "range", 
    "oldfieldtype": "Data", 
@@ -1743,6 +1817,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -1768,6 +1843,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -1794,6 +1870,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -1820,6 +1897,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Printing Settings", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1842,6 +1920,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Letter Head", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Letter Head", 
    "permlevel": 0, 
@@ -1864,6 +1943,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Print Heading", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "select_print_heading", 
    "oldfieldtype": "Link", 
@@ -1888,6 +1968,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Other Details", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "HTML", 
    "options": "<div class='columnHeading'>Other Details</div>", 
@@ -1913,6 +1994,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Instructions", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "instructions", 
    "oldfieldtype": "Text", 
@@ -1936,6 +2018,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Remarks", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -1958,6 +2041,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Transporter Details", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-truck", 
    "permlevel": 0, 
@@ -1980,6 +2064,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Transporter Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "transporter_name", 
    "oldfieldtype": "Data", 
@@ -2002,6 +2087,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -2026,6 +2112,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Vehicle Number", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "lr_no", 
    "oldfieldtype": "Data", 
@@ -2052,6 +2139,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Vehicle Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "lr_date", 
    "oldfieldtype": "Date", 
@@ -2076,7 +2164,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-11-02 01:19:45.539793", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:54.102760", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Purchase Receipt", 
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index edd7be8..a640e6e 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -47,7 +47,7 @@
 		}]
 
 	def onload(self):
-		billed_qty = frappe.db.sql("""select sum(ifnull(qty, 0)) from `tabPurchase Invoice Item`
+		billed_qty = frappe.db.sql("""select sum(qty) from `tabPurchase Invoice Item`
 			where purchase_receipt=%s and docstatus=1""", self.name)
 		if billed_qty:
 			total_qty = sum((item.qty for item in self.get("items")))
@@ -82,7 +82,7 @@
 
 	def set_landed_cost_voucher_amount(self):
 		for d in self.get("items"):
-			lc_voucher_amount = frappe.db.sql("""select sum(ifnull(applicable_charges, 0))
+			lc_voucher_amount = frappe.db.sql("""select sum(applicable_charges)
 				from `tabLanded Cost Item`
 				where docstatus = 1 and purchase_receipt_item = %s""", d.name)
 			d.landed_cost_voucher_amount = lc_voucher_amount[0][0] if lc_voucher_amount else 0.0
diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
index 4d7ecbd..0789071 100755
--- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
+++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Barcode", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -40,6 +41,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -62,6 +64,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -87,6 +90,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -109,6 +113,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_name", 
    "oldfieldtype": "Data", 
@@ -132,6 +137,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -154,6 +160,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Text", 
@@ -178,6 +185,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -199,6 +207,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -221,6 +230,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image View", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "image", 
    "permlevel": 0, 
@@ -244,6 +254,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Received and Accepted", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -265,6 +276,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Recd Quantity", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "received_qty", 
    "oldfieldtype": "Currency", 
@@ -290,6 +302,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Accepted Quantity", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "qty", 
    "oldfieldtype": "Currency", 
@@ -315,6 +328,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rejected Quantity", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "rejected_qty", 
    "oldfieldtype": "Currency", 
@@ -339,6 +353,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -360,6 +375,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "uom", 
    "oldfieldtype": "Link", 
@@ -386,6 +402,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Stock UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "stock_uom", 
    "oldfieldtype": "Data", 
@@ -412,6 +429,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Conversion Factor", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "conversion_factor", 
    "oldfieldtype": "Currency", 
@@ -437,6 +455,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rate and Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -458,6 +477,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -481,6 +501,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Discount on Price List Rate (%)", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -501,6 +522,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -522,6 +544,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Rate (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -543,6 +566,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -564,6 +588,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "import_rate", 
    "oldfieldtype": "Currency", 
@@ -590,6 +615,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "import_amount", 
    "oldfieldtype": "Currency", 
@@ -613,6 +639,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -634,6 +661,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rate (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "purchase_rate", 
    "oldfieldtype": "Currency", 
@@ -660,6 +688,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "amount", 
    "oldfieldtype": "Currency", 
@@ -686,6 +715,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Pricing Rule", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Pricing Rule", 
    "permlevel": 0, 
@@ -707,6 +737,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -729,6 +760,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -752,6 +784,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "currency", 
    "permlevel": 0, 
@@ -774,6 +807,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -796,6 +830,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Rate (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -819,6 +854,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Amount (Company Currency)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -842,6 +878,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Warehouse and Reference", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -863,6 +900,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Accepted Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "warehouse", 
    "oldfieldtype": "Link", 
@@ -889,6 +927,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rejected Warehouse", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "rejected_warehouse", 
    "oldfieldtype": "Link", 
@@ -915,6 +954,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Project Name", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Project", 
    "permlevel": 0, 
@@ -939,6 +979,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Cost Center", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Cost Center", 
    "permlevel": 0, 
@@ -961,6 +1002,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Quality Inspection", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "qa_no", 
    "oldfieldtype": "Link", 
@@ -985,6 +1027,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Required By", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "schedule_date", 
    "oldfieldtype": "Date", 
@@ -1008,6 +1051,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Qty as per Stock UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "stock_qty", 
    "oldfieldtype": "Currency", 
@@ -1033,6 +1077,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Prevdoc Doctype", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "prevdoc_doctype", 
    "oldfieldtype": "Data", 
@@ -1056,6 +1101,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Purchase Order", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "prevdoc_docname", 
    "oldfieldtype": "Link", 
@@ -1082,6 +1128,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Purchase Order Item No", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "prevdoc_detail_docname", 
    "oldfieldtype": "Data", 
@@ -1106,6 +1153,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1127,6 +1175,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "BOM", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "BOM", 
    "permlevel": 0, 
@@ -1150,6 +1199,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Serial No", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "serial_no", 
    "oldfieldtype": "Text", 
@@ -1173,6 +1223,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rejected Serial No", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -1194,6 +1245,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Batch No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "batch_no", 
    "oldfieldtype": "Link", 
@@ -1218,6 +1270,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Brand", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "brand", 
    "oldfieldtype": "Link", 
@@ -1243,6 +1296,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Item Group", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_group", 
    "oldfieldtype": "Link", 
@@ -1267,6 +1321,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Raw Materials Supplied Cost", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "rm_supp_cost", 
    "oldfieldtype": "Currency", 
@@ -1293,6 +1348,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Tax Amount", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "item_tax_amount", 
    "oldfieldtype": "Currency", 
@@ -1319,6 +1375,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Landed Cost Voucher Amount", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -1340,6 +1397,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Valuation Rate", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "valuation_rate", 
    "oldfieldtype": "Currency", 
@@ -1367,6 +1425,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Tax Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_tax_rate", 
    "oldfieldtype": "Small Text", 
@@ -1390,6 +1449,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Page Break", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "page_break", 
    "oldfieldtype": "Check", 
@@ -1411,7 +1471,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-19 03:04:50.503105", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:54.377742", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Purchase Receipt Item", 
diff --git a/erpnext/stock/doctype/serial_no/serial_no.json b/erpnext/stock/doctype/serial_no/serial_no.json
index 97a634e..c177325 100644
--- a/erpnext/stock/doctype/serial_no/serial_no.json
+++ b/erpnext/stock/doctype/serial_no/serial_no.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -42,6 +43,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -63,6 +65,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Serial No", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "serial_no", 
    "oldfieldtype": "Data", 
@@ -86,6 +89,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -111,6 +115,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Warehouse", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "warehouse", 
    "oldfieldtype": "Link", 
@@ -134,6 +139,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -155,6 +161,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -176,6 +183,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Text", 
@@ -201,6 +209,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Group", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_group", 
    "oldfieldtype": "Link", 
@@ -225,6 +234,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Brand", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "brand", 
    "oldfieldtype": "Link", 
@@ -249,6 +259,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Purchase / Manufacture Details", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -269,6 +280,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -291,6 +303,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Creation Document Type", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "DocType", 
    "permlevel": 0, 
@@ -313,6 +326,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Creation Document No", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "purchase_document_type", 
    "permlevel": 0, 
@@ -335,6 +349,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Creation Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "purchase_date", 
    "oldfieldtype": "Date", 
@@ -358,6 +373,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Creation Time", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -379,6 +395,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Incoming Rate", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "purchase_rate", 
    "oldfieldtype": "Currency", 
@@ -402,6 +419,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -424,6 +442,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Supplier", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Supplier", 
    "permlevel": 0, 
@@ -446,6 +465,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Supplier Name", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -467,6 +487,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Delivery Details", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -488,7 +509,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
-   "label": "Delivery Document Type",  
+   "label": "Delivery Document Type", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "\nDelivery Note\nSales Invoice\nStock Entry\nPurchase Receipt", 
    "permlevel": 0, 
@@ -511,6 +533,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Delivery Document No", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -532,6 +555,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Delivery Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "delivery_date", 
    "oldfieldtype": "Date", 
@@ -555,6 +579,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Delivery Time", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -575,7 +600,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Is Cancelled",  
+   "label": "Is Cancelled", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_cancelled", 
    "oldfieldtype": "Select", 
@@ -599,6 +625,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -621,6 +648,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "customer", 
    "oldfieldtype": "Link", 
@@ -645,6 +673,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer Name", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "customer_name", 
    "oldfieldtype": "Data", 
@@ -668,6 +697,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Warranty / AMC Details", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -688,6 +718,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -709,7 +740,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
-   "label": "Maintenance Status",  
+   "label": "Maintenance Status", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "maintenance_status", 
    "oldfieldtype": "Select", 
@@ -735,6 +767,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Warranty Period (Days)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "warranty_period", 
    "oldfieldtype": "Int", 
@@ -758,6 +791,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -780,6 +814,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Warranty Expiry Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "warranty_expiry_date", 
    "oldfieldtype": "Date", 
@@ -804,6 +839,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "AMC Expiry Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "amc_expiry_date", 
    "oldfieldtype": "Date", 
@@ -828,6 +864,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "More Information", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -849,6 +886,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Serial No Details", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -870,6 +908,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -891,7 +930,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-12 07:39:12.447732", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:57.486475", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Serial No", 
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json
index f1961ce..ac60b77 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.json
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Title", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
@@ -63,7 +65,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Series",  
+   "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "naming_series", 
    "oldfieldtype": "Select", 
@@ -88,7 +91,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
-   "label": "Purpose",  
+   "label": "Purpose", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "purpose", 
    "oldfieldtype": "Select", 
@@ -114,6 +118,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Production Order", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "production_order", 
    "oldfieldtype": "Link", 
@@ -139,6 +144,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Purchase Order", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Purchase Order", 
    "permlevel": 0, 
@@ -163,6 +169,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Delivery Note No", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "delivery_note_no", 
    "oldfieldtype": "Link", 
@@ -188,6 +195,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Invoice No", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Sales Invoice", 
    "permlevel": 0, 
@@ -211,6 +219,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Purchase Receipt No", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "purchase_receipt_no", 
    "oldfieldtype": "Link", 
@@ -236,6 +245,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "From BOM", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -257,6 +267,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -282,6 +293,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Posting Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "posting_date", 
    "oldfieldtype": "Date", 
@@ -305,6 +317,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Posting Time", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "posting_time", 
    "oldfieldtype": "Time", 
@@ -329,6 +342,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -351,6 +365,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "BOM No", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "BOM", 
    "permlevel": 0, 
@@ -375,6 +390,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "For Quantity", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fg_completed_qty", 
    "oldfieldtype": "Currency", 
@@ -397,6 +413,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -421,6 +438,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Use Multi-Level BOM", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -443,6 +461,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Get Items", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Button", 
    "permlevel": 0, 
@@ -464,6 +483,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -486,6 +506,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Default Source Warehouse", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "from_warehouse", 
    "oldfieldtype": "Link", 
@@ -509,6 +530,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -530,6 +552,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Default Target Warehouse", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "to_warehouse", 
    "oldfieldtype": "Link", 
@@ -553,6 +576,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Simple", 
    "permlevel": 0, 
@@ -575,6 +599,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Items", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "mtn_details", 
    "oldfieldtype": "Table", 
@@ -600,6 +625,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Update Rate and Availability", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Button", 
    "options": "get_stock_and_rate", 
@@ -622,6 +648,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -644,6 +671,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Incoming Value", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -666,6 +694,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -688,6 +717,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Outgoing Value", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -711,6 +741,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Value Difference (Out - In)", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -735,6 +766,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Difference Account", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Account", 
    "permlevel": 0, 
@@ -759,6 +791,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Costs", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -781,6 +814,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Costs", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Landed Cost Taxes and Charges", 
    "permlevel": 0, 
@@ -804,6 +838,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Additional Costs", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -828,6 +863,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer or Supplier Details", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -850,6 +886,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "supplier", 
    "oldfieldtype": "Link", 
@@ -875,6 +912,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier Name", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "supplier_name", 
    "oldfieldtype": "Data", 
@@ -899,6 +937,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier Address", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "supplier_address", 
    "oldfieldtype": "Small Text", 
@@ -921,6 +960,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -944,6 +984,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "customer", 
    "oldfieldtype": "Link", 
@@ -969,6 +1010,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Name", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "customer_name", 
    "oldfieldtype": "Data", 
@@ -993,6 +1035,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Address", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "customer_address", 
    "oldfieldtype": "Small Text", 
@@ -1016,6 +1059,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Printing Settings", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -1038,6 +1082,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Print Heading", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "select_print_heading", 
    "oldfieldtype": "Link", 
@@ -1062,6 +1107,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Letter Head", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Letter Head", 
    "permlevel": 0, 
@@ -1085,6 +1131,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "More Information", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -1107,6 +1154,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Project Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "project_name", 
    "oldfieldtype": "Link", 
@@ -1131,6 +1179,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Remarks", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "remarks", 
    "oldfieldtype": "Text", 
@@ -1153,6 +1202,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -1176,6 +1226,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -1198,6 +1249,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -1222,6 +1274,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Fiscal Year", 
    "permlevel": 0, 
@@ -1244,6 +1297,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Link", 
@@ -1268,6 +1322,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Credit Note", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Journal Entry", 
    "permlevel": 0, 
@@ -1291,7 +1346,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2015-10-12 08:27:59.381894", 
+ "modified": "2015-11-16 06:29:57.928437", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Stock Entry", 
diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
index 7db21d6..dd680f3 100644
--- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
+++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Barcode", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -40,6 +41,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -62,6 +64,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Source Warehouse", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "s_warehouse", 
    "oldfieldtype": "Link", 
@@ -85,6 +88,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -106,6 +110,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Target Warehouse", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "t_warehouse", 
    "oldfieldtype": "Link", 
@@ -129,6 +134,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -150,6 +156,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -173,6 +180,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -194,6 +202,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -215,6 +224,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -237,6 +247,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Text", 
@@ -261,6 +272,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -283,6 +295,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -305,6 +318,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image View", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "image", 
    "permlevel": 0, 
@@ -328,6 +342,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Quantity and Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -349,6 +364,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "qty", 
    "oldfieldtype": "Currency", 
@@ -372,6 +388,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Basic Rate (as per Stock UOM)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "incoming_rate", 
    "oldfieldtype": "Currency", 
@@ -396,6 +413,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Basic Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -419,6 +437,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Additional Cost", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -442,6 +461,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "amount", 
    "oldfieldtype": "Currency", 
@@ -466,6 +486,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Valuation Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -488,6 +509,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -509,6 +531,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "uom", 
    "oldfieldtype": "Link", 
@@ -533,6 +556,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Conversion Factor", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "conversion_factor", 
    "oldfieldtype": "Currency", 
@@ -556,6 +580,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Stock UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "stock_uom", 
    "oldfieldtype": "Link", 
@@ -580,6 +605,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Qty as per Stock UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "transfer_qty", 
    "oldfieldtype": "Currency", 
@@ -603,6 +629,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Serial No / Batch", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -624,6 +651,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Serial No", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "serial_no", 
    "oldfieldtype": "Text", 
@@ -646,6 +674,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -667,6 +696,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Batch No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "batch_no", 
    "oldfieldtype": "Link", 
@@ -691,6 +721,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Accounting", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -713,6 +744,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Difference Account", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Account", 
    "permlevel": 0, 
@@ -734,6 +766,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -757,6 +790,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Cost Center", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Cost Center", 
    "permlevel": 0, 
@@ -779,6 +813,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "More Information", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -800,6 +835,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Actual Qty (at source/target)", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "actual_qty", 
    "oldfieldtype": "Read Only", 
@@ -824,6 +860,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "BOM No", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "BOM", 
    "permlevel": 0, 
@@ -845,6 +882,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -867,6 +905,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Material Request", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Material Request", 
    "permlevel": 0, 
@@ -889,6 +928,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Material Request Item", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Material Request Item", 
    "permlevel": 0, 
@@ -909,7 +949,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-19 03:04:50.303251", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:58.140173", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Stock Entry Detail", 
diff --git a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.json b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.json
index 7feda6f..180f114 100644
--- a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.json
+++ b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.json
@@ -20,6 +20,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -46,6 +47,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Serial No", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -69,6 +71,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Batch No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "batch_no", 
    "oldfieldtype": "Data", 
@@ -92,6 +95,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "warehouse", 
    "oldfieldtype": "Link", 
@@ -118,6 +122,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Posting Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "posting_date", 
    "oldfieldtype": "Date", 
@@ -143,6 +148,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Posting Time", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "posting_time", 
    "oldfieldtype": "Time", 
@@ -168,6 +174,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Voucher Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "voucher_type", 
    "oldfieldtype": "Data", 
@@ -194,6 +201,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Voucher No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "voucher_no", 
    "oldfieldtype": "Data", 
@@ -220,6 +228,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Voucher Detail No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "voucher_detail_no", 
    "oldfieldtype": "Data", 
@@ -245,6 +254,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Actual Quantity", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "actual_qty", 
    "oldfieldtype": "Currency", 
@@ -270,6 +280,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Incoming Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "incoming_rate", 
    "oldfieldtype": "Currency", 
@@ -294,6 +305,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Outgoing Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -317,6 +329,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Stock UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "stock_uom", 
    "oldfieldtype": "Data", 
@@ -343,6 +356,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Actual Qty After Transaction", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "bin_aqat", 
    "oldfieldtype": "Currency", 
@@ -368,6 +382,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Valuation Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "valuation_rate", 
    "oldfieldtype": "Currency", 
@@ -394,6 +409,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Stock Value", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "stock_value", 
    "oldfieldtype": "Currency", 
@@ -418,6 +434,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Stock Value Difference", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
@@ -440,6 +457,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Stock Queue (FIFO)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fcfs_stack", 
    "oldfieldtype": "Text", 
@@ -463,6 +481,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Project", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Project", 
    "permlevel": 0, 
@@ -485,6 +504,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Data", 
@@ -511,6 +531,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Data", 
@@ -535,7 +556,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Is Cancelled",  
+   "label": "Is Cancelled", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nNo\nYes", 
    "permlevel": 0, 
@@ -557,7 +579,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:14.297832", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:58.277731", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Stock Ledger Entry", 
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.json b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.json
index 1bb606c..e38af5f 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.json
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.json
@@ -21,6 +21,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Posting Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "reconciliation_date", 
    "oldfieldtype": "Date", 
@@ -44,6 +45,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Posting Time", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "reconciliation_time", 
    "oldfieldtype": "Time", 
@@ -66,6 +68,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -87,6 +90,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Stock Reconciliation", 
    "permlevel": 0, 
@@ -109,6 +113,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -130,6 +135,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -152,6 +158,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Items", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Stock Reconciliation Item", 
    "permlevel": 0, 
@@ -175,6 +182,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Get Items", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -196,6 +204,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -219,6 +228,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Difference Account", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Account", 
    "permlevel": 0, 
@@ -242,6 +252,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Cost Center", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Cost Center", 
    "permlevel": 0, 
@@ -264,6 +275,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reconciliation JSON", 
+   "length": 0, 
    "no_copy": 1, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -284,6 +296,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -306,6 +319,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Difference Amount", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -327,6 +341,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -348,6 +363,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -370,6 +386,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Fiscal Year", 
    "permlevel": 0, 
@@ -392,7 +409,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 1, 
- "modified": "2015-10-02 07:39:14.503333", 
+ "modified": "2015-11-16 06:29:58.376911", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Stock Reconciliation", 
diff --git a/erpnext/stock/doctype/stock_reconciliation_item/stock_reconciliation_item.json b/erpnext/stock/doctype/stock_reconciliation_item/stock_reconciliation_item.json
index 3274994..4f761f1 100644
--- a/erpnext/stock/doctype/stock_reconciliation_item/stock_reconciliation_item.json
+++ b/erpnext/stock/doctype/stock_reconciliation_item/stock_reconciliation_item.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Item", 
    "permlevel": 0, 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Warehouse", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Warehouse", 
    "permlevel": 0, 
@@ -64,6 +66,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -87,6 +90,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Quantity", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -110,6 +114,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Valuation Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -131,6 +136,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -154,6 +160,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Current Qty", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -177,6 +184,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Current Valuation Rate", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -196,7 +204,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:14.655703", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:58.445507", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Stock Reconciliation Item", 
diff --git a/erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.json b/erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.json
index 4f8ea41..97d4128 100644
--- a/erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.json
+++ b/erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "UOM", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "uom", 
    "oldfieldtype": "Link", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Conversion Factor", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "conversion_factor", 
    "oldfieldtype": "Float", 
@@ -64,7 +66,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:39:17.637451", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:59.778053", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "UOM Conversion Detail", 
diff --git a/erpnext/stock/doctype/warehouse/warehouse.json b/erpnext/stock/doctype/warehouse/warehouse.json
index 68eca34..e2867eb 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.json
+++ b/erpnext/stock/doctype/warehouse/warehouse.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Warehouse Detail", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Warehouse Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "warehouse_name", 
    "oldfieldtype": "Data", 
@@ -65,6 +67,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -91,6 +94,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Parent Account", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Account", 
    "permlevel": 0, 
@@ -113,6 +117,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Disabled", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -135,6 +140,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Warehouse Contact Info", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -156,6 +162,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Email Id", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "email_id", 
    "oldfieldtype": "Data", 
@@ -179,6 +186,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Phone No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "phone_no", 
    "oldfieldtype": "Int", 
@@ -203,6 +211,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Mobile No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "mobile_no", 
    "oldfieldtype": "Int", 
@@ -226,6 +235,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -248,6 +258,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address Line 1", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "address_line_1", 
    "oldfieldtype": "Data", 
@@ -271,6 +282,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address Line 2", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "address_line_2", 
    "oldfieldtype": "Data", 
@@ -294,6 +306,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "City", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "city", 
    "oldfieldtype": "Data", 
@@ -317,6 +330,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "State", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "state", 
    "oldfieldtype": "Select", 
@@ -340,6 +354,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "PIN", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "pin", 
    "oldfieldtype": "Int", 
@@ -362,7 +377,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:18.315595", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:30:00.080548", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Warehouse", 
diff --git a/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py b/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py
index 1fb1cc1..eb202b1 100644
--- a/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py
+++ b/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py
@@ -72,7 +72,7 @@
 	si_items = frappe.db.sql("""select si_item.item_name, sum(si_item.qty) as si_qty
 		from `tabSales Invoice` si, `tabSales Invoice Item` si_item
 		where si.name = si_item.parent and si.docstatus = 1 and
-		ifnull(si.update_stock, 0) = 1 and ifnull(si.is_pos, 0) = 1 %s
+		si.update_stock = 1 and si.is_pos = 1 %s
 		group by si_item.item_name""" % (condition), as_dict=1)
 
 	dn_item_map = {}
diff --git a/erpnext/stock/stock_balance.py b/erpnext/stock/stock_balance.py
index 609c986..b9e3cd2 100644
--- a/erpnext/stock/stock_balance.py
+++ b/erpnext/stock/stock_balance.py
@@ -76,10 +76,12 @@
 					(
 						select qty from `tabSales Order Item`
 						where name = dnpi.parent_detail_docname
+						and (delivered_by_supplier is null or delivered_by_supplier = 0)
 					) as so_item_qty,
 					(
-						select ifnull(delivered_qty, 0) from `tabSales Order Item`
+						select delivered_qty from `tabSales Order Item`
 						where name = dnpi.parent_detail_docname
+						and delivered_by_supplier = 0
 					) as so_item_delivered_qty,
 					parent, name
 				from
@@ -94,9 +96,10 @@
 				) dnpi)
 			union
 				(select qty as dnpi_qty, qty as so_item_qty,
-					ifnull(delivered_qty, 0) as so_item_delivered_qty, parent, name
+					delivered_qty as so_item_delivered_qty, parent, name
 				from `tabSales Order Item` so_item
 				where item_code = %s and warehouse = %s
+				and (so_item.delivered_by_supplier is null or so_item.delivered_by_supplier = 0)
 				and exists(select * from `tabSales Order` so
 					where so.name = so_item.parent and so.docstatus = 1
 					and so.status not in ('Stopped','Closed')))
@@ -108,29 +111,30 @@
 	return flt(reserved_qty[0][0]) if reserved_qty else 0
 
 def get_indented_qty(item_code, warehouse):
-	indented_qty = frappe.db.sql("""select sum(mr_item.qty - ifnull(mr_item.ordered_qty, 0))
+	indented_qty = frappe.db.sql("""select sum(mr_item.qty - mr_item.ordered_qty)
 		from `tabMaterial Request Item` mr_item, `tabMaterial Request` mr
 		where mr_item.item_code=%s and mr_item.warehouse=%s
-		and mr_item.qty > ifnull(mr_item.ordered_qty, 0) and mr_item.parent=mr.name
+		and mr_item.qty > mr_item.ordered_qty and mr_item.parent=mr.name
 		and mr.status!='Stopped' and mr.docstatus=1""", (item_code, warehouse))
 
 	return flt(indented_qty[0][0]) if indented_qty else 0
 
 def get_ordered_qty(item_code, warehouse):
 	ordered_qty = frappe.db.sql("""
-		select sum((po_item.qty - ifnull(po_item.received_qty, 0))*po_item.conversion_factor)
+		select sum((po_item.qty - po_item.received_qty)*po_item.conversion_factor)
 		from `tabPurchase Order Item` po_item, `tabPurchase Order` po
 		where po_item.item_code=%s and po_item.warehouse=%s
-		and po_item.qty > ifnull(po_item.received_qty, 0) and po_item.parent=po.name
-		and po.status not in ('Stopped', 'Closed', 'Delivered') and po.docstatus=1""", (item_code, warehouse))
+		and po_item.qty > po_item.received_qty and po_item.parent=po.name
+		and po.status not in ('Stopped', 'Closed', 'Delivered') and po.docstatus=1
+		and po_item.delivered_by_supplier = 0""", (item_code, warehouse))
 
 	return flt(ordered_qty[0][0]) if ordered_qty else 0
 
 def get_planned_qty(item_code, warehouse):
 	planned_qty = frappe.db.sql("""
-		select sum(ifnull(qty, 0) - ifnull(produced_qty, 0)) from `tabProduction Order`
+		select sum(qty - produced_qty) from `tabProduction Order`
 		where production_item = %s and fg_warehouse = %s and status != "Stopped"
-		and docstatus=1 and ifnull(qty, 0) > ifnull(produced_qty, 0)""", (item_code, warehouse))
+		and docstatus=1 and qty > produced_qty""", (item_code, warehouse))
 
 	return flt(planned_qty[0][0]) if planned_qty else 0
 
diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py
index ce5a0c9..4edf7a9 100644
--- a/erpnext/stock/stock_ledger.py
+++ b/erpnext/stock/stock_ledger.py
@@ -214,7 +214,7 @@
 			if flt(sle.actual_qty) < 0:
 				# In case of delivery/stock issue, get average purchase rate
 				# of serial nos of current entry
-				incoming_rate = flt(frappe.db.sql("""select avg(ifnull(purchase_rate, 0))
+				incoming_rate = flt(frappe.db.sql("""select avg(purchase_rate)
 					from `tabSerial No` where name in (%s)""" % (", ".join(["%s"]*len(serial_no))),
 					tuple(serial_no))[0][0])
 
@@ -387,13 +387,13 @@
 	last_valuation_rate = frappe.db.sql("""select valuation_rate
 		from `tabStock Ledger Entry`
 		where item_code = %s and warehouse = %s
-		and ifnull(valuation_rate, 0) > 0
+		and valuation_rate > 0
 		order by posting_date desc, posting_time desc, name desc limit 1""", (item_code, warehouse))
 
 	if not last_valuation_rate:
 		last_valuation_rate = frappe.db.sql("""select valuation_rate
 			from `tabStock Ledger Entry`
-			where item_code = %s and ifnull(valuation_rate, 0) > 0
+			where item_code = %s and valuation_rate > 0
 			order by posting_date desc, posting_time desc, name desc limit 1""", item_code)
 
 	valuation_rate = flt(last_valuation_rate[0][0]) if last_valuation_rate else 0
diff --git a/erpnext/stock/utils.py b/erpnext/stock/utils.py
index ee4303b..f89561c 100644
--- a/erpnext/stock/utils.py
+++ b/erpnext/stock/utils.py
@@ -112,7 +112,7 @@
 	"""get average value of serial numbers"""
 
 	serial_nos = get_valid_serial_nos(serial_nos)
-	return flt(frappe.db.sql("""select avg(ifnull(purchase_rate, 0)) from `tabSerial No`
+	return flt(frappe.db.sql("""select avg(purchase_rate) from `tabSerial No`
 		where name in (%s)""" % ", ".join(["%s"] * len(serial_nos)),
 		tuple(serial_nos))[0][0])
 
diff --git a/erpnext/support/doctype/issue/issue.json b/erpnext/support/doctype/issue/issue.json
index f7fcd51..229eccf 100644
--- a/erpnext/support/doctype/issue/issue.json
+++ b/erpnext/support/doctype/issue/issue.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Subject", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-flag", 
    "permlevel": 0, 
@@ -41,6 +42,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "ISS-", 
    "permlevel": 0, 
@@ -63,6 +65,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Subject", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -83,6 +86,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -105,6 +109,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "status", 
    "oldfieldtype": "Select", 
@@ -130,6 +135,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Raised By (Email)", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "raised_by", 
    "oldfieldtype": "Data", 
@@ -153,6 +159,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -173,6 +180,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -196,6 +204,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "problem_description", 
    "oldfieldtype": "Text", 
@@ -218,6 +227,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -241,6 +251,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Resolution Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "resolution_date", 
    "oldfieldtype": "Date", 
@@ -264,6 +275,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "First Responded On", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -285,6 +297,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-pushpin", 
    "permlevel": 0, 
@@ -307,6 +320,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Lead", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Lead", 
    "permlevel": 0, 
@@ -329,6 +343,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Contact", 
    "permlevel": 0, 
@@ -350,6 +365,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -372,6 +388,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer", 
    "oldfieldtype": "Link", 
@@ -396,6 +413,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer_name", 
    "oldfieldtype": "Data", 
@@ -418,6 +436,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -441,6 +460,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Resolution Details", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "resolution_details", 
    "oldfieldtype": "Text", 
@@ -464,6 +484,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -487,6 +508,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Opening Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "opening_date", 
    "oldfieldtype": "Date", 
@@ -510,6 +532,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Opening Time", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "opening_time", 
    "oldfieldtype": "Time", 
@@ -533,6 +556,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Company", 
    "permlevel": 0, 
@@ -555,6 +579,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Content Type", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -576,6 +601,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Attachment", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -597,7 +623,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-19 03:04:49.729321", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:47.774531", 
  "modified_by": "Administrator", 
  "module": "Support", 
  "name": "Issue", 
diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.json b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.json
index 419e64c..61052e9 100644
--- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.json
+++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-user", 
@@ -42,6 +43,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer", 
    "oldfieldtype": "Link", 
@@ -65,6 +67,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -87,7 +90,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "status", 
    "oldfieldtype": "Select", 
@@ -112,6 +116,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Transaction Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "transaction_date", 
    "oldfieldtype": "Date", 
@@ -135,6 +140,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-shopping-cart", 
@@ -158,6 +164,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Items", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_maintenance_detail", 
    "oldfieldtype": "Table", 
@@ -182,6 +189,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Schedule", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-time", 
@@ -205,6 +213,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Generate Schedule", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Button", 
    "permlevel": 0, 
@@ -227,6 +236,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Schedules", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "schedules", 
    "oldfieldtype": "Table", 
@@ -251,6 +261,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Info", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -273,6 +284,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Customer Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer_name", 
    "oldfieldtype": "Data", 
@@ -297,6 +309,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Person", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Contact", 
    "permlevel": 0, 
@@ -320,6 +333,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Mobile No", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -342,6 +356,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Email", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -363,6 +378,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -383,6 +399,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -405,6 +422,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Address", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Address", 
    "permlevel": 0, 
@@ -427,6 +445,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -450,6 +469,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Territory", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "territory", 
    "oldfieldtype": "Link", 
@@ -476,6 +496,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Group", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Customer Group", 
    "permlevel": 0, 
@@ -498,6 +519,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -522,6 +544,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "options": "Maintenance Schedule", 
    "permlevel": 0, 
@@ -543,7 +566,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:56.092101", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:49.752621", 
  "modified_by": "Administrator", 
  "module": "Support", 
  "name": "Maintenance Schedule", 
diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py
index ef3af41..14cad8e 100644
--- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py
+++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py
@@ -111,7 +111,7 @@
 				# check global holiday list
 				holiday_list = frappe.db.sql("""select h.holiday_date from
 					`tabHoliday` h, `tabHoliday List` hl
-					where h.parent=hl.name and ifnull(hl.is_default, 0) = 1
+					where h.parent=hl.name and hl.is_default = 1
 					and hl.fiscal_year=%s""", fy_details[0])
 
 			if not validated and holiday_list:
diff --git a/erpnext/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.json b/erpnext/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.json
index 7f9da32..af252c1 100644
--- a/erpnext/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.json
+++ b/erpnext/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.json
@@ -19,6 +19,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_name", 
    "oldfieldtype": "Data", 
@@ -66,6 +68,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Scheduled Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "scheduled_date", 
    "oldfieldtype": "Date", 
@@ -89,6 +92,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Actual Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "actual_date", 
    "oldfieldtype": "Date", 
@@ -112,6 +116,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Sales Person", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "incharge_name", 
    "oldfieldtype": "Link", 
@@ -136,6 +141,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Serial No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "serial_no", 
    "oldfieldtype": "Small Text", 
@@ -159,7 +165,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:56.307772", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:49.853613", 
  "modified_by": "Administrator", 
  "module": "Support", 
  "name": "Maintenance Schedule Detail", 
diff --git a/erpnext/support/doctype/maintenance_schedule_item/maintenance_schedule_item.json b/erpnext/support/doctype/maintenance_schedule_item/maintenance_schedule_item.json
index 668927e..f20cccb 100644
--- a/erpnext/support/doctype/maintenance_schedule_item/maintenance_schedule_item.json
+++ b/erpnext/support/doctype/maintenance_schedule_item/maintenance_schedule_item.json
@@ -19,6 +19,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_name", 
    "oldfieldtype": "Data", 
@@ -66,6 +68,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Data", 
@@ -91,6 +94,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -112,6 +116,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Start Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "start_date", 
    "oldfieldtype": "Date", 
@@ -135,6 +140,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "End Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "end_date", 
    "oldfieldtype": "Date", 
@@ -157,7 +163,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Periodicity",  
+   "label": "Periodicity", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "periodicity", 
    "oldfieldtype": "Select", 
@@ -182,6 +189,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "No of Visits", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "no_of_visits", 
    "oldfieldtype": "Int", 
@@ -205,6 +213,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Sales Person", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "incharge_name", 
    "oldfieldtype": "Link", 
@@ -229,6 +238,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reference", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -250,6 +260,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Serial No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "serial_no", 
    "oldfieldtype": "Small Text", 
@@ -273,6 +284,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Against Docname", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "prevdoc_docname", 
    "oldfieldtype": "Data", 
@@ -296,7 +308,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:56.419931", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:49.903875", 
  "modified_by": "Administrator", 
  "module": "Support", 
  "name": "Maintenance Schedule Item", 
diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit.json b/erpnext/support/doctype/maintenance_visit/maintenance_visit.json
index d70b403..cb7967b 100644
--- a/erpnext/support/doctype/maintenance_visit/maintenance_visit.json
+++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-user", 
@@ -41,6 +42,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -63,6 +65,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer", 
    "oldfieldtype": "Link", 
@@ -87,6 +90,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -108,6 +112,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -129,6 +134,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -150,6 +156,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Mobile No", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -171,6 +178,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Email", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -191,6 +199,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -215,6 +224,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Maintenance Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "mntc_date", 
    "oldfieldtype": "Date", 
@@ -238,6 +248,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Maintenance Time", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "mntc_time", 
    "oldfieldtype": "Time", 
@@ -261,6 +272,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-wrench", 
@@ -283,7 +295,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Completion Status",  
+   "label": "Completion Status", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "completion_status", 
    "oldfieldtype": "Select", 
@@ -307,6 +320,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -328,7 +342,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
-   "label": "Maintenance Type",  
+   "label": "Maintenance Type", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "maintenance_type", 
    "oldfieldtype": "Select", 
@@ -352,6 +367,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-wrench", 
@@ -375,6 +391,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Purposes", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "maintenance_visit_details", 
    "oldfieldtype": "Table", 
@@ -399,6 +416,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "More Information", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-file-text", 
@@ -422,6 +440,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Feedback", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer_feedback", 
    "oldfieldtype": "Small Text", 
@@ -444,6 +463,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -466,6 +486,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "status", 
    "oldfieldtype": "Data", 
@@ -490,6 +511,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Data", 
@@ -515,6 +537,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Select", 
@@ -539,6 +562,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -564,6 +588,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Info", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-bullhorn", 
    "permlevel": 0, 
@@ -586,6 +611,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Address", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Address", 
    "permlevel": 0, 
@@ -608,6 +634,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Person", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Contact", 
    "permlevel": 0, 
@@ -629,6 +656,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -651,6 +679,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Territory", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Territory", 
    "permlevel": 0, 
@@ -674,6 +703,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Group", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Customer Group", 
    "permlevel": 0, 
@@ -695,7 +725,8 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:56.562419", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:49.976485", 
  "modified_by": "Administrator", 
  "module": "Support", 
  "name": "Maintenance Visit", 
diff --git a/erpnext/support/doctype/maintenance_visit_purpose/maintenance_visit_purpose.json b/erpnext/support/doctype/maintenance_visit_purpose/maintenance_visit_purpose.json
index 2351a78..c89453a 100644
--- a/erpnext/support/doctype/maintenance_visit_purpose/maintenance_visit_purpose.json
+++ b/erpnext/support/doctype/maintenance_visit_purpose/maintenance_visit_purpose.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_name", 
    "oldfieldtype": "Data", 
@@ -66,6 +68,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Serial No", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "serial_no", 
    "oldfieldtype": "Small Text", 
@@ -89,6 +92,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Small Text", 
@@ -114,6 +118,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -135,6 +140,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Sales Person", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "service_person", 
    "oldfieldtype": "Link", 
@@ -159,6 +165,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Work Done", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "work_done", 
    "oldfieldtype": "Small Text", 
@@ -182,6 +189,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Document Type", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "prevdoc_doctype", 
    "oldfieldtype": "Data", 
@@ -208,6 +216,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Against Document No", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "prevdoc_docname", 
    "oldfieldtype": "Data", 
@@ -234,6 +243,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Against Document Detail No", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "prevdoc_detail_docname", 
    "oldfieldtype": "Data", 
@@ -257,7 +267,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-02 07:38:56.794124", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:50.082976", 
  "modified_by": "Administrator", 
  "module": "Support", 
  "name": "Maintenance Visit Purpose", 
diff --git a/erpnext/support/doctype/warranty_claim/warranty_claim.json b/erpnext/support/doctype/warranty_claim/warranty_claim.json
index 9d3cdbd..b39f6c0 100644
--- a/erpnext/support/doctype/warranty_claim/warranty_claim.json
+++ b/erpnext/support/doctype/warranty_claim/warranty_claim.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-user", 
    "permlevel": 0, 
@@ -40,7 +41,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Series",  
+   "label": "Series", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "naming_series", 
    "oldfieldtype": "Select", 
@@ -65,7 +67,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
-   "label": "Status",  
+   "label": "Status", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "status", 
    "oldfieldtype": "Select", 
@@ -91,6 +94,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Issue Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "complaint_date", 
    "oldfieldtype": "Date", 
@@ -113,6 +117,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -137,6 +142,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Serial No", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Serial No", 
    "permlevel": 0, 
@@ -159,6 +165,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "customer", 
    "oldfieldtype": "Link", 
@@ -183,6 +190,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Address", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Address", 
    "permlevel": 0, 
@@ -205,6 +213,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Person", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Contact", 
    "permlevel": 0, 
@@ -227,6 +236,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-ticket", 
@@ -250,6 +260,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Issue", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "complaint", 
    "oldfieldtype": "Small Text", 
@@ -273,6 +284,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item Code", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_code", 
    "oldfieldtype": "Link", 
@@ -296,6 +308,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
@@ -320,6 +333,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Name", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "item_name", 
    "oldfieldtype": "Data", 
@@ -344,6 +358,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "description", 
    "oldfieldtype": "Small Text", 
@@ -367,7 +382,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
-   "label": "Warranty / AMC Status",  
+   "label": "Warranty / AMC Status", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nUnder Warranty\nOut of Warranty\nUnder AMC\nOut of AMC", 
    "permlevel": 0, 
@@ -390,6 +406,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Warranty Expiry Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -411,6 +428,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "AMC Expiry Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -433,6 +451,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Resolution", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Section Break", 
    "options": "icon-thumbs-up", 
@@ -456,6 +475,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Resolution Date", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "resolution_date", 
    "oldfieldtype": "Date", 
@@ -479,6 +499,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Resolved By", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "resolved_by", 
    "oldfieldtype": "Link", 
@@ -503,6 +524,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Resolution Details", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "resolution_details", 
    "oldfieldtype": "Text", 
@@ -527,6 +549,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Info", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-bullhorn", 
    "permlevel": 0, 
@@ -548,6 +571,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -571,6 +595,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -594,6 +619,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Group", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Customer Group", 
    "permlevel": 0, 
@@ -618,6 +644,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Territory", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "territory", 
    "oldfieldtype": "Link", 
@@ -643,6 +670,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -665,6 +693,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Mobile No", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -687,6 +716,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact Email", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -707,6 +737,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -731,6 +762,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Service Address", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "service_address", 
    "oldfieldtype": "Small Text", 
@@ -755,6 +787,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -776,6 +809,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "More Information", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-file-text", 
    "permlevel": 0, 
@@ -797,6 +831,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -819,6 +854,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
@@ -843,6 +879,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
@@ -866,6 +903,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -888,6 +926,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Raised By", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "complaint_raised_by", 
    "oldfieldtype": "Data", 
@@ -911,6 +950,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "From Company", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "from_company", 
    "oldfieldtype": "Data", 
@@ -934,6 +974,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amended From", 
+   "length": 0, 
    "no_copy": 1, 
    "oldfieldname": "amended_from", 
    "oldfieldtype": "Data", 
@@ -958,7 +999,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:18.513337", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:30:00.174354", 
  "modified_by": "Administrator", 
  "module": "Support", 
  "name": "Warranty Claim", 
diff --git a/erpnext/utilities/doctype/address/address.json b/erpnext/utilities/doctype/address/address.json
index e18a694..0a1356e 100644
--- a/erpnext/utilities/doctype/address/address.json
+++ b/erpnext/utilities/doctype/address/address.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-map-marker", 
    "permlevel": 0, 
@@ -42,6 +43,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address Title", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -62,7 +64,8 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Address Type",  
+   "label": "Address Type", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Billing\nShipping\nOffice\nPersonal\nPlant\nPostal\nShop\nSubsidiary\nWarehouse\nOther", 
    "permlevel": 0, 
@@ -85,6 +88,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address Line 1", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -106,6 +110,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Address Line 2", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -127,6 +132,7 @@
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "City/Town", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -148,6 +154,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "State", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -169,6 +176,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Postal Code", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -190,6 +198,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Country", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Country", 
    "permlevel": 0, 
@@ -211,6 +220,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -233,6 +243,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Email Id", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -254,6 +265,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Phone", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -275,6 +287,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Fax", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -298,6 +311,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Preferred Billing Address", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -321,6 +335,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Preferred Shipping Address", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -342,6 +357,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reference", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "icon-pushpin", 
    "permlevel": 0, 
@@ -364,6 +380,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Customer", 
    "permlevel": 0, 
@@ -386,6 +403,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -407,6 +425,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Supplier", 
    "permlevel": 0, 
@@ -429,6 +448,7 @@
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Supplier Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -450,6 +470,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Partner", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Sales Partner", 
    "permlevel": 0, 
@@ -471,6 +492,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -493,6 +515,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Lead", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Lead", 
    "permlevel": 0, 
@@ -516,6 +539,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Lead Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -536,7 +560,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:37.894887", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:41.719278", 
  "modified_by": "Administrator", 
  "module": "Utilities", 
  "name": "Address", 
diff --git a/erpnext/utilities/doctype/address/address.py b/erpnext/utilities/doctype/address/address.py
index 8ae7c4d..a482891 100644
--- a/erpnext/utilities/doctype/address/address.py
+++ b/erpnext/utilities/doctype/address/address.py
@@ -35,7 +35,7 @@
 			for fieldname in self.link_fields:
 				if self.get(fieldname):
 					if not frappe.db.sql("""select name from `tabAddress` where is_primary_address=1
-						and `%s`=%s and name!=%s""" % (fieldname, "%s", "%s"),
+						and `%s`=%s and name!=%s""" % (frappe.db.escape(fieldname), "%s", "%s"),
 						(self.get(fieldname), self.name)):
 							self.is_primary_address = 1
 					break
diff --git a/erpnext/utilities/doctype/address_template/address_template.json b/erpnext/utilities/doctype/address_template/address_template.json
index 9726e05..0d41753 100644
--- a/erpnext/utilities/doctype/address_template/address_template.json
+++ b/erpnext/utilities/doctype/address_template/address_template.json
@@ -20,6 +20,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Country", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Country", 
    "permlevel": 0, 
@@ -43,6 +44,7 @@
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Is Default", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -66,6 +68,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Template", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -85,7 +88,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:38:38.124736", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:41.812186", 
  "modified_by": "Administrator", 
  "module": "Utilities", 
  "name": "Address Template", 
diff --git a/erpnext/utilities/doctype/contact/contact.json b/erpnext/utilities/doctype/contact/contact.json
index 2bc9984..9fef425 100644
--- a/erpnext/utilities/doctype/contact/contact.json
+++ b/erpnext/utilities/doctype/contact/contact.json
@@ -1,746 +1,768 @@
 {
- "allow_copy": 0,
- "allow_import": 1,
- "allow_rename": 1,
- "creation": "2013-01-10 16:34:32",
- "custom": 0,
- "docstatus": 0,
- "doctype": "DocType",
- "document_type": "Setup",
+ "allow_copy": 0, 
+ "allow_import": 1, 
+ "allow_rename": 1, 
+ "creation": "2013-01-10 16:34:32", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Setup", 
  "fields": [
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "contact_section",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "",
-   "no_copy": 0,
-   "options": "icon-user",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "contact_section", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "icon-user", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "first_name",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "First Name",
-   "no_copy": 0,
-   "oldfieldname": "first_name",
-   "oldfieldtype": "Data",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "first_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "First Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "first_name", 
+   "oldfieldtype": "Data", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "last_name",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Last Name",
-   "no_copy": 0,
-   "oldfieldname": "last_name",
-   "oldfieldtype": "Data",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "last_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Last Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "last_name", 
+   "oldfieldtype": "Data", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "email_id",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Email Id",
-   "no_copy": 0,
-   "oldfieldname": "email_id",
-   "oldfieldtype": "Data",
-   "options": "Email",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 1,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "email_id", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Email Id", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "email_id", 
+   "oldfieldtype": "Data", 
+   "options": "Email", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "cb00",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "cb00", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "default": "Passive",
-   "fieldname": "status",
-   "fieldtype": "Select",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "Status",
-   "no_copy": 0,
-   "options": "Passive\nOpen\nReplied",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "default": "Passive", 
+   "fieldname": "status", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Status", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Passive\nOpen\nReplied", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "phone",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Phone",
-   "no_copy": 0,
-   "oldfieldname": "contact_no",
-   "oldfieldtype": "Data",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "phone", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Phone", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "contact_no", 
+   "oldfieldtype": "Data", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "contact_details",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Reference",
-   "no_copy": 0,
-   "options": "icon-pushpin",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "contact_details", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Reference", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "icon-pushpin", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "user",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "User Id",
-   "no_copy": 0,
-   "options": "User",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "user", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "User Id", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "User", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "depends_on": "",
-   "fieldname": "customer",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Customer",
-   "no_copy": 0,
-   "oldfieldname": "customer",
-   "oldfieldtype": "Link",
-   "options": "Customer",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "depends_on": "", 
+   "fieldname": "customer", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Customer", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "customer", 
+   "oldfieldtype": "Link", 
+   "options": "Customer", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "depends_on": "",
-   "fieldname": "customer_name",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Customer Name",
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "depends_on": "", 
+   "fieldname": "customer_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Customer Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "column_break1",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "no_copy": 0,
-   "oldfieldtype": "Column Break",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "column_break1", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Column Break", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "50%"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "depends_on": "",
-   "fieldname": "supplier",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Supplier",
-   "no_copy": 0,
-   "options": "Supplier",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "depends_on": "", 
+   "fieldname": "supplier", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Supplier", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Supplier", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "depends_on": "",
-   "fieldname": "supplier_name",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Supplier Name",
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "depends_on": "", 
+   "fieldname": "supplier_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Supplier Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "depends_on": "",
-   "fieldname": "sales_partner",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Sales Partner",
-   "no_copy": 0,
-   "options": "Sales Partner",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "depends_on": "", 
+   "fieldname": "sales_partner", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Sales Partner", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Sales Partner", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "default": "0",
-   "depends_on": "eval:(doc.customer || doc.supplier || doc.sales_partner)",
-   "fieldname": "is_primary_contact",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Is Primary Contact",
-   "no_copy": 0,
-   "oldfieldname": "is_primary_contact",
-   "oldfieldtype": "Select",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "default": "0", 
+   "depends_on": "eval:(doc.customer || doc.supplier || doc.sales_partner)", 
+   "fieldname": "is_primary_contact", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Is Primary Contact", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "is_primary_contact", 
+   "oldfieldtype": "Select", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "more_info",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "More Information",
-   "no_copy": 0,
-   "options": "icon-file-text",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "more_info", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "More Information", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "icon-file-text", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "mobile_no",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Mobile No",
-   "no_copy": 0,
-   "oldfieldname": "mobile_no",
-   "oldfieldtype": "Data",
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "mobile_no", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Mobile No", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "mobile_no", 
+   "oldfieldtype": "Data", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "description": "Enter department to which this Contact belongs",
-   "fieldname": "department",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Department",
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "description": "Enter department to which this Contact belongs", 
+   "fieldname": "department", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Department", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "description": "Enter designation of this Contact",
-   "fieldname": "designation",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Designation",
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "description": "Enter designation of this Contact", 
+   "fieldname": "designation", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Designation", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "unsubscribed",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Unsubscribed",
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "unsubscribed", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Unsubscribed", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
   }
- ],
- "hide_heading": 0,
- "hide_toolbar": 0,
- "icon": "icon-user",
- "idx": 1,
- "in_create": 0,
- "in_dialog": 0,
- "is_submittable": 0,
- "issingle": 0,
- "istable": 0,
- "modified": "2015-10-07 00:38:08.152183",
- "modified_by": "Administrator",
- "module": "Utilities",
- "name": "Contact",
- "owner": "Administrator",
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "icon": "icon-user", 
+ "idx": 1, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:43.760924", 
+ "modified_by": "Administrator", 
+ "module": "Utilities", 
+ "name": "Contact", 
+ "owner": "Administrator", 
  "permissions": [
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 1,
-   "delete": 1,
-   "email": 1,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "System Manager",
-   "set_user_permissions": 0,
-   "share": 1,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "System Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
    "write": 1
-  },
+  }, 
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 1,
-   "delete": 1,
-   "email": 1,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Sales Master Manager",
-   "set_user_permissions": 0,
-   "share": 1,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Sales Master Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
    "write": 1
-  },
+  }, 
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 1,
-   "delete": 1,
-   "email": 1,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Purchase Master Manager",
-   "set_user_permissions": 0,
-   "share": 1,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Purchase Master Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
    "write": 1
-  },
+  }, 
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 1,
-   "delete": 0,
-   "email": 1,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Sales Manager",
-   "set_user_permissions": 0,
-   "share": 1,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Sales Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
    "write": 1
-  },
+  }, 
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 1,
-   "delete": 0,
-   "email": 1,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Purchase Manager",
-   "set_user_permissions": 0,
-   "share": 1,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Purchase Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
    "write": 1
-  },
+  }, 
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 1,
-   "delete": 0,
-   "email": 1,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Maintenance Manager",
-   "set_user_permissions": 0,
-   "share": 1,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Maintenance Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
    "write": 1
-  },
+  }, 
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 1,
-   "delete": 0,
-   "email": 1,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Accounts Manager",
-   "set_user_permissions": 0,
-   "share": 1,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Accounts Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
    "write": 1
-  },
+  }, 
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 1,
-   "delete": 0,
-   "email": 1,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Sales User",
-   "set_user_permissions": 0,
-   "share": 1,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Sales User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
    "write": 1
-  },
+  }, 
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 1,
-   "delete": 0,
-   "email": 1,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Purchase User",
-   "set_user_permissions": 0,
-   "share": 1,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Purchase User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
    "write": 1
-  },
+  }, 
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 1,
-   "delete": 0,
-   "email": 1,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Maintenance User",
-   "set_user_permissions": 0,
-   "share": 1,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Maintenance User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
    "write": 1
-  },
+  }, 
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 1,
-   "delete": 0,
-   "email": 1,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Accounts User",
-   "set_user_permissions": 0,
-   "share": 1,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Accounts User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
    "write": 1
-  },
+  }, 
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 0,
-   "delete": 0,
-   "email": 0,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "match": "",
-   "permlevel": 1,
-   "print": 0,
-   "read": 1,
-   "report": 1,
-   "role": "All",
-   "set_user_permissions": 0,
-   "share": 0,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 0, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "match": "", 
+   "permlevel": 1, 
+   "print": 0, 
+   "read": 1, 
+   "report": 1, 
+   "role": "All", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
    "write": 0
   }
- ],
- "read_only": 0,
+ ], 
+ "read_only": 0, 
  "read_only_onload": 0
-}
+}
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/rename_tool/rename_tool.py b/erpnext/utilities/doctype/rename_tool/rename_tool.py
index 5e33f5f..0f8a7a3 100644
--- a/erpnext/utilities/doctype/rename_tool/rename_tool.py
+++ b/erpnext/utilities/doctype/rename_tool/rename_tool.py
@@ -15,7 +15,7 @@
 @frappe.whitelist()
 def get_doctypes():
 	return frappe.db.sql_list("""select name from tabDocType
-		where ifnull(allow_rename,0)=1 and module!='Core' order by name""")
+		where allow_rename=1 and module!='Core' order by name""")
 
 @frappe.whitelist()
 def upload(select_doctype=None, rows=None):
diff --git a/erpnext/utilities/doctype/sms_log/sms_log.json b/erpnext/utilities/doctype/sms_log/sms_log.json
index 2be7fba..bf704cd 100644
--- a/erpnext/utilities/doctype/sms_log/sms_log.json
+++ b/erpnext/utilities/doctype/sms_log/sms_log.json
@@ -19,6 +19,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sender Name", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -40,6 +41,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sent On", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -60,6 +62,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -82,6 +85,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Message", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -102,6 +106,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "options": "Simple", 
    "permlevel": 0, 
@@ -125,6 +130,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "No of Requested SMS", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -146,6 +152,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Requested Numbers", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -166,6 +173,7 @@
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -188,6 +196,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "No of Sent SMS", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
@@ -209,6 +218,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sent To", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
@@ -230,7 +240,8 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-10-02 07:39:13.234503", 
+ "max_attachments": 0, 
+ "modified": "2015-11-16 06:29:57.793449", 
  "modified_by": "Administrator", 
  "module": "Utilities", 
  "name": "SMS Log", 
diff --git a/setup.py b/setup.py
index 41264f8..74e7c24 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
 from setuptools import setup, find_packages
 
-version = "6.9.2"
+version = "6.10.0"
 
 with open("requirements.txt", "r") as f:
 	install_requires = f.readlines()