Merge branch 'live'
diff --git a/.gitignore b/.gitignore
index e9c8fc6..56149a0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,5 @@
 *.pyc
 *.comp.js
-*.txt
 .DS_Store
 server_tools
 patch.log
diff --git a/accounts/Module Def/Accounts/Accounts.txt b/accounts/Module Def/Accounts/Accounts.txt
index 3d70ff8..512b460 100644
--- a/accounts/Module Def/Accounts/Accounts.txt
+++ b/accounts/Module Def/Accounts/Accounts.txt
@@ -1,722 +1,441 @@
+# Module Def, Accounts
 [
+
+	# These values are common in all dictionaries
 	{
-		'_last_update': None,
-		'creation': '2010-09-25 10:50:37',
-		'disabled': 'No',
+		'creation': '2010-09-25 10:50:34',
 		'docstatus': 0,
-		'doctype': u'Module Def',
+		'modified': '2011-07-28 12:01:10',
+		'modified_by': 'Administrator',
+		'owner': 'Administrator'
+	},
+
+	# These values are common for all Module Def Role
+	{
+		'doctype': 'Module Def Role',
+		'name': '__common__',
+		'parent': 'Accounts',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def'
+	},
+
+	# These values are common for all Module Def Item
+	{
+		'doctype': 'Module Def Item',
+		'name': '__common__',
+		'parent': 'Accounts',
+		'parentfield': 'items',
+		'parenttype': 'Module Def'
+	},
+
+	# These values are common for all Module Def
+	{
+		'disabled': 'No',
+		'doctype': 'Module Def',
 		'doctype_list': 'GL Mapper, Journal Voucher\nGL Mapper, Payable Voucher\nGL Mapper, Receivable Voucher\nDocType Label, Receivable Voucher\nDocType Label, Payable Voucher',
 		'file_list': 'finance.gif,FileData/00210',
-		'idx': None,
 		'is_hidden': 'No',
 		'last_updated_date': '2010-12-08 10:13:30',
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
 		'module_desc': 'Data about your payables, receivables and books of accounts',
 		'module_icon': 'Accounts.gif',
 		'module_label': 'Accounts',
 		'module_name': 'Accounts',
-		'module_page': None,
-		'module_seq': 6,
-		'name': 'Accounts',
-		'owner': 'Administrator',
-		'parent': None,
-		'parentfield': None,
-		'parenttype': None,
-		'trash_reason': None,
-		'widget_code': ""
+		'module_seq': 3,
+		'name': '__common__'
 	},
+
+	# Module Def, Accounts
+	{
+		'doctype': 'Module Def',
+		'name': 'Accounts'
+	},
+
+	# Module Def Item
 	{
 		'click_function': "show_chart_browser('Accounts Browser','Account')",
-		'creation': '2010-10-04 17:16:24',
 		'description': 'Manage your accounts',
 		'display_name': 'Chart of Accounts',
 		'doc_name': 'Accounts Browser',
 		'doc_type': 'Pages',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 1,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01178',
-		'owner': 'harshada@webnotestech.com',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 1
 	},
+
+	# Module Def Item
 	{
 		'click_function': "show_chart_browser('Accounts Browser','Cost Center')",
-		'creation': '2010-10-05 12:51:20',
 		'description': 'Manage your cost centers',
 		'display_name': 'Chart of Cost Centers',
 		'doc_name': 'Accounts Browser',
 		'doc_type': 'Pages',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 2,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01183',
-		'owner': 'harshada@webnotestech.com',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 2
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
 		'description': 'Regular journal entry',
 		'display_name': 'Journal Voucher',
 		'doc_name': 'Journal Voucher',
 		'doc_type': 'Forms',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
 		'fields': 'voucher_type\nvoucher_date\nfiscal_year\ntotal_debit\ntotal_credit',
-		'hide': None,
-		'icon': None,
-		'idx': 3,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01012',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 3
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
 		'description': 'Outgoing Invoice to your customers',
 		'display_name': 'Sales Invoice',
 		'doc_name': 'Receivable Voucher',
 		'doc_type': 'Forms',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
 		'fields': 'voucher_date\ndue_date\ndebit_to\ngrand_total\noutstanding_amount',
-		'hide': None,
-		'icon': None,
-		'idx': 4,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01013',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 4
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
 		'description': 'Incoming invoice from your service providers',
 		'display_name': 'Purchase Invoice',
 		'doc_name': 'Payable Voucher',
 		'doc_type': 'Forms',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
 		'fields': 'voucher_date\ncredit_to\nbill_no\ngrand_total\noutstanding_amount',
-		'hide': None,
-		'icon': None,
-		'idx': 5,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01014',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 5
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
+		'description': 'Lease Agreement for Vehicles',
+		'display_name': 'Lease Agreement',
+		'doc_name': 'Lease Agreement',
+		'doc_type': 'Forms',
+		'doctype': 'Module Def Item',
+		'idx': 6
+	},
+
+	# Module Def Item
+	{
 		'description': 'Profit & Loss and Balance Sheet builder',
 		'display_name': 'Financial Statements',
 		'doc_name': 'Financial Statements',
 		'doc_type': 'Pages',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
 		'icon': 'table.gif',
-		'idx': 6,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01015',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 7
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
 		'description': 'Update your actual clearance dates and find out if bank ledger tallies with your bank statement.',
 		'display_name': 'Bank Reconciliation',
 		'doc_name': 'Bank Reconciliation',
 		'doc_type': 'Single DocType',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 7,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01016',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 8
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
-		'description': None,
 		'display_name': 'TDS Payment',
 		'doc_name': 'TDS Payment',
 		'doc_type': 'Setup Forms',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 8,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01017',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 9
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
-		'description': None,
 		'display_name': 'TDS Return Acknowledgement',
 		'doc_name': 'TDS Return Acknowledgement',
 		'doc_type': 'Setup Forms',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 9,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01018',
-		'owner': 'nabin@webnotestech.com',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 10
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
-		'description': None,
 		'display_name': 'Form 16A',
 		'doc_name': 'Form 16A',
 		'doc_type': 'Setup Forms',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 10,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01019',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 11
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-10-25 17:25:22',
 		'description': 'Account closing entry (Profit Booking) on any date',
 		'display_name': 'Period Closing Voucher',
 		'doc_name': 'Period Closing Voucher',
 		'doc_type': 'Setup Forms',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 11,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01188',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 12
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2011-05-24 14:47:53',
 		'description': 'You can export balance of selected ledgers within a specific period',
 		'display_name': 'Ledger Balance Export',
 		'doc_name': 'Ledger Balance Export',
 		'doc_type': 'Single DocType',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 12,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01283',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 13
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
-		'description': None,
 		'display_name': 'General Ledger',
 		'doc_name': 'GL Entry',
 		'doc_type': 'Reports',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 13,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01021',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 14
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
-		'description': None,
 		'display_name': 'Accounts Receivable',
 		'doc_name': 'GL Entry',
 		'doc_type': 'Reports',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 14,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01022',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 15
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
-		'description': None,
 		'display_name': 'Accounts Payable',
 		'doc_name': 'GL Entry',
 		'doc_type': 'Reports',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 15,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01023',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 16
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
-		'description': None,
 		'display_name': 'Bank Reconciliation Statement',
 		'doc_name': 'Journal Voucher Detail',
 		'doc_type': 'Reports',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 16,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01024',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 17
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
-		'description': None,
 		'display_name': 'Trial Balance',
 		'doc_name': 'Account',
 		'doc_type': 'Reports',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 17,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01025',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 18
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
-		'description': None,
 		'display_name': 'Sales Register',
 		'doc_name': 'Receivable Voucher',
 		'doc_type': 'Reports',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 18,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01026',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 19
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
-		'description': None,
 		'display_name': 'Purchase Register',
 		'doc_name': 'Payable Voucher',
 		'doc_type': 'Reports',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 19,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01027',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 20
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
-		'description': None,
 		'display_name': 'Bank Clearance report',
 		'doc_name': 'Journal Voucher Detail',
 		'doc_type': 'Reports',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 20,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01028',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 21
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
-		'description': None,
 		'display_name': 'Monthly Ledger Summary Report',
 		'doc_name': 'GL Entry',
 		'doc_type': 'Reports',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 21,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01031',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 22
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
-		'description': None,
 		'display_name': 'Collection Report',
 		'doc_name': 'Journal Voucher Detail',
 		'doc_type': 'Reports',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 22,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01032',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 23
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
-		'description': None,
 		'display_name': 'Total amout collection for a period - Customerwise',
 		'doc_name': 'Account',
 		'doc_type': 'Reports',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 23,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01033',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 24
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
-		'description': None,
 		'display_name': 'Payment Report',
 		'doc_name': 'Journal Voucher Detail',
 		'doc_type': 'Reports',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 24,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01034',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 25
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2011-01-19 17:41:27',
-		'description': None,
 		'display_name': 'Itemwise Sales Register',
 		'doc_name': 'RV Detail',
 		'doc_type': 'Reports',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 25,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01267',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 26
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
-		'description': None,
 		'display_name': 'Itemwise Purchase Register',
 		'doc_name': 'PV Detail',
 		'doc_type': 'Reports',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 26,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01035',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 27
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
-		'description': None,
 		'display_name': 'Cost Center wise Expense',
 		'doc_name': 'GL Entry',
 		'doc_type': 'Reports',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 27,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01036',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 28
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
-		'description': None,
 		'display_name': 'TDS Return',
 		'doc_name': 'TDS Payment Detail',
 		'doc_type': 'Reports',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 28,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01038',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 29
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
-		'description': None,
 		'display_name': 'Budget Variance Report',
 		'doc_name': 'Budget Detail',
 		'doc_type': 'Reports',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 29,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01039',
-		'owner': 'jai@webnotestech.com',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 30
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
-		'description': None,
 		'display_name': 'Payment Receipt Report',
 		'doc_name': 'GL Entry',
 		'doc_type': 'Reports',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 30,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01040',
-		'owner': 'jai@webnotestech.com',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 31
 	},
+
+	# Module Def Item
 	{
-		'click_function': None,
-		'creation': '2010-09-25 10:50:37',
 		'description': 'Track total commission given to your Business Associate',
 		'display_name': 'Business Associate Commission Report',
 		'doc_name': 'Receivable Voucher',
 		'doc_type': 'Reports',
-		'docstatus': 0,
 		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 31,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDI01041',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
+		'idx': 32
 	},
+
+	# Module Def Item
 	{
-		'creation': '2010-09-25 10:50:37',
-		'docstatus': 0,
+		'display_name': 'Lease Agreement List',
+		'doc_name': 'GL Entry',
+		'doc_type': 'Reports',
+		'doctype': 'Module Def Item',
+		'idx': 33
+	},
+
+	# Module Def Item
+	{
+		'display_name': 'Lease Monthly Future Installment Inflows',
+		'doc_name': 'GL Entry',
+		'doc_type': 'Reports',
+		'doctype': 'Module Def Item',
+		'idx': 34
+	},
+
+	# Module Def Item
+	{
+		'display_name': 'Lease Overdue Age Wise',
+		'doc_name': 'GL Entry',
+		'doc_type': 'Reports',
+		'doctype': 'Module Def Item',
+		'idx': 35
+	},
+
+	# Module Def Item
+	{
+		'display_name': 'Lease Overdue List',
+		'doc_name': 'GL Entry',
+		'doc_type': 'Reports',
+		'doctype': 'Module Def Item',
+		'idx': 36
+	},
+
+	# Module Def Item
+	{
+		'display_name': 'Lease Receipts Client Wise',
+		'doc_name': 'GL Entry',
+		'doc_type': 'Reports',
+		'doctype': 'Module Def Item',
+		'idx': 37
+	},
+
+	# Module Def Item
+	{
+		'display_name': 'Lease Receipt Summary Month Wise',
+		'doc_name': 'GL Entry',
+		'doc_type': 'Reports',
+		'doctype': 'Module Def Item',
+		'idx': 38
+	},
+
+	# Module Def Item
+	{
+		'display_name': 'Lease Yearly Future Installment Inflows',
+		'doc_name': 'GL Entry',
+		'doc_type': 'Reports',
+		'doctype': 'Module Def Item',
+		'idx': 39
+	},
+
+	# Module Def Role
+	{
 		'doctype': 'Module Def Role',
 		'idx': 1,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDR00302',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
 		'role': 'Accounts Manager'
 	},
+
+	# Module Def Role
 	{
-		'creation': '2010-09-25 10:50:37',
-		'docstatus': 0,
 		'doctype': 'Module Def Role',
 		'idx': 2,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDR00303',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
 		'role': 'Accounts User'
 	},
+
+	# Module Def Role
 	{
-		'creation': '2010-09-25 10:50:37',
-		'docstatus': 0,
 		'doctype': 'Module Def Role',
 		'idx': 3,
-		'modified': '2011-07-01 09:36:04',
-		'modified_by': 'Administrator',
-		'name': 'MDR00304',
-		'owner': 'Administrator',
-		'parent': 'Accounts',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
 		'role': 'Administrator'
 	}
-]
+]
\ No newline at end of file
diff --git a/accounts/doctype/account/account.py b/accounts/doctype/account/account.py
index f5e4a6d..52c66a9 100644
--- a/accounts/doctype/account/account.py
+++ b/accounts/doctype/account/account.py
@@ -94,8 +94,8 @@
 	def convert_group_to_ledger(self):
 		if self.check_if_child_exists():
 			msgprint("Account: %s has existing child. You can not convert this account to ledger" % (self.doc.name), raise_exception=1)
-		elif self.check_prev_bal_exists():
-			msgprint("Account with balance can not be converted to ledger.", raise_exception=1)
+		elif self.check_gle_exists():
+			msgprint("Account with existing transaction can not be converted to ledger.", raise_exception=1)
 		else:
 			self.doc.group_or_ledger = 'Ledger'
 			self.doc.save()
@@ -104,8 +104,8 @@
 	# Convert ledger to group
 	# ==================================================================
 	def convert_ledger_to_group(self):
-		if self.check_prev_bal_exists():
-			msgprint("Account with balance can not be converted to group.", raise_exception=1)
+		if self.check_gle_exists():
+			msgprint("Account with existing transaction can not be converted to group.", raise_exception=1)
 		else:
 			self.doc.group_or_ledger = 'Group'
 			self.doc.save()
@@ -113,9 +113,9 @@
 
 	# Check if any previous balance exists
 	# ==================================================================
-	def check_prev_bal_exists(self):
-		bal = sql("select balance from `tabAccount Balance` where parent = '%s' and ifnull(balance, 0) > 0" % (self.doc.name))
-		return bal and flt(bal[0][0]) or 0
+	def check_gle_exists(self):
+		exists = sql("select name from `tabGL Entry` where account = '%s' and ifnull(is_cancelled, 'No') = 'No'" % (self.doc.name))
+		return exists and exists[0][0] or ''
 
 	# check if child exists
 	# ==================================================================
@@ -231,8 +231,8 @@
 	# Account with balance cannot be inactive
 	# ==================================================================
 	def check_balance_before_trash(self):
-		if flt(self.get_curr_bal()) != 0:
-			msgprint("Account with existing balance can not be trashed", raise_exception=1)
+		if self.check_gle_exists():
+			msgprint("Account with existing transaction can not be trashed", raise_exception=1)
 		if self.check_if_child_exists():
 			msgprint("Child account exists for this account. You can not trash this account.", raise_exception=1)
 
diff --git a/accounts/doctype/account/account.txt b/accounts/doctype/account/account.txt
index 9ce509c..b29c617 100644
--- a/accounts/doctype/account/account.txt
+++ b/accounts/doctype/account/account.txt
@@ -12,7 +12,7 @@
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1308829300',
+		'_last_update': '1309508836',
 		'allow_copy': 1,
 		'allow_trash': 1,
 		'colour': 'White:FFF',
@@ -179,7 +179,7 @@
 		'oldfieldtype': 'Data',
 		'permlevel': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -225,7 +225,7 @@
 		'options': '\nLedger\nGroup',
 		'permlevel': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -259,7 +259,7 @@
 		'oldfieldname': 'debit_or_credit',
 		'oldfieldtype': 'Data',
 		'permlevel': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -274,7 +274,7 @@
 		'oldfieldtype': 'Select',
 		'options': 'Yes\nNo',
 		'permlevel': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -344,7 +344,7 @@
 		'options': 'Company',
 		'permlevel': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/accounts/doctype/account_balance/account_balance.txt b/accounts/doctype/account_balance/account_balance.txt
index a53def2..1d23bb2 100644
--- a/accounts/doctype/account_balance/account_balance.txt
+++ b/accounts/doctype/account_balance/account_balance.txt
@@ -174,7 +174,7 @@
 		'oldfieldname': 'fiscal_year',
 		'oldfieldtype': 'Link',
 		'options': 'Fiscal Year',
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/accounts/doctype/bank_reconciliation/bank_reconciliation.py
index 8434f62..3ba477b 100644
--- a/accounts/doctype/bank_reconciliation/bank_reconciliation.py
+++ b/accounts/doctype/bank_reconciliation/bank_reconciliation.py
@@ -18,32 +18,32 @@
 
 
 class DocType:
-  def __init__(self, d, dl):
-    self.doc, self.doclist = d, dl
+	def __init__(self, d, dl):
+		self.doc, self.doclist = d, dl
 
-  def get_details(self):
-    if not (self.doc.bank_account and self.doc.from_date and self.doc.to_date):
-      msgprint("Bank Account, From Date and To Date are Mandatory")
-      return
-  
-    dl = sql("select t1.name, t1.cheque_no, t1.cheque_date, t2.debit, t2.credit, t1.posting_date, t2.against_account from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 where t2.parent = t1.name and t2.account = %s and (clearance_date is null or clearance_date = '0000-00-00' or clearance_date = '') and (t1.cheque_no is not null or t1.cheque_no != '') and t1.posting_date >= %s and t1.posting_date <= %s and t1.docstatus=1", (self.doc.bank_account, self.doc.from_date, self.doc.to_date))
-    
-    self.doc.clear_table(self.doclist, 'entries')
-    self.doc.total_amount = 0.0
+	def get_details(self):
+		if not (self.doc.bank_account and self.doc.from_date and self.doc.to_date):
+			msgprint("Bank Account, From Date and To Date are Mandatory")
+			return
+	
+		dl = sql("select t1.name, t1.cheque_no, t1.cheque_date, t2.debit, t2.credit, t1.posting_date, t2.against_account from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 where t2.parent = t1.name and t2.account = %s and (clearance_date is null or clearance_date = '0000-00-00' or clearance_date = '') and (t1.cheque_no is not null or t1.cheque_no != '') and t1.posting_date >= %s and t1.posting_date <= %s and t1.docstatus=1", (self.doc.bank_account, self.doc.from_date, self.doc.to_date))
+		
+		self.doc.clear_table(self.doclist, 'entries')
+		self.doc.total_amount = 0.0
 
-    for d in dl:
-      nl = addchild(self.doc, 'entries', 'Bank Reconciliation Detail', 1, self.doclist)
-      nl.posting_date = str(d[5])
-      nl.voucher_id = str(d[0])
-      nl.cheque_number = str(d[1])
-      nl.cheque_date = str(d[2])
-      nl.debit = flt(d[3])
-      nl.credit = flt(d[4])
-      nl.against_account = d[6]
-      self.doc.total_amount += flt(flt(d[4]) - flt(d[3]))
+		for d in dl:
+			nl = addchild(self.doc, 'entries', 'Bank Reconciliation Detail', 1, self.doclist)
+			nl.posting_date = str(d[5])
+			nl.voucher_id = str(d[0])
+			nl.cheque_number = str(d[1])
+			nl.cheque_date = str(d[2])
+			nl.debit = flt(d[3])
+			nl.credit = flt(d[4])
+			nl.against_account = d[6]
+			self.doc.total_amount += flt(flt(d[4]) - flt(d[3]))
 
-  def update_details(self):
-    for d in getlist(self.doclist, 'entries'):
-      if d.clearance_date:
-        sql("update `tabJournal Voucher` set clearance_date = %s where name=%s", (d.clearance_date, d.voucher_id))
-    msgprint("Updated")
\ No newline at end of file
+	def update_details(self):
+		for d in getlist(self.doclist, 'entries'):
+			if d.clearance_date:
+				sql("update `tabJournal Voucher` set clearance_date = %s, modified = %s where name=%s", (d.clearance_date, nowdate(), d.voucher_id))
+		msgprint("Updated")
diff --git a/accounts/doctype/cost_center/cost_center.txt b/accounts/doctype/cost_center/cost_center.txt
index ce39929..fab2dd5 100644
--- a/accounts/doctype/cost_center/cost_center.txt
+++ b/accounts/doctype/cost_center/cost_center.txt
@@ -182,6 +182,7 @@
 		'options': 'Company',
 		'permlevel': 0,
 		'reqd': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
@@ -227,7 +228,8 @@
 		'oldfieldname': 'distribution_id',
 		'oldfieldtype': 'Link',
 		'options': 'Budget Distribution',
-		'permlevel': 0
+		'permlevel': 0,
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/accounts/doctype/fiscal_year/fiscal_year.txt b/accounts/doctype/fiscal_year/fiscal_year.txt
index fe02b34..4a7f49a 100644
--- a/accounts/doctype/fiscal_year/fiscal_year.txt
+++ b/accounts/doctype/fiscal_year/fiscal_year.txt
@@ -182,7 +182,7 @@
 		'oldfieldtype': 'Link',
 		'options': 'Company',
 		'permlevel': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/accounts/doctype/gl_control/gl_control.py b/accounts/doctype/gl_control/gl_control.py
index 5ec8ecd..a346b65 100644
--- a/accounts/doctype/gl_control/gl_control.py
+++ b/accounts/doctype/gl_control/gl_control.py
@@ -12,7 +12,7 @@
 get_value = webnotes.conn.get_value
 in_transaction = webnotes.conn.in_transaction
 convert_to_lists = webnotes.conn.convert_to_lists
-	
+
 # -----------------------------------------------------------------------------------------
 from utilities.transaction_base import TransactionBase
 
@@ -30,11 +30,11 @@
 		#for r in ret:
 		#	inc = get_value('Account','Income - '+r[1], 'balance')
 		#	exp = get_value('Account','Expenses - '+r[1], 'balance')
-		#	pl[r[0]] = flt(flt(inc) - flt(exp))		
+		#	pl[r[0]] = flt(flt(inc) - flt(exp))
 		return {'cl':[r[0] for r in ret]}#, 'pl':pl}
-		
-	def get_company_currency(self,arg=''):			
-		dcc = TransactionBase().get_company_currency(arg)		
+
+	def get_company_currency(self,arg=''):
+		dcc = TransactionBase().get_company_currency(arg)
 		return dcc
 
 	# Get current balance
@@ -91,7 +91,7 @@
 
 		fy = get_defaults()['fiscal_year']
 		parent, parent_acc_name, company, type = arg.split(',')
-		
+
 		# get children account details
 		if type=='Account':
 
@@ -103,7 +103,7 @@
 
 			# remove Decimals
 			for c in cl: c['balance'] = flt(c['balance'])
-			
+
 		# get children cost center details
 		elif type=='Cost Center':
 			if parent=='Root Node':
@@ -111,7 +111,7 @@
 			else:
 				cl = sql("select name,group_or_ledger,cost_center_name from `tabCost Center` where ifnull(parent_cost_center, '')=%s and docstatus != 2 and company_name=%s order by name asc",(parent,company),as_dict=1)
 		return {'parent':parent, 'parent_acc_name':parent_acc_name, 'cl':cl}
-		
+
 	# Add a new account
 	# -----------------
 	def add_ac(self,arg):
@@ -119,14 +119,14 @@
 		ac = Document('Account')
 		for d in arg.keys():
 			ac.fields[d] = arg[d]
-		ac.old_parent = ''			
+		ac.old_parent = ''
 		ac_obj = get_obj(doc=ac)
 		ac_obj.validate()
 		ac_obj.doc.save(1)
 		ac_obj.on_update()
 
 		return ac_obj.doc.name
-	
+
 	# Add a new cost center
 	#----------------------
 	def add_cc(self,arg):
@@ -138,33 +138,33 @@
 		# map company abbr
 		other_info = sql("select company_abbr from `tabCost Center` where name='%s'"%arg['parent_cost_center'])
 		cc.company_abbr = other_info and other_info[0][0] or arg['company_abbr']
-		
+
 		cc_obj = get_obj(doc=cc)
 		cc_obj.validate()
 		cc_obj.doc.save(1)
 		cc_obj.on_update()
 
 		return cc_obj.doc.name
-		
-		
+
+
 	# Get field values from the voucher
 	#------------------------------------------
 	def get_val(self, src, d, parent=None):
-		if not src: 
+		if not src:
 			return None
 		if src.startswith('parent:'):
 			return parent.fields[src.split(':')[1]]
 		elif src.startswith('value:'):
 			return eval(src.split(':')[1])
 		elif src:
-			return d.fields.get(src)	
-			
+			return d.fields.get(src)
+
 	def check_if_in_list(self, le):
 		for e in self.entries:
 			if e.account == le.account and (cstr(e.against_voucher)==cstr(le.against_voucher)) and (cstr(e.against_voucher_type)==cstr(le.against_voucher_type)) and (cstr(e.cost_center)==cstr(le.cost_center)):
 				return [e]
 		return 0
-	
+
 	# Make a dictionary(le) for every gl entry and append to a list(self.entries)
 	#----------------------------------------------------------------------------
 	def make_single_entry(self,parent,d,le_map,cancel, merge_entries):
@@ -176,12 +176,12 @@
 			is_expense_acct = sql("select name from tabAccount where is_pl_account='Yes' and debit_or_credit='Debit' and name=%s",self.get_val(le_map['account'], d, parent))
 			if is_expense_acct and self.get_val(le_map['cost_center'], d, parent):
 				get_obj('Budget Control').check_budget([self.get_val(le_map[k], d, parent) for k in flist if k in ['account','cost_center','debit','credit','posting_date','fiscal_year','company']],cancel)
-			
+
 			# Create new GL entry object and map values
 			le = Document('GL Entry')
 			for k in flist:
 				le.fields[k] = self.get_val(le_map[k], d, parent)
-						
+
 			# if there is already an entry in this account then just add it to that entry
 			same_head = self.check_if_in_list(le)
 			if same_head and merge_entries:
@@ -190,8 +190,8 @@
 				same_head.credit = flt(same_head.credit) + flt(le.credit)
 			else:
 				self.entries.append(le)
-		
-	# Save GL Entries		 
+
+	# Save GL Entries
 	# ----------------
 	def save_entries(self, cancel, adv_adj, update_outstanding):
 		for le in self.entries:
@@ -199,7 +199,7 @@
 			if cancel or flt(le.debit) < 0 or flt(le.credit) < 0:
 				tmp=le.debit
 				le.debit, le.credit = abs(flt(le.credit)), abs(flt(tmp))
-			
+
 
 			le_obj = get_obj(doc=le)
 			# validate except on_cancel
@@ -213,11 +213,11 @@
 			# update total debit / credit
 			self.td += flt(le.debit)
 			self.tc += flt(le.credit)
-			
+
 	# Make Multiple Entries
 	# ---------------------
 	def make_gl_entries(self, doc, doclist, cancel=0, adv_adj = 0, use_mapper='', merge_entries = 1, update_outstanding='Yes'):
-		# get entries	
+		# get entries
 		le_map_list = sql("select * from `tabGL Mapper Detail` where parent = %s", use_mapper or doc.doctype, as_dict=1)
 		self.td, self.tc = 0.0, 0.0
 		for le_map in le_map_list:
@@ -228,10 +228,10 @@
 						self.make_single_entry(doc,d,le_map,cancel, merge_entries)
 			else:
 				self.make_single_entry(None,doc,le_map,cancel, merge_entries)
-				
+
 		# save entries
 		self.save_entries(cancel, adv_adj, update_outstanding)
-		
+
 		# check total debit / credit
 		# Due to old wrong entries (total debit != total credit) some voucher could be cancelled
 		if abs(self.td - self.tc) > 0.001 and not cancel:
@@ -289,7 +289,7 @@
 			add.allocate_amount = 0
 			if table_name == 'Advance Allocation Detail':
 				add.tds_amount = flt(d[4])
-	
+
 	# Clear rows which is not adjusted
 	#-------------------------------------
 	def clear_advances(self, obj,table_name,table_field_name):
@@ -297,7 +297,7 @@
 			if not flt(d.allocated_amount):
 				sql("update `tab%s` set parent = '' where name = '%s' and parent = '%s'" % (table_name, d.name, d.parent))
 				d.parent = ''
-					
+
 	# Update aginst document in journal voucher
 	#------------------------------------------
 	def update_against_document_in_jv(self, obj, table_field_name, against_document_no, against_document_doctype, account_head, dr_or_cr,doctype):
@@ -310,7 +310,7 @@
 
 				# update ref in JV Detail
 				sql("update `tabJournal Voucher Detail` set %s = '%s' where name = '%s'" % (doctype=='Payable Voucher' and 'against_voucher' or 'against_invoice', cstr(against_document_no), d.jv_detail_no))
-				
+
 				# re-submit JV
 				jv_obj = get_obj('Journal Voucher', d.journal_voucher, with_children =1)
 				get_obj(dt='GL Control').make_gl_entries(jv_obj.doc, jv_obj.doclist, cancel = 0, adv_adj =1)
@@ -319,22 +319,22 @@
 				# cancel JV
 				jv_obj = get_obj('Journal Voucher', d.journal_voucher, with_children=1)
 				get_obj(dt='GL Control').make_gl_entries(jv_obj.doc, jv_obj.doclist, cancel =1, adv_adj = 1)
-				
+
 				# add extra entries
 				self.add_extra_entry(jv_obj, d.journal_voucher, d.jv_detail_no, flt(d.allocated_amount), account_head, doctype, dr_or_cr, against_document_no)
-				
+
 				# re-submit JV
 				jv_obj = get_obj('Journal Voucher', d.journal_voucher, with_children =1)
 				get_obj(dt='GL Control').make_gl_entries(jv_obj.doc, jv_obj.doclist, cancel = 0, adv_adj = 1)
 			else:
 				msgprint("Allocation amount cannot be greater than advance amount")
 				raise Exception
-	
+
 	# Add extra row in jv detail for unadjusted amount
 	#--------------------------------------------------
 	def add_extra_entry(self,jv_obj,jv,jv_detail_no, allocate, account_head, doctype, dr_or_cr, against_document_no):
 		# get old entry details
-		
+
 		jvd = sql("select %s, cost_center, balance, against_account from `tabJournal Voucher Detail` where name = '%s'" % (dr_or_cr,jv_detail_no))
 		advance = jvd and flt(jvd[0][0]) or 0
 		balance = flt(advance) - flt(allocate)
@@ -351,7 +351,7 @@
 		add.against_account = cstr(jvd[0][3])
 		add.is_advance = 'Yes'
 		add.save(1)
-	
+
 	# check if advance entries are still valid
 	# ----------------------------------------
 	def validate_jv_entry(self, d, account_head, dr_or_cr):
@@ -406,22 +406,23 @@
 		"""
 		vl = sql("""
 			select voucher_type, voucher_no, account, sum(debit) as sum_debit, sum(credit) as sum_credit
-			from `tabGL Entry` 
+			from `tabGL Entry`
 			where is_cancelled='Yes' and creation > %s
 			group by voucher_type, voucher_no, account
 			""", after_date, as_dict=1)
-		
+
 		ac_list = []
 		for v in vl:
 			if v['sum_debit'] != 0 or v['sum_credit'] != 0:
 				ac_list.append(v['account'])
-		
-		fy_list = sql("""select name from `tabFiscal Year` 
-		where (%s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day)) 
-		or year_start_date > %s 
+
+		fy_list = sql("""select name from `tabFiscal Year`
+		where (%s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day))
+		or year_start_date > %s
 		order by year_start_date ASC""", (after_date, after_date))
 
 		for fy in fy_list:
 			fy_obj = get_obj('Fiscal Year', fy[0])
 			for a in set(ac_list):
 				fy_obj.repost(a)
+
diff --git a/accounts/doctype/gl_entry/gl_entry.txt b/accounts/doctype/gl_entry/gl_entry.txt
index 7278c4d..776cbb3 100644
--- a/accounts/doctype/gl_entry/gl_entry.txt
+++ b/accounts/doctype/gl_entry/gl_entry.txt
@@ -12,7 +12,7 @@
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1294312170',
+		'_last_update': '1309508838',
 		'autoname': 'GL.#######',
 		'colour': 'White:FFF',
 		'doctype': 'DocType',
@@ -119,7 +119,7 @@
 		'label': 'Aging Date',
 		'oldfieldname': 'aging_date',
 		'oldfieldtype': 'Date',
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -221,7 +221,7 @@
 		'oldfieldname': 'voucher_type',
 		'oldfieldtype': 'Select',
 		'options': 'Journal Voucher\nReceivable Voucher\nPayable Voucher',
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -262,7 +262,7 @@
 		'oldfieldname': 'is_cancelled',
 		'oldfieldtype': 'Select',
 		'options': 'No\nYes',
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -276,7 +276,7 @@
 		'oldfieldname': 'is_opening',
 		'oldfieldtype': 'Select',
 		'options': 'No\nYes',
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -304,7 +304,7 @@
 		'oldfieldname': 'fiscal_year',
 		'oldfieldtype': 'Select',
 		'options': 'link:Fiscal Year',
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -318,6 +318,6 @@
 		'oldfieldname': 'company',
 		'oldfieldtype': 'Link',
 		'options': 'Company',
-		'search_index': 1
+		'search_index': 0
 	}
 ]
\ No newline at end of file
diff --git a/accounts/doctype/journal_voucher/journal_voucher.js b/accounts/doctype/journal_voucher/journal_voucher.js
index dce570b..f65ee31 100644
--- a/accounts/doctype/journal_voucher/journal_voucher.js
+++ b/accounts/doctype/journal_voucher/journal_voucher.js
@@ -1,9 +1,5 @@
 cur_frm.cscript.onload = function(doc, cdt, cdn) {
   var cp = locals['Control Panel']['Control Panel'];
-  if(doc.__islocal){
-    doc.clearance_date ='';
-    refresh_field('clearance_date');
-  }
   
   if (!doc.voucher_date) doc.voucher_date = dateutil.obj_to_str(new Date());
 
@@ -155,4 +151,4 @@
     report.dt.run();
   }
   loadreport('GL Entry','General Ledger', callback);
-}
\ No newline at end of file
+}
diff --git a/accounts/doctype/journal_voucher/journal_voucher.txt b/accounts/doctype/journal_voucher/journal_voucher.txt
index 43ec614..104d3d1 100644
--- a/accounts/doctype/journal_voucher/journal_voucher.txt
+++ b/accounts/doctype/journal_voucher/journal_voucher.txt
@@ -5,23 +5,14 @@
 	{
 		'creation': '2010-08-08 17:09:06',
 		'docstatus': 0,
-		'modified': '2011-04-06 14:41:47',
+		'modified': '2011-07-28 15:28:12',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
 
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Journal Voucher',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
 	# These values are common for all DocType
 	{
-		'_last_update': '1305714002',
+		'_last_update': '1311251040',
 		'colour': 'White:FFF',
 		'doctype': 'DocType',
 		'module': 'Accounts',
@@ -32,15 +23,15 @@
 		'show_in_menu': 0,
 		'subject': ' ',
 		'tag_fields': 'voucher_type',
-		'version': 307
+		'version': 309
 	},
 
-	# These values are common for all DocFormat
+	# These values are common for all DocField
 	{
-		'doctype': 'DocFormat',
+		'doctype': 'DocField',
 		'name': '__common__',
 		'parent': 'Journal Voucher',
-		'parentfield': 'formats',
+		'parentfield': 'fields',
 		'parenttype': 'DocType'
 	},
 
@@ -112,20 +103,6 @@
 		'write': 0
 	},
 
-	# DocFormat
-	{
-		'doctype': 'DocFormat',
-		'format': 'Payment Receipt Voucher',
-		'idx': 1
-	},
-
-	# DocFormat
-	{
-		'doctype': 'DocFormat',
-		'format': 'Cheque Printing Format',
-		'idx': 2
-	},
-
 	# DocField
 	{
 		'doctype': 'DocField',
@@ -167,7 +144,7 @@
 		'label': 'Voucher Type',
 		'oldfieldname': 'voucher_type',
 		'oldfieldtype': 'Select',
-		'options': '\nJournal Entry\nBank Voucher\nCash Voucher\nCredit Card Voucher\nDebit Note\nCredit Note\nContra Voucher\nExcise Voucher\nWrite Off Voucher',
+		'options': '\nJournal Entry\nBank Voucher\nCash Voucher\nCredit Card Voucher\nDebit Note\nCredit Note\nContra Voucher\nExcise Voucher\nWrite Off Voucher\nLoan Receipt',
 		'permlevel': 0,
 		'print_hide': 0,
 		'search_index': 1
diff --git a/accounts/doctype/journal_voucher_detail/journal_voucher_detail.txt b/accounts/doctype/journal_voucher_detail/journal_voucher_detail.txt
index 39da084..4a350c2 100644
--- a/accounts/doctype/journal_voucher_detail/journal_voucher_detail.txt
+++ b/accounts/doctype/journal_voucher_detail/journal_voucher_detail.txt
@@ -69,7 +69,7 @@
 		'oldfieldtype': 'Link',
 		'options': 'Cost Center',
 		'permlevel': 0,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '180px'
 	},
 
diff --git a/accounts/doctype/lease_agreement/__init__.py b/accounts/doctype/lease_agreement/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/lease_agreement/__init__.py
diff --git a/accounts/doctype/lease_agreement/lease_agreement.js b/accounts/doctype/lease_agreement/lease_agreement.js
new file mode 100644
index 0000000..8ffd522
--- /dev/null
+++ b/accounts/doctype/lease_agreement/lease_agreement.js
@@ -0,0 +1,78 @@
+$.extend(cur_frm.cscript, {
+	Generate: function(doc, dt, dn) {
+		if(doc.installment_amount==''){
+			msgprint('Set Installment Amount before generating schedule');
+			return;
+		}
+		if(doc.no_of_installments==''){
+			msgprint('Set Number of Installments before generating schedule');
+			return;
+		}
+		if(doc.start_date==''){
+			msgprint('Set Start Date before generating schedule');
+			return;
+		}
+		cur_frm.cscript.clear_installments(doc);
+		tot=0;i=0;
+		while(tot<flt(doc.invoice_amount)-flt(doc.down_payment)){
+				d = LocalDB.add_child(doc, 'Lease Installment', 'installments');
+				d.amount = flt(doc.installment_amount) < flt(doc.invoice_amount)-flt(doc.down_payment)-tot ? flt(doc.installment_amount) : flt(doc.invoice_amount)-flt(doc.down_payment)-tot
+				d.due_date = dateutil.add_months(doc.start_date, i+1);
+				tot += flt(doc.installment_amount)
+				i++;
+		}
+		cur_frm.refresh();
+	},
+	refresh: function(doc) {
+		cur_frm.cscript.hide_show_buttons(doc);
+	},
+	hide_show_buttons: function(doc) {
+		if(doc.docstatus==0) {
+			hide_field('Installment Reciept'); show_field('Generate');
+		} else if (doc.docstatus==1) {
+			show_field('Installment Reciept');hide_field('Generate');
+		}
+	},
+	clear_installments: function(doc) {
+		$.each(getchildren('Lease Installment', doc.name, 'installments', 'Lease Agreement'),
+			function(i, d) {
+				LocalDB.delete_doc('Lease Installment', d.name);
+			}
+		)
+	},
+	no_of_installments: function(doc)
+	{
+		if(flt(doc.no_of_installments)!=0) {
+			doc.installment_amount = (flt(doc.invoice_amount)- flt(doc.down_payment))/flt(doc.no_of_installments);
+			refresh_field('installment_amount');
+		}
+	},
+	'Installment Reciept': function(doc, dt, dn) {
+		var d = new wn.widgets.Dialog({
+			width: 500,
+			title: 'Add a new payment installment',
+			fields: [
+				{fieldtype:'Data', label:'Cheque Number', fieldname:'cheque_number', reqd:1},
+				{fieldtype:'Date', label:'Cheque Date', fieldname:'cheque_date', reqd:1},
+				{fieldtype:'Link', label:'Bank Account', fieldname:'bank_account', reqd:1, options:'Account'},
+				{fieldtype:'Button', label:'Update',fieldname:'update'}
+			]
+		})
+		d.show();
+		d.fields_dict.update.input.onclick = function() {
+			var data = d.get_values();
+
+			if(data) {
+				$c_obj(make_doclist(dt,dn),'lease_installment_post',data,function(){cur_frm.refresh(); d.hide();});
+			}
+		}
+	}
+})
+
+
+cur_frm.add_fetch('invoice','grand_total','invoice_amount');
+
+cur_frm.fields_dict.invoice.get_query=function(doc){
+
+	return "SELECT tv.name FROM `tabReceivable Voucher` tv WHERE debit_to='"+doc.account+"' and  tv.%(key)s like '%s' ORDER BY tv.name LIMIT 50"
+}
\ No newline at end of file
diff --git a/accounts/doctype/lease_agreement/lease_agreement.py b/accounts/doctype/lease_agreement/lease_agreement.py
new file mode 100644
index 0000000..dd63c2e
--- /dev/null
+++ b/accounts/doctype/lease_agreement/lease_agreement.py
@@ -0,0 +1,37 @@
+import webnotes
+from webnotes.model.doc import make_autoname, Document, addchild
+from webnotes import msgprint
+from webnotes.utils import get_defaults
+import json
+from accounts.utils import post_jv
+sql = webnotes.conn.sql
+
+class DocType:
+	def __init__(self, doc, doclist):
+		self.doc, self.doclist = doc, doclist
+
+	def autoname(self):
+		"""
+			Create Lease Id using naming_series pattern
+		"""
+		self.doc.name = make_autoname(self.doc.naming_series+ '.#####')
+
+	def lease_installment_post(self, args):
+		"""
+			Posts the Installment receipt into Journal Voucher
+		"""
+		next_inst = sql("select amount,name from `tabLease Installment` where parent=%s and ifnull(cheque_number,'')='' order by due_date limit 1",self.doc.name)
+
+		data = json.loads(args)
+		data['voucher_type']='Lease Receipt'
+		data['naming_series']='JV'
+		data['amount']=next_inst[0][0]
+		data['debit_account']=data.get('bank_account')
+		data['credit_account']=self.doc.account
+		data['fiscal_year']=get_defaults()['fiscal_year']
+		data['company']=get_defaults()['company']
+		jv_name=post_jv(data)
+
+		sql("update `tabLease Installment` set cheque_number=%s, cheque_date=%s, jv_number=%s where name=%s",(data.get('cheque_number'),data.get('cheque_date'),jv_name,next_inst[0][1]))
+
+		self.doclist = [Document(d.doctype, d.name) for d in self.doclist]
diff --git a/accounts/doctype/lease_agreement/lease_agreement.txt b/accounts/doctype/lease_agreement/lease_agreement.txt
new file mode 100644
index 0000000..c221020
--- /dev/null
+++ b/accounts/doctype/lease_agreement/lease_agreement.txt
@@ -0,0 +1,310 @@
+# DocType, Lease Agreement
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2011-07-22 17:47:57',
+		'docstatus': 0,
+		'modified': '2011-07-27 15:33:55',
+		'modified_by': 'Administrator',
+		'owner': 'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'_last_update': '1311555967',
+		'colour': 'White:FFF',
+		'doctype': 'DocType',
+		'module': 'Accounts',
+		'name': '__common__',
+		'section_style': 'Simple',
+		'show_in_menu': 0,
+		'version': 21
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': 'DocField',
+		'name': '__common__',
+		'parent': 'Lease Agreement',
+		'parentfield': 'fields',
+		'parenttype': 'DocType'
+	},
+
+	# These values are common for all DocPerm
+	{
+		'doctype': 'DocPerm',
+		'name': '__common__',
+		'parent': 'Lease Agreement',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'read': 1
+	},
+
+	# DocType, Lease Agreement
+	{
+		'doctype': 'DocType',
+		'name': 'Lease Agreement'
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': 'DocPerm',
+		'idx': 1,
+		'permlevel': 0,
+		'role': 'Accounts User',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': 'DocPerm',
+		'idx': 2,
+		'permlevel': 1,
+		'role': 'Accounts User'
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': 'DocPerm',
+		'idx': 3,
+		'permlevel': 0,
+		'role': 'Accounts Manager',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': 'DocPerm',
+		'idx': 4,
+		'permlevel': 1,
+		'role': 'Accounts Manager'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'idx': 1,
+		'label': 'Naming Series',
+		'options': '\nLA',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldtype': 'Section Break',
+		'idx': 2,
+		'label': 'Lessee Info.',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'account',
+		'fieldtype': 'Link',
+		'idx': 3,
+		'label': 'Lessee Account',
+		'options': 'Account',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'lessee_father',
+		'fieldtype': 'Data',
+		'idx': 4,
+		'label': 'Lessee Father',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'lessee_nic',
+		'fieldtype': 'Data',
+		'idx': 5,
+		'label': 'Lessee NIC',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'lessee_contact',
+		'fieldtype': 'Data',
+		'idx': 6,
+		'label': 'Lessee Contact',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'lessee_address',
+		'fieldtype': 'Text',
+		'idx': 7,
+		'label': 'Lessee Address',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldtype': 'Section Break',
+		'idx': 8,
+		'label': 'Vehicle Info.',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'model_no',
+		'fieldtype': 'Data',
+		'idx': 9,
+		'label': 'Model No',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'engine_no',
+		'fieldtype': 'Data',
+		'idx': 10,
+		'label': 'Engine No',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'chassis_no',
+		'fieldtype': 'Data',
+		'idx': 11,
+		'label': 'Chassis No',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldtype': 'Section Break',
+		'idx': 12,
+		'label': 'Invoice and Payment Info.',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'doctype': 'DocField',
+		'fieldname': 'invoice',
+		'fieldtype': 'Link',
+		'idx': 13,
+		'label': 'Invoice',
+		'options': 'Receivable Voucher',
+		'permlevel': 0,
+		'reqd': 1,
+		'trigger': 'Client'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'invoice_amount',
+		'fieldtype': 'Currency',
+		'idx': 14,
+		'label': 'Invoice Amount',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'down_payment',
+		'fieldtype': 'Currency',
+		'idx': 15,
+		'label': 'Down Payment',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'start_date',
+		'fieldtype': 'Date',
+		'idx': 16,
+		'label': 'Start Date',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'no_of_installments',
+		'fieldtype': 'Int',
+		'idx': 17,
+		'label': 'No of Installments',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'installment_amount',
+		'fieldtype': 'Currency',
+		'idx': 18,
+		'label': 'Installment Amount',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'doctype': 'DocField',
+		'fieldtype': 'Button',
+		'idx': 19,
+		'label': 'Generate',
+		'permlevel': 0,
+		'trigger': 'Client'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'installments',
+		'fieldtype': 'Table',
+		'idx': 20,
+		'label': 'Installments',
+		'options': 'Lease Installment',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'doctype': 'DocField',
+		'fieldtype': 'Button',
+		'idx': 21,
+		'label': 'Installment Reciept',
+		'permlevel': 0
+	}
+]
\ No newline at end of file
diff --git a/accounts/doctype/lease_installment/__init__.py b/accounts/doctype/lease_installment/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/lease_installment/__init__.py
diff --git a/accounts/doctype/lease_installment/lease_installment.txt b/accounts/doctype/lease_installment/lease_installment.txt
new file mode 100644
index 0000000..2434a78
--- /dev/null
+++ b/accounts/doctype/lease_installment/lease_installment.txt
@@ -0,0 +1,91 @@
+# DocType, Lease Installment
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2011-07-22 17:49:33',
+		'docstatus': 0,
+		'modified': '2011-07-22 17:49:33',
+		'modified_by': 'Administrator',
+		'owner': 'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': 'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': 'Accounts',
+		'name': '__common__',
+		'section_style': 'Simple',
+		'show_in_menu': 0,
+		'version': 5
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': 'DocField',
+		'name': '__common__',
+		'parent': 'Lease Installment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType'
+	},
+
+	# DocType, Lease Installment
+	{
+		'doctype': 'DocType',
+		'name': 'Lease Installment'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'amount',
+		'fieldtype': 'Currency',
+		'idx': 1,
+		'label': 'Amount',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'due_date',
+		'fieldtype': 'Date',
+		'idx': 2,
+		'label': 'Due Date',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'cheque_number',
+		'fieldtype': 'Data',
+		'idx': 3,
+		'label': 'Cheque Number',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'cheque_date',
+		'fieldtype': 'Date',
+		'idx': 4,
+		'label': 'Cheque Date',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'jv_number',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'idx': 5,
+		'label': 'JV Number',
+		'options': 'Journal Voucher',
+		'permlevel': 1
+	}
+]
\ No newline at end of file
diff --git a/accounts/doctype/loan/__init__.py b/accounts/doctype/loan/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/loan/__init__.py
diff --git a/accounts/doctype/loan/loan.js b/accounts/doctype/loan/loan.js
new file mode 100644
index 0000000..1851a84
--- /dev/null
+++ b/accounts/doctype/loan/loan.js
@@ -0,0 +1,54 @@
+$.extend(cur_frm.cscript, {
+	Generate: function(doc, dt, dn) {
+		cur_frm.cscript.clear_installments(doc);
+		for(var i=0; i< doc.no_of_installments; i++) {
+			d = LocalDB.add_child(doc, 'Loan Installment', 'installments');
+			d.amount = doc.loan_amount / doc.no_of_installments;
+			d.due_date = dateutil.add_months(doc.start_date, i+1);
+		}
+		cur_frm.refresh();
+	},
+/*	submit:function(doc){
+		data=doc.get_values();
+
+		data['']=
+		$c_obj(make_doclist(dt,dn),'loan_post',data,function(){});
+	},*/
+	refresh: function(doc) {
+		cur_frm.cscript.hide_show_buttons(doc);
+	},
+	hide_show_buttons: function(doc) {
+		if(doc.docstatus==0) {
+			hide_field('Installment Reciept'); show_field('Generate');
+		} else if (doc.docstatus==1) {
+			show_field('Installment Reciept');hide_field('Generate');
+		}
+	},
+	clear_installments: function(doc) {
+		$.each(getchildren('Loan Installment', doc.name, 'installments', 'Loan'),
+			function(i, d) {
+				LocalDB.delete_doc('Loan Installment', d.name);
+			}
+		)
+	},
+	'Installment Reciept': function(doc, dt, dn) {
+		var d = new wn.widgets.Dialog({
+			width: 500,
+			title: 'Add a new payment installment',
+			fields: [
+				{fieldtype:'Data', label:'Cheque Number', fieldname:'cheque_number', reqd:1},
+				{fieldtype:'Date', label:'Cheque Date', fieldname:'cheque_date', reqd:1},
+				{fieldtype:'Link', label:'Bank Account', fieldname:'bank_account', reqd:1, options:'Account'},
+				{fieldtype:'Button', label:'Update',fieldname:'update'}
+			]
+		})
+		d.show();
+		d.fields_dict.update.input.onclick = function() {
+			var data = d.get_values();
+
+			if(data) {
+				$c_obj(make_doclist(dt,dn),'loan_installment_post',data,function(){cur_frm.refresh(); d.hide();});
+			}
+		}
+	}
+})
diff --git a/accounts/doctype/loan/loan.py b/accounts/doctype/loan/loan.py
new file mode 100644
index 0000000..9f0bcb5
--- /dev/null
+++ b/accounts/doctype/loan/loan.py
@@ -0,0 +1,48 @@
+import webnotes
+from webnotes.model.doc import make_autoname, Document, addchild
+from webnotes import msgprint
+from webnotes.utils import get_defaults
+import json
+from accounts.utils import post_jv
+sql = webnotes.conn.sql
+
+class DocType:
+	def __init__(self, doc, doclist):
+		self.doc, self.doclist = doc, doclist
+
+	def autoname(self):
+		"""
+			Create Loan Id using naming_series pattern
+		"""
+		self.doc.name = make_autoname(self.doc.naming_series+ '.#####')
+
+	def loan_post(self):
+		data['voucher_type']='Loan Issue'
+		data['naming_series']='JV'
+		data['fiscal_year'] = get_defaults()['fiscal_year'] # To be modified to take care
+		data['company'] = get_defaults()['company']
+		data['debit_account'] = self.doc['receivable_account']
+		data['credit_account'] = self.doc['account']
+		data['amount'] = self.doc.loan_amount
+		jv_name=post_jv(data)
+
+	def loan_installment_post(self, args):
+		"""
+			Posts the loan receipt into Journal Voucher
+		"""
+		next_inst = sql("select amount,name from `tabLoan Installment` where parent=%s and ifnull(cheque_number,'')='' order by due_date limit 1",self.doc.name)
+
+		data = json.loads(args)
+		data['voucher_type']='Loan Receipt'
+		data['naming_series']='JV'
+		data['amount']=next_inst[0][0]
+		data['debit_account']=data.get('bank_account')
+		data['credit_account']=self.doc.account
+		data['fiscal_year']=get_defaults()['fiscal_year']
+		data['company']=get_defaults()['company']
+		jv_name=post_jv(data)
+
+		sql("update `tabLoan Installment` set cheque_number=%s, cheque_date=%s, jv_number=%s where name=%s",(data.get('cheque_number'),data.get('cheque_date'),jv_name,next_inst[0][1]))
+
+		self.doclist = [Document(d.doctype, d.name) for d in self.doclist]
+
diff --git a/accounts/doctype/loan/loan.txt b/accounts/doctype/loan/loan.txt
new file mode 100644
index 0000000..001e1d3
--- /dev/null
+++ b/accounts/doctype/loan/loan.txt
@@ -0,0 +1,172 @@
+# DocType, Loan
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2011-07-15 10:35:26',
+		'docstatus': 0,
+		'modified': '2011-07-18 12:12:19',
+		'modified_by': 'Administrator',
+		'owner': 'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'_last_update': '1310963215',
+		'colour': 'White:FFF',
+		'doctype': 'DocType',
+		'module': 'Accounts',
+		'name': '__common__',
+		'section_style': 'Simple',
+		'show_in_menu': 0,
+		'version': 15
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': 'DocField',
+		'name': '__common__',
+		'parent': 'Loan',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0
+	},
+
+	# These values are common for all DocPerm
+	{
+		'doctype': 'DocPerm',
+		'name': '__common__',
+		'parent': 'Loan',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'read': 1,
+		'role': 'Accounts User'
+	},
+
+	# DocType, Loan
+	{
+		'doctype': 'DocType',
+		'name': 'Loan'
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': 'DocPerm',
+		'idx': 1,
+		'permlevel': 0,
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': 'DocPerm',
+		'idx': 2,
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'naming_series',
+		'fieldtype': 'Select',
+		'idx': 1,
+		'label': 'Naming Series',
+		'options': '\nLOAN',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'account',
+		'fieldtype': 'Link',
+		'idx': 2,
+		'label': 'Account',
+		'options': 'Account',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'receivable_account',
+		'fieldtype': 'Link',
+		'idx': 3,
+		'label': 'Receivable Account',
+		'options': 'Account'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'invoice',
+		'fieldtype': 'Link',
+		'idx': 4,
+		'label': 'Invoice',
+		'options': 'Receivable Voucher',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'loan_amount',
+		'fieldtype': 'Currency',
+		'idx': 5,
+		'label': 'Loan Amount',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'start_date',
+		'fieldtype': 'Date',
+		'idx': 6,
+		'label': 'Start Date',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'no_of_installments',
+		'fieldtype': 'Int',
+		'idx': 7,
+		'label': 'No of Installments',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'doctype': 'DocField',
+		'fieldtype': 'Button',
+		'idx': 8,
+		'label': 'Generate',
+		'trigger': 'Client'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'installments',
+		'fieldtype': 'Table',
+		'idx': 9,
+		'label': 'Installments',
+		'options': 'Loan Installment'
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'colour': 'White:FFF',
+		'doctype': 'DocField',
+		'fieldtype': 'Button',
+		'idx': 10,
+		'label': 'Installment Reciept'
+	}
+]
\ No newline at end of file
diff --git a/accounts/doctype/loan/test_loan.py b/accounts/doctype/loan/test_loan.py
new file mode 100644
index 0000000..4e72559
--- /dev/null
+++ b/accounts/doctype/loan/test_loan.py
@@ -0,0 +1,17 @@
+import unittest
+import webnotes
+from webnotes.model.code import get_obj
+
+class TestScheduleGeneartion(unittest.TestCase):
+	def setUp(self):
+		webnotes.conn.begin()
+		# create a mock loan
+		self.loan = get_obj('Loan', 'LOAN00001')
+		
+	def test_generation(self):
+		"test the genaration of loan installments"
+		self.loan.generate()
+		self.assertEqual(self.loan.get_installment_total(), self.loan.doc.loan_amount)
+		
+	def tearDown(self):
+		webnotes.conn.rollback()
diff --git a/accounts/doctype/loan_installment/__init__.py b/accounts/doctype/loan_installment/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/doctype/loan_installment/__init__.py
diff --git a/accounts/doctype/loan_installment/loan_installment.txt b/accounts/doctype/loan_installment/loan_installment.txt
new file mode 100644
index 0000000..f729e34
--- /dev/null
+++ b/accounts/doctype/loan_installment/loan_installment.txt
@@ -0,0 +1,111 @@
+# DocType, Loan Installment
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2011-07-15 10:36:42',
+		'docstatus': 0,
+		'modified': '2011-07-15 15:48:34',
+		'modified_by': 'Administrator',
+		'owner': 'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': 'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': 'Accounts',
+		'name': '__common__',
+		'section_style': 'Simple',
+		'show_in_menu': 0,
+		'version': 4
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': 'DocField',
+		'name': '__common__',
+		'parent': 'Loan Installment',
+		'parentfield': 'fields',
+		'parenttype': 'DocType'
+	},
+
+	# DocType, Loan Installment
+	{
+		'doctype': 'DocType',
+		'name': 'Loan Installment'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'amount',
+		'fieldtype': 'Currency',
+		'idx': 1,
+		'label': 'Amount',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'due_date',
+		'fieldtype': 'Date',
+		'idx': 2,
+		'label': 'Due Date',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'cheque_number',
+		'fieldtype': 'Data',
+		'idx': 3,
+		'label': 'Cheque Number',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'cheque_date',
+		'fieldtype': 'Date',
+		'idx': 4,
+		'label': 'Cheque Date',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'deposit_date',
+		'fieldtype': 'Date',
+		'idx': 5,
+		'label': 'Deposit Date',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'realized_date',
+		'fieldtype': 'Date',
+		'idx': 6,
+		'label': 'Realized Date',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'jv_number',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'idx': 7,
+		'label': 'JV Number',
+		'options': 'Journal Voucher',
+		'permlevel': 1
+	}
+]
\ No newline at end of file
diff --git a/accounts/doctype/payable_voucher/payable_voucher.txt b/accounts/doctype/payable_voucher/payable_voucher.txt
index c330e8d..c77db19 100644
--- a/accounts/doctype/payable_voucher/payable_voucher.txt
+++ b/accounts/doctype/payable_voucher/payable_voucher.txt
@@ -12,7 +12,7 @@
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1308741898',
+		'_last_update': '1309508838',
 		'colour': 'White:FFF',
 		'doctype': 'DocType',
 		'module': 'Accounts',
@@ -221,6 +221,7 @@
 		'options': 'Supplier',
 		'permlevel': 0,
 		'print_hide': 1,
+		'search_index': 1,
 		'trigger': 'Client'
 	},
 
@@ -326,7 +327,7 @@
 		'oldfieldtype': 'Date',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -342,7 +343,7 @@
 		'oldfieldtype': 'Date',
 		'permlevel': 0,
 		'print_hide': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -378,7 +379,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -394,7 +395,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -690,7 +691,7 @@
 		'options': 'No\nYes',
 		'permlevel': 0,
 		'print_hide': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
@@ -768,7 +769,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -785,7 +786,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -1084,7 +1085,7 @@
 		'oldfieldtype': 'Currency',
 		'permlevel': 1,
 		'print_hide': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/accounts/doctype/period_closing_voucher/period_closing_voucher.txt b/accounts/doctype/period_closing_voucher/period_closing_voucher.txt
index e5bb1a2..5850887 100644
--- a/accounts/doctype/period_closing_voucher/period_closing_voucher.txt
+++ b/accounts/doctype/period_closing_voucher/period_closing_voucher.txt
@@ -147,7 +147,8 @@
 		'oldfieldtype': 'Select',
 		'options': 'link:Fiscal Year',
 		'permlevel': 0,
-		'reqd': 1
+		'reqd': 1,
+		'search_index': 1
 	},
 
 	# DocField
diff --git a/accounts/doctype/pos_setting/pos_setting.txt b/accounts/doctype/pos_setting/pos_setting.txt
index 7b1b9fa..3809d67 100755
--- a/accounts/doctype/pos_setting/pos_setting.txt
+++ b/accounts/doctype/pos_setting/pos_setting.txt
@@ -172,7 +172,8 @@
 		'oldfieldname': 'company',
 		'oldfieldtype': 'Link',
 		'options': 'Company',
-		'reqd': 1
+		'reqd': 1,
+		'search_index': 0
 	},
 
 	# DocField
@@ -193,7 +194,8 @@
 		'oldfieldname': 'customer_account',
 		'oldfieldtype': 'Link',
 		'options': 'Account',
-		'reqd': 0
+		'reqd': 0,
+		'search_index': 0
 	},
 
 	# DocField
@@ -206,7 +208,8 @@
 		'oldfieldname': 'cash_bank_account',
 		'oldfieldtype': 'Link',
 		'options': 'Account',
-		'reqd': 1
+		'reqd': 1,
+		'search_index': 0
 	},
 
 	# DocField
@@ -219,7 +222,8 @@
 		'oldfieldname': 'income_account',
 		'oldfieldtype': 'Link',
 		'options': 'Account',
-		'reqd': 1
+		'reqd': 1,
+		'search_index': 0
 	},
 
 	# DocField
@@ -232,7 +236,8 @@
 		'oldfieldname': 'warehouse',
 		'oldfieldtype': 'Link',
 		'options': 'Warehouse',
-		'reqd': 1
+		'reqd': 1,
+		'search_index': 0
 	},
 
 	# DocField
@@ -245,7 +250,8 @@
 		'oldfieldname': 'cost_center',
 		'oldfieldtype': 'Link',
 		'options': 'Cost Center',
-		'reqd': 1
+		'reqd': 1,
+		'search_index': 0
 	},
 
 	# DocField
@@ -257,7 +263,8 @@
 		'label': 'Charge',
 		'oldfieldname': 'charge',
 		'oldfieldtype': 'Link',
-		'options': 'Other Charges'
+		'options': 'Other Charges',
+		'search_index': 0
 	},
 
 	# DocField
@@ -282,7 +289,8 @@
 		'label': 'Terms',
 		'oldfieldname': 'tc_name',
 		'oldfieldtype': 'Link',
-		'options': 'Term'
+		'options': 'Term',
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/accounts/doctype/purchase_tax_detail/purchase_tax_detail.txt b/accounts/doctype/purchase_tax_detail/purchase_tax_detail.txt
index 583a97f..ed67ba2 100644
--- a/accounts/doctype/purchase_tax_detail/purchase_tax_detail.txt
+++ b/accounts/doctype/purchase_tax_detail/purchase_tax_detail.txt
@@ -151,6 +151,7 @@
 		'oldfieldtype': 'Link',
 		'options': 'Cost Center',
 		'permlevel': 0,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
diff --git a/accounts/doctype/pv_detail/pv_detail.txt b/accounts/doctype/pv_detail/pv_detail.txt
index 0243d71..1e05160 100644
--- a/accounts/doctype/pv_detail/pv_detail.txt
+++ b/accounts/doctype/pv_detail/pv_detail.txt
@@ -111,7 +111,7 @@
 		'options': 'Item Group',
 		'permlevel': 1,
 		'print_hide': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/accounts/doctype/receivable_voucher/receivable_voucher.txt b/accounts/doctype/receivable_voucher/receivable_voucher.txt
index bcad9cc..f2f9eaf 100644
--- a/accounts/doctype/receivable_voucher/receivable_voucher.txt
+++ b/accounts/doctype/receivable_voucher/receivable_voucher.txt
@@ -12,7 +12,7 @@
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1308741898',
+		'_last_update': '1309508839',
 		'change_log': '1. Change in pull_details method dt.-26-06-2009',
 		'colour': 'White:FFF',
 		'doctype': 'DocType',
@@ -323,7 +323,7 @@
 		'oldfieldtype': 'Date',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -342,7 +342,7 @@
 		'oldfieldtype': 'Date',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -433,7 +433,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -903,7 +903,7 @@
 		'options': 'No\nYes',
 		'permlevel': 0,
 		'print_hide': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
@@ -1027,7 +1027,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -1045,7 +1045,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -1116,7 +1116,7 @@
 		'permlevel': 1,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/accounts/doctype/rv_detail/rv_detail.txt b/accounts/doctype/rv_detail/rv_detail.txt
index 6950ca9..94a4583 100644
--- a/accounts/doctype/rv_detail/rv_detail.txt
+++ b/accounts/doctype/rv_detail/rv_detail.txt
@@ -243,6 +243,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
+		'search_index': 1,
 		'trigger': 'Client',
 		'width': '120px'
 	},
@@ -262,6 +263,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 0,
+		'search_index': 1,
 		'trigger': 'Client',
 		'width': '120px'
 	},
diff --git a/accounts/doctype/rv_tax_detail/rv_tax_detail.txt b/accounts/doctype/rv_tax_detail/rv_tax_detail.txt
index 94846cb..a9326a0 100644
--- a/accounts/doctype/rv_tax_detail/rv_tax_detail.txt
+++ b/accounts/doctype/rv_tax_detail/rv_tax_detail.txt
@@ -80,7 +80,8 @@
 		'oldfieldname': 'cost_center_other_charges',
 		'oldfieldtype': 'Link',
 		'options': 'Cost Center',
-		'permlevel': 0
+		'permlevel': 0,
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/accounts/doctype/tds_category_account/tds_category_account.txt b/accounts/doctype/tds_category_account/tds_category_account.txt
index 88ee39a..6f6022b 100644
--- a/accounts/doctype/tds_category_account/tds_category_account.txt
+++ b/accounts/doctype/tds_category_account/tds_category_account.txt
@@ -51,7 +51,7 @@
 		'label': 'Company',
 		'oldfieldname': 'company',
 		'options': 'Company',
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/accounts/doctype/tds_payment/tds_payment.txt b/accounts/doctype/tds_payment/tds_payment.txt
index abd4b0c..8d0edfb 100644
--- a/accounts/doctype/tds_payment/tds_payment.txt
+++ b/accounts/doctype/tds_payment/tds_payment.txt
@@ -207,7 +207,7 @@
 		'options': 'link:Fiscal Year',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -269,7 +269,7 @@
 		'oldfieldtype': 'Link',
 		'options': 'Company',
 		'permlevel': 0,
-		'search_index': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
diff --git a/accounts/search_criteria/accounts_payable/accounts_payable.py b/accounts/search_criteria/accounts_payable/accounts_payable.py
index 53fff08..8c07b68 100644
--- a/accounts/search_criteria/accounts_payable/accounts_payable.py
+++ b/accounts/search_criteria/accounts_payable/accounts_payable.py
@@ -2,134 +2,145 @@
 # ------------------------------------------------------------------
 
 if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
-  msgprint("Please select From Posting Date and To Posting Date ")
-  raise Exception
+	msgprint("Please select From Posting Date and To Posting Date ")
+	raise Exception
 else:
-  from_date = filter_values.get('posting_date')
-  to_date = filter_values.get('posting_date1')
+	from_date = filter_values.get('posting_date')
+	to_date = filter_values.get('posting_date1')
 
 if not filter_values['range_1'] or not filter_values['range_2'] or not filter_values['range_3'] or not filter_values['range_4']:
-  msgprint("Please select aging ranges in no of days in 'More Filters' ")
-  raise Exception
+	msgprint("Please select aging ranges in no of days in 'More Filters' ")
+	raise Exception
 
 # validate Range
 range_list = ['range_1','range_2','range_3','range_4']
 for r in range(len(range_list)-1):
-  if not cint(filter_values[range_list[r]]) < cint(filter_values[range_list[r + 1]]):
-    msgprint("Range %s should be less than Range %s." % (cstr(r+1),cstr(r+2)))
-    raise Exception
+	if not cint(filter_values[range_list[r]]) < cint(filter_values[range_list[r + 1]]):
+		msgprint("Range %s should be less than Range %s." % (cstr(r+1),cstr(r+2)))
+		raise Exception
 
-  
+	
 # Add columns
 # ------------------------------------------------------------------
 data = [['Aging Date','Date','80px',''],
-        ['Transaction Date','Date','80px',''],
-        ['Account','Data','120px',''],
-        ['Against Voucher Type','Data','120px',''],
-        ['Against Voucher','Data','120px',''],
-        ['Voucher Type','Data','120px',''],
-        ['Voucher No','Data','120px',''],
-        ['Remarks','Data','160px',''],
-        ['Supplier Type', 'Data', '80px', ''],
-        ['Due Date', 'Data', '80px', ''],
-        ['Bill No','Data','80px',''],
-        ['Bill Date','Data','80px',''],
-        ['Opening Amt','Currency','120px',''],
-        ['Outstanding Amt','Currency','120px',''],
-        ['Age (Days)', 'Currency', '150px', ''],
-        ['0-'+cstr(filter_values['range_1']),'Currency','100px',''],
-        [cstr(cint(filter_values['range_1']) + 1)+ '-' +cstr(filter_values['range_2']),'Currency','100px',''],
-        [cstr(cint(filter_values['range_2']) + 1)+ '-' +cstr(filter_values['range_3']),'Currency','100px',''],
-        [cstr(cint(filter_values['range_3']) + 1)+ '-' +cstr(filter_values['range_4']),'Currency','100px',''],
-        [cstr(filter_values['range_4']) + '-Above','Currency','100px','']]
-        
+				['Transaction Date','Date','80px',''],
+				['Account','Data','120px',''],
+				['Against Voucher Type','Data','120px',''],
+				['Against Voucher','Data','120px',''],
+				['Voucher Type','Data','120px',''],
+				['Voucher No','Data','120px',''],
+				['Remarks','Data','160px',''],
+				['Supplier Type', 'Data', '80px', ''],
+				['Due Date', 'Data', '80px', ''],
+				['Bill No','Data','80px',''],
+				['Bill Date','Data','80px',''],
+				['Opening Amt','Currency','120px',''],
+				['Outstanding Amt','Currency','120px',''],
+				['Age (Days)', 'Currency', '150px', ''],
+				['0-'+cstr(filter_values['range_1']),'Currency','100px',''],
+				[cstr(cint(filter_values['range_1']) + 1)+ '-' +cstr(filter_values['range_2']),'Currency','100px',''],
+				[cstr(cint(filter_values['range_2']) + 1)+ '-' +cstr(filter_values['range_3']),'Currency','100px',''],
+				[cstr(cint(filter_values['range_3']) + 1)+ '-' +cstr(filter_values['range_4']),'Currency','100px',''],
+				[cstr(filter_values['range_4']) + '-Above','Currency','100px','']]
+				
 
 for d in data:
-  colnames.append(d[0])
-  coltypes.append(d[1])
-  colwidths.append(d[2])
-  coloptions.append(d[3])
-  col_idx[d[0]] = len(colnames)-1
-  
+	colnames.append(d[0])
+	coltypes.append(d[1])
+	colwidths.append(d[2])
+	coloptions.append(d[3])
+	col_idx[d[0]] = len(colnames)-1
+	
 # ageing based on
 # ------------------------------------------------------------------
 aging_based_on = 'Aging Date'
 if filter_values.has_key('aging_based_on') and filter_values['aging_based_on']:
-  aging_based_on = filter_values['aging_based_on'].split(NEWLINE)[-1]
+	aging_based_on = filter_values['aging_based_on'].split(NEWLINE)[-1]
 
-if  len(res) > 600 and from_export == 0:
-  msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please select Account or click on 'Export' to open in excel")
-  raise Exception
+if	len(res) > 600 and from_export == 0:
+	msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please select Account or click on 'Export' to open in excel")
+	raise Exception
 
 
 # ------------------------------------------------------------------
 # main loop starts here
 # ------------------------------------------------------------------
 
+# get supplier type
+supp_type_dict = {}
+for each in sql("select t2.name, t1.supplier_type from tabSupplier t1, tabAccount t2 where t1.name = t2.account_name group by t2.name"):
+	supp_type_dict[each[0]] = each[1]
+
+# get due_date, bill_no, bill_date from PV
+pv_dict = {}
+for t in sql("select name, due_date, bill_no, bill_date from `tabPayable Voucher` group by name"):
+	pv_dict[t[0]] = [cstr(t[1]), t[2], cstr(t[3])]
+
+# pv outside this period
+pv_outside_period = [d[0] for d in sql("select distinct name from `tabPayable Voucher` where (posting_date < '%s' or posting_date > '%s') and docstatus = 1" % (from_date, to_date))]
+
+
 out = []
 total_booking_amt, total_outstanding_amt = 0,0
 
 for r in res:
-  # get supplier type
-  supplier_type = sql("select t1.supplier_type from tabSupplier t1, tabAccount t2 where t1.name = t2.account_name and t2.name = '%s'" % r[col_idx['Account']])
-  r.append(supplier_type and cstr(supplier_type[0][0]) or '')
+	outstanding_amt, due_date, bill_no, bill_date, cond = 0, '','','', ''
+	booking_amt = r.pop(8)
+	
+	# supplier type
+	r.append(supp_type_dict.get(r[col_idx['Account']], ''))	
+	
+	# if entry against Payable Voucher
+	if r[col_idx['Against Voucher']] and r[col_idx['Voucher Type']] == 'Payable Voucher':
+		r += pv_dict.get(r[col_idx['Voucher No']], ['', '', ''])
+		cond = " and ifnull(against_voucher, '') = '%s'" % r[col_idx['Against Voucher']]
 
-  outstanding_amt, booking_amt, due_date, bill_no, bill_date, cond = 0,0, '','','', ''
+	# if entry against JV & and not adjusted within period
+	elif r[col_idx['Against Voucher Type']] == 'Payable Voucher' and r[col_idx['Against Voucher']] in pv_outside_period:
+		booking_amt = 0
+		cond = " and voucher_no = '%s' and ifnull(against_voucher, '') = '%s'" % (r[col_idx['Voucher No']], r[col_idx['Against Voucher']])
+	
+	# if un-adjusted
+	elif not r[col_idx['Against Voucher']]:
+		booking_amt = 0
+		cond = " and ((voucher_no = '%s' and ifnull(against_voucher, '') = '') or (ifnull(against_voucher, '') = '%s' and voucher_type = 'Journal Voucher'))" % (r[col_idx['Voucher No']], r[col_idx['Voucher No']])
 
-  # if entry against Payable Voucher
-  if r[col_idx['Against Voucher']] and r[col_idx['Voucher Type']] == 'Payable Voucher':
-    due_date, bill_no, bill_date = [cstr(t) for t in sql("select due_date,bill_no,bill_date from `tabPayable Voucher` where name = %s", r[col_idx['Voucher No']])[0]]
+	if cond:
+		outstanding_amt = flt(sql("select sum(ifnull(credit, 0))-sum(ifnull(debit, 0)) from `tabGL Entry` where account = '%s' and ifnull(is_cancelled, 'No') = 'No' and posting_date <= '%s' %s" % (r[col_idx['Account']], to_date, cond))[0][0] or 0)
 
-    # get opening
-    booking_amt = sql("select credit from `tabGL Entry` where account = %s and voucher_no = %s and is_cancelled = 'No'", (r[col_idx['Account']], r[col_idx['Voucher No']]))
-    booking_amt = booking_amt and flt(booking_amt[0][0]) or 0
+		# add to total outstanding
+		total_outstanding_amt += flt(outstanding_amt)
 
-    cond = " and against_voucher = '%s' and against_voucher is not null" % r[col_idx['Against Voucher']]
+		# add to total booking amount
+		if outstanding_amt and r[col_idx['Voucher Type']] == 'Payable Voucher' and r[col_idx['Against Voucher']]:
+			total_booking_amt += flt(booking_amt)
 
-  # if entry against JV & and not adjusted within period
-  elif r[col_idx['Against Voucher Type']] == 'Payable Voucher' and sql("select name from `tabPayable Voucher` where name = '%s' and (posting_date < '%s' or posting_date > '%s') and docstatus = 1" % (r[col_idx['Against Voucher']], from_date, to_date)):
-    cond = " and voucher_no = '%s' and ifnull(against_voucher, '') = '%s'" % (r[col_idx['Voucher No']], r[col_idx['Against Voucher']])
-  
-  # if un-adjusted
-  elif not r[col_idx['Against Voucher']]:
-    cond = " and ((voucher_no = '%s' and ifnull(against_voucher, '') = '') or (ifnull(against_voucher, '') = '%s' and voucher_type = 'Journal Voucher'))" % (r[col_idx['Voucher No']], r[col_idx['Voucher No']])
+	r += [booking_amt, outstanding_amt]
+	
+	# split into date ranges
+	val_l1 = val_l2 = val_l3 = val_l4 = val_l5_above= 0
+	if r[col_idx[aging_based_on]]:
+		diff = (getdate(to_date) - getdate(r[col_idx[aging_based_on]])).days
+		if diff < cint(filter_values['range_1']):
+			val_l1 = outstanding_amt
+		if diff >= cint(filter_values['range_1']) and diff < cint(filter_values['range_2']):
+			val_l2 = outstanding_amt
+		if diff >= cint(filter_values['range_2']) and diff < cint(filter_values['range_3']):
+			val_l3 = outstanding_amt
+		if diff >= cint(filter_values['range_3']) and diff < cint(filter_values['range_4']):
+			val_l4 = outstanding_amt
+		if diff >= cint(filter_values['range_4']):
+			val_l5_above = outstanding_amt
 
-  if cond:
-    outstanding_amt = flt(sql("select sum(ifnull(credit, 0))-sum(ifnull(debit, 0)) from `tabGL Entry` where account = '%s' and ifnull(is_cancelled, 'No') = 'No' and posting_date <= '%s' %s" % (r[col_idx['Account']], to_date, cond))[0][0] or 0)
+	r += [diff, val_l1, val_l2, val_l3, val_l4, val_l5_above]
 
-    # add to total outstanding
-    total_outstanding_amt += flt(outstanding_amt)
-
-    # add to total booking amount
-    if outstanding_amt and r[col_idx['Voucher Type']] == 'Payable Voucher' and r[col_idx['Against Voucher']]:
-      total_booking_amt += flt(booking_amt)
-
-  r += [due_date, bill_no, bill_date, booking_amt, outstanding_amt]
-  
-  # split into date ranges
-  val_l1 = val_l2 = val_l3 = val_l4 = val_l5_above= 0
-  if r[col_idx[aging_based_on]]:
-    diff = (getdate(to_date) - getdate(r[col_idx[aging_based_on]])).days
-    if diff < cint(filter_values['range_1']):
-      val_l1 = outstanding_amt
-    if diff >= cint(filter_values['range_1']) and diff < cint(filter_values['range_2']):
-      val_l2 = outstanding_amt
-    if diff >= cint(filter_values['range_2']) and diff < cint(filter_values['range_3']):
-      val_l3 = outstanding_amt
-    if diff >= cint(filter_values['range_3']) and diff < cint(filter_values['range_4']):
-      val_l4 = outstanding_amt
-    if diff >= cint(filter_values['range_4']):
-      val_l5_above = outstanding_amt
-
-  r += [diff, val_l1, val_l2, val_l3, val_l4, val_l5_above]
-
-  # Only show that entry which has outstanding
-  if abs(flt(outstanding_amt)) > 0.001:
-    out.append(r)
-    
-if  len(out) > 300 and from_export == 0:
-  msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please select Account or click on 'Export' to open in excel")
-  raise Exception
+	# Only show that entry which has outstanding
+	if abs(flt(outstanding_amt)) > 0.001:
+		out.append(r)
+		
+if	len(out) > 300 and from_export == 0:
+	msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please select Account or click on 'Export' to open in excel")
+	raise Exception
 
 
 # Append Extra rows to RES
diff --git a/accounts/search_criteria/accounts_payable/accounts_payable.sql b/accounts/search_criteria/accounts_payable/accounts_payable.sql
index d2dba06..2054b1e 100644
--- a/accounts/search_criteria/accounts_payable/accounts_payable.sql
+++ b/accounts/search_criteria/accounts_payable/accounts_payable.sql
@@ -1,4 +1,4 @@
-SELECT DISTINCT `tabGL Entry`.`Aging_date`,`tabGL Entry`.`transaction_date`,`tabGL Entry`.`account`, `tabGL Entry`.`against_voucher_type`, `tabGL Entry`.`against_voucher`,`tabGL Entry`.`voucher_type`,`tabGL Entry`.`voucher_no`, `tabGL Entry`.remarks
+SELECT DISTINCT `tabGL Entry`.`Aging_date`,`tabGL Entry`.`transaction_date`,`tabGL Entry`.`account`, `tabGL Entry`.`against_voucher_type`, `tabGL Entry`.`against_voucher`,`tabGL Entry`.`voucher_type`,`tabGL Entry`.`voucher_no`, `tabGL Entry`.`remarks`, `tabGL Entry`.`credit`
 FROM `tabGL Entry`,`tabAccount` 
 WHERE `tabGL Entry`.`posting_date`>= '%(posting_date)s'
  AND `tabGL Entry`.`posting_date`<= '%(posting_date1)s'
diff --git a/accounts/search_criteria/accounts_receivable/accounts_receivable.js b/accounts/search_criteria/accounts_receivable/accounts_receivable.js
index a51b8fb..f31dc76 100644
--- a/accounts/search_criteria/accounts_receivable/accounts_receivable.js
+++ b/accounts/search_criteria/accounts_receivable/accounts_receivable.js
@@ -5,8 +5,8 @@
   this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
   this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
   this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.filter_hide = 0;
-  
-  this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Transaction Date'+NEWLINE+'Aging Date'+NEWLINE+'Due Date',ignore : 1, parent:'Receivable Voucher', report_default:'Aging Date'});  
+
+  this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Transaction Date'+NEWLINE+'Aging Date'+NEWLINE+'Due Date',ignore : 1, parent:'Receivable Voucher', report_default:'Aging Date'});
   this.add_filter({fieldname:'range_1', label:'Range 1', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
   this.add_filter({fieldname:'range_2', label:'Range 2', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
   this.add_filter({fieldname:'range_3', label:'Range 3', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
@@ -19,4 +19,4 @@
   this.dt.set_no_limit(1);
 }
 
-this.mytabs.items['Select Columns'].hide()
\ No newline at end of file
+//this.mytabs.items['Select Columns'].hide()
\ No newline at end of file
diff --git a/accounts/search_criteria/lease_agreement_list/__init__.py b/accounts/search_criteria/lease_agreement_list/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/lease_agreement_list/__init__.py
diff --git a/accounts/search_criteria/lease_agreement_list/lease_agreement_list.js b/accounts/search_criteria/lease_agreement_list/lease_agreement_list.js
new file mode 100644
index 0000000..4cb3d2b
--- /dev/null
+++ b/accounts/search_criteria/lease_agreement_list/lease_agreement_list.js
@@ -0,0 +1,11 @@
+report.customize_filters = function() {
+	this.hide_all_filters();
+
+	this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
+
+	this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=sys_defaults.year_start_date;
+	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
+}
+
+$dh(this.mytabs.tabs['More Filters']);
+$dh(this.mytabs.tabs['Select Columns']);
diff --git a/accounts/search_criteria/lease_agreement_list/lease_agreement_list.py b/accounts/search_criteria/lease_agreement_list/lease_agreement_list.py
new file mode 100644
index 0000000..e749d1b
--- /dev/null
+++ b/accounts/search_criteria/lease_agreement_list/lease_agreement_list.py
@@ -0,0 +1,13 @@
+data =[
+		['Agreement No.','Data','100px',''],
+		['Lessee Name','Data','300px',''],
+		['Amount','Currency','120px','']
+	]
+
+for d in data:
+	colnames.append(d[0])
+	coltypes.append(d[1])
+	colwidths.append(d[2])
+	coloptions.append(d[3])
+	col_idx[d[0]] = len(colnames)-1
+
diff --git a/accounts/search_criteria/lease_agreement_list/lease_agreement_list.sql b/accounts/search_criteria/lease_agreement_list/lease_agreement_list.sql
new file mode 100644
index 0000000..6097b2f
--- /dev/null
+++ b/accounts/search_criteria/lease_agreement_list/lease_agreement_list.sql
@@ -0,0 +1,3 @@
+select la.name, la.account, la.invoice_amount
+from `tabLease Agreement` la
+where start_date between '%(date)s' and '%(date1)s' order by la.name
diff --git a/accounts/search_criteria/lease_agreement_list/lease_agreement_list.txt b/accounts/search_criteria/lease_agreement_list/lease_agreement_list.txt
new file mode 100644
index 0000000..f7c9f84
--- /dev/null
+++ b/accounts/search_criteria/lease_agreement_list/lease_agreement_list.txt
@@ -0,0 +1,30 @@
+# Search Criteria, lease_agreement_list
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2011-07-26 17:01:34',
+		'docstatus': 0,
+		'modified': '2011-07-28 12:55:50',
+		'modified_by': 'Administrator',
+		'owner': 'Administrator'
+	},
+
+	# These values are common for all Search Criteria
+	{
+		'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Aging Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
+		'criteria_name': 'Lease Agreement List',
+		'doc_type': 'GL Entry',
+		'doctype': 'Search Criteria',
+		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
+		'module': 'Accounts',
+		'name': '__common__',
+		'standard': 'Yes'
+	},
+
+	# Search Criteria, lease_agreement_list
+	{
+		'doctype': 'Search Criteria',
+		'name': 'lease_agreement_list'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/lease_monthly_future_installment_inflows/__init__.py b/accounts/search_criteria/lease_monthly_future_installment_inflows/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/lease_monthly_future_installment_inflows/__init__.py
diff --git a/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.js b/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.js
new file mode 100644
index 0000000..2d89611
--- /dev/null
+++ b/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.js
@@ -0,0 +1,14 @@
+report.customize_filters = function() {
+	this.hide_all_filters();
+
+	this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
+
+	this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=dateutil.obj_to_str(new Date());
+//	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
+
+	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df.filter_hide=1;
+
+}
+
+$dh(this.mytabs.tabs['More Filters']);
+$dh(this.mytabs.tabs['Select Columns']);
diff --git a/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.py b/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.py
new file mode 100644
index 0000000..8e5b8ad
--- /dev/null
+++ b/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.py
@@ -0,0 +1,13 @@
+data =[
+		['Month','Data','100px',''],
+		['Year','Data','100px',''],
+		['Amount','Currency','120px','']
+	]
+
+for d in data:
+	colnames.append(d[0])
+	coltypes.append(d[1])
+	colwidths.append(d[2])
+	coloptions.append(d[3])
+	col_idx[d[0]] = len(colnames)-1
+
diff --git a/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.sql b/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.sql
new file mode 100644
index 0000000..564a3fd
--- /dev/null
+++ b/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.sql
@@ -0,0 +1,9 @@
+select date_format(due_date,'%M') as mnt,year(due_date),sum(amount)
+
+from `tabLease Agreement` la,`tabLease Installment` lai
+
+where la.name=lai.parent and (lai.cheque_date is null or lai.cheque_date > '%(date)s')
+
+group by date_format(due_date,'%M-%Y')
+
+order by year(due_date),month(due_date)
\ No newline at end of file
diff --git a/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.txt b/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.txt
new file mode 100644
index 0000000..a531bb9
--- /dev/null
+++ b/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.txt
@@ -0,0 +1,30 @@
+# Search Criteria, lease_monthly_future_installment_inflows
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2011-07-27 13:14:29',
+		'docstatus': 0,
+		'modified': '2011-07-27 13:14:29',
+		'modified_by': 'Administrator',
+		'owner': 'Administrator'
+	},
+
+	# These values are common for all Search Criteria
+	{
+		'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Aging Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
+		'criteria_name': 'Lease Monthly Future Installment Inflows',
+		'doc_type': 'GL Entry',
+		'doctype': 'Search Criteria',
+		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
+		'module': 'Accounts',
+		'name': '__common__',
+		'standard': 'Yes'
+	},
+
+	# Search Criteria, lease_monthly_future_installment_inflows
+	{
+		'doctype': 'Search Criteria',
+		'name': 'lease_monthly_future_installment_inflows'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/lease_over_due_list/__init__.py b/accounts/search_criteria/lease_over_due_list/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/lease_over_due_list/__init__.py
diff --git a/accounts/search_criteria/lease_over_due_list/lease_over_due_list.js b/accounts/search_criteria/lease_over_due_list/lease_over_due_list.js
new file mode 100644
index 0000000..2d89611
--- /dev/null
+++ b/accounts/search_criteria/lease_over_due_list/lease_over_due_list.js
@@ -0,0 +1,14 @@
+report.customize_filters = function() {
+	this.hide_all_filters();
+
+	this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
+
+	this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=dateutil.obj_to_str(new Date());
+//	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
+
+	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df.filter_hide=1;
+
+}
+
+$dh(this.mytabs.tabs['More Filters']);
+$dh(this.mytabs.tabs['Select Columns']);
diff --git a/accounts/search_criteria/lease_over_due_list/lease_over_due_list.py b/accounts/search_criteria/lease_over_due_list/lease_over_due_list.py
new file mode 100644
index 0000000..869d46a
--- /dev/null
+++ b/accounts/search_criteria/lease_over_due_list/lease_over_due_list.py
@@ -0,0 +1,14 @@
+data =[
+		['Agreement No.','Data','100px',''],
+		['Lessee Name','Data','300px',''],
+		['Amount','Currency','120px',''],
+		['Age','Data','100px','']
+	]
+
+for d in data:
+	colnames.append(d[0])
+	coltypes.append(d[1])
+	colwidths.append(d[2])
+	coloptions.append(d[3])
+	col_idx[d[0]] = len(colnames)-1
+
diff --git a/accounts/search_criteria/lease_over_due_list/lease_over_due_list.sql b/accounts/search_criteria/lease_over_due_list/lease_over_due_list.sql
new file mode 100644
index 0000000..1789f7e
--- /dev/null
+++ b/accounts/search_criteria/lease_over_due_list/lease_over_due_list.sql
@@ -0,0 +1,7 @@
+select la.name,la.account,lai.amount,cast('%(date)s' as date)-due_date as age
+
+from `tabLease Agreement` la,`tabLease Installment` lai
+
+where la.name=lai.parent and lai.due_date<cast('%(date)s' as date) and (lai.cheque_date is null or lai.cheque_date > cast('%(date)s' as date))
+
+order by cast('%(date)s' as date)-due_date desc
\ No newline at end of file
diff --git a/accounts/search_criteria/lease_over_due_list/lease_over_due_list.txt b/accounts/search_criteria/lease_over_due_list/lease_over_due_list.txt
new file mode 100644
index 0000000..22bdc55
--- /dev/null
+++ b/accounts/search_criteria/lease_over_due_list/lease_over_due_list.txt
@@ -0,0 +1,30 @@
+# Search Criteria, lease_over_due_list
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2011-07-26 18:11:47',
+		'docstatus': 0,
+		'modified': '2011-07-26 18:27:01',
+		'modified_by': 'Administrator',
+		'owner': 'Administrator'
+	},
+
+	# These values are common for all Search Criteria
+	{
+		'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Aging Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
+		'criteria_name': 'Lease Over Due List',
+		'doc_type': 'GL Entry',
+		'doctype': 'Search Criteria',
+		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
+		'module': 'Accounts',
+		'name': '__common__',
+		'standard': 'Yes'
+	},
+
+	# Search Criteria, lease_over_due_list
+	{
+		'doctype': 'Search Criteria',
+		'name': 'lease_over_due_list'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/lease_overdue_age_wise/__init__.py b/accounts/search_criteria/lease_overdue_age_wise/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/lease_overdue_age_wise/__init__.py
diff --git a/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.js b/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.js
new file mode 100644
index 0000000..2d89611
--- /dev/null
+++ b/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.js
@@ -0,0 +1,14 @@
+report.customize_filters = function() {
+	this.hide_all_filters();
+
+	this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
+
+	this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=dateutil.obj_to_str(new Date());
+//	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
+
+	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df.filter_hide=1;
+
+}
+
+$dh(this.mytabs.tabs['More Filters']);
+$dh(this.mytabs.tabs['Select Columns']);
diff --git a/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.py b/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.py
new file mode 100644
index 0000000..5e16489
--- /dev/null
+++ b/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.py
@@ -0,0 +1,16 @@
+data =[
+		['Lessee Name','Data','300px',''],
+		['Below 30 Days','Currency','120px',''],
+		['Below 90 Days','Currency','120px',''],
+		['Below 180 Days','Currency','120px',''],
+		['Below 360 Days','Currency','120px',''],
+		['Above 360 Days','Currency','120px',''],
+	]
+
+for d in data:
+	colnames.append(d[0])
+	coltypes.append(d[1])
+	colwidths.append(d[2])
+	coloptions.append(d[3])
+	col_idx[d[0]] = len(colnames)-1
+
diff --git a/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.sql b/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.sql
new file mode 100644
index 0000000..2e6912e
--- /dev/null
+++ b/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.sql
@@ -0,0 +1,9 @@
+select account,sum(od_30)as od_30,sum(od_90)as od_90,sum(od_180)as od_180,sum(od_360)as od_360,sum(od_1yr)as od_1yr from
+(
+	select account,case when age<=30 then amount end as od_30,case when age between 31 and 90 then amount end as od_90,case when age between 91 and 180 then amount end as od_180,case when age between 181 and 360 then amount end as od_360,case when age>360 then amount end as od_1yr from
+	(
+		select la.account,lai.amount,cast('%(date)s' as date)-due_date as age
+		from `tabLease Agreement` la,`tabLease Installment` lai
+		where la.name=lai.parent and lai.due_date<'%(date)s' and (lai.cheque_date is null or lai.cheque_date > '%(date)s')
+	)a
+)b group by account order by account
diff --git a/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.txt b/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.txt
new file mode 100644
index 0000000..dcd0f94
--- /dev/null
+++ b/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.txt
@@ -0,0 +1,30 @@
+# Search Criteria, lease_overdue_age_wise
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2011-07-27 13:14:29',
+		'docstatus': 0,
+		'modified': '2011-07-27 13:14:29',
+		'modified_by': 'Administrator',
+		'owner': 'Administrator'
+	},
+
+	# These values are common for all Search Criteria
+	{
+		'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Aging Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
+		'criteria_name': 'Lease Overdue Age Wise',
+		'doc_type': 'GL Entry',
+		'doctype': 'Search Criteria',
+		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
+		'module': 'Accounts',
+		'name': '__common__',
+		'standard': 'Yes'
+	},
+
+	# Search Criteria, lease_overdue_age_wise
+	{
+		'doctype': 'Search Criteria',
+		'name': 'lease_overdue_age_wise'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/lease_receipt_summary_month_wise/__init__.py b/accounts/search_criteria/lease_receipt_summary_month_wise/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/lease_receipt_summary_month_wise/__init__.py
diff --git a/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.js b/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.js
new file mode 100644
index 0000000..4cb3d2b
--- /dev/null
+++ b/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.js
@@ -0,0 +1,11 @@
+report.customize_filters = function() {
+	this.hide_all_filters();
+
+	this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
+
+	this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=sys_defaults.year_start_date;
+	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
+}
+
+$dh(this.mytabs.tabs['More Filters']);
+$dh(this.mytabs.tabs['Select Columns']);
diff --git a/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.py b/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.py
new file mode 100644
index 0000000..8e5b8ad
--- /dev/null
+++ b/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.py
@@ -0,0 +1,13 @@
+data =[
+		['Month','Data','100px',''],
+		['Year','Data','100px',''],
+		['Amount','Currency','120px','']
+	]
+
+for d in data:
+	colnames.append(d[0])
+	coltypes.append(d[1])
+	colwidths.append(d[2])
+	coloptions.append(d[3])
+	col_idx[d[0]] = len(colnames)-1
+
diff --git a/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.sql b/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.sql
new file mode 100644
index 0000000..cdd48b8
--- /dev/null
+++ b/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.sql
@@ -0,0 +1,5 @@
+SELECT date_format(gl.posting_date,'%M'),year(gl.posting_date),sum(gl.credit) as amount
+FROM `tabGL Entry` gl, `tabAccount` a
+WHERE gl.account=a.name and a.master_type='Customer' and gl.credit>0 and gl.posting_date between '%(date)s' and '%(date1)s'
+GROUP BY month(gl.posting_date),year(gl.posting_date)
+ORDER BY year(gl.posting_date),month(gl.posting_date)
diff --git a/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.txt b/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.txt
new file mode 100644
index 0000000..6e1b266
--- /dev/null
+++ b/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.txt
@@ -0,0 +1,30 @@
+# Search Criteria, lease_receipt_summary_month_wise
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2011-07-27 18:48:29',
+		'docstatus': 0,
+		'modified': '2011-07-28 12:56:35',
+		'modified_by': 'Administrator',
+		'owner': 'Administrator'
+	},
+
+	# These values are common for all Search Criteria
+	{
+		'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Aging Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
+		'criteria_name': 'Lease Receipt Summary Month Wise',
+		'doc_type': 'GL Entry',
+		'doctype': 'Search Criteria',
+		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
+		'module': 'Accounts',
+		'name': '__common__',
+		'standard': 'Yes'
+	},
+
+	# Search Criteria, lease_receipt_summary_month_wise
+	{
+		'doctype': 'Search Criteria',
+		'name': 'lease_receipt_summary_month_wise'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/lease_receipts_client_wise/__init__.py b/accounts/search_criteria/lease_receipts_client_wise/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/lease_receipts_client_wise/__init__.py
diff --git a/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.js b/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.js
new file mode 100644
index 0000000..4cb3d2b
--- /dev/null
+++ b/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.js
@@ -0,0 +1,11 @@
+report.customize_filters = function() {
+	this.hide_all_filters();
+
+	this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
+
+	this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=sys_defaults.year_start_date;
+	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
+}
+
+$dh(this.mytabs.tabs['More Filters']);
+$dh(this.mytabs.tabs['Select Columns']);
diff --git a/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.py b/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.py
new file mode 100644
index 0000000..b84ff9f
--- /dev/null
+++ b/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.py
@@ -0,0 +1,12 @@
+data =[
+		['Lessee Name','Data','300px',''],
+		['Amount','Currency','120px','']
+	]
+
+for d in data:
+	colnames.append(d[0])
+	coltypes.append(d[1])
+	colwidths.append(d[2])
+	coloptions.append(d[3])
+	col_idx[d[0]] = len(colnames)-1
+
diff --git a/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.sql b/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.sql
new file mode 100644
index 0000000..f951388
--- /dev/null
+++ b/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.sql
@@ -0,0 +1,5 @@
+SELECT gl.account,sum(gl.credit) as amount
+FROM `tabGL Entry` gl, `tabAccount` a
+WHERE gl.account=a.name and a.master_type='Customer' and gl.posting_date between '%(date)s' and '%(date1)s'
+GROUP BY gl.account
+ORDER BY posting_date
diff --git a/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.txt b/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.txt
new file mode 100644
index 0000000..26c0ff7
--- /dev/null
+++ b/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.txt
@@ -0,0 +1,31 @@
+# Search Criteria, lease_receipts_client_wise
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2011-07-28 12:13:41',
+		'docstatus': 0,
+		'modified': '2011-07-28 12:56:47',
+		'modified_by': 'Administrator',
+		'owner': 'Administrator'
+	},
+
+	# These values are common for all Search Criteria
+	{
+		'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Aging Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
+		'criteria_name': 'Lease Receipts Client Wise',
+		'doc_type': 'GL Entry',
+		'doctype': 'Search Criteria',
+		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
+		'module': 'Accounts',
+		'name': '__common__',
+		'page_len': 50,
+		'standard': 'Yes'
+	},
+
+	# Search Criteria, lease_receipts_client_wise
+	{
+		'doctype': 'Search Criteria',
+		'name': 'lease_receipts_client_wise'
+	}
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/lease_yearly_future_installment_inflows/__init__.py b/accounts/search_criteria/lease_yearly_future_installment_inflows/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/accounts/search_criteria/lease_yearly_future_installment_inflows/__init__.py
diff --git a/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.js b/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.js
new file mode 100644
index 0000000..2d89611
--- /dev/null
+++ b/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.js
@@ -0,0 +1,14 @@
+report.customize_filters = function() {
+	this.hide_all_filters();
+
+	this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
+
+	this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=dateutil.obj_to_str(new Date());
+//	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
+
+	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df.filter_hide=1;
+
+}
+
+$dh(this.mytabs.tabs['More Filters']);
+$dh(this.mytabs.tabs['Select Columns']);
diff --git a/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.py b/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.py
new file mode 100644
index 0000000..0163ba6
--- /dev/null
+++ b/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.py
@@ -0,0 +1,12 @@
+data =[
+		['Year','Data','100px',''],
+		['Amount','Currency','120px','']
+	]
+
+for d in data:
+	colnames.append(d[0])
+	coltypes.append(d[1])
+	colwidths.append(d[2])
+	coloptions.append(d[3])
+	col_idx[d[0]] = len(colnames)-1
+
diff --git a/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.sql b/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.sql
new file mode 100644
index 0000000..ec6c816
--- /dev/null
+++ b/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.sql
@@ -0,0 +1,9 @@
+select year(date_sub(due_date,interval 6 MONTH)) as yr,sum(amount)
+
+from `tabLease Agreement` la,`tabLease Installment` lai
+
+where la.name=lai.parent and (lai.cheque_date is null or lai.cheque_date > '%(date)s')
+
+group by year(date_sub(due_date,interval 6 MONTH))
+
+order by yr
\ No newline at end of file
diff --git a/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.txt b/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.txt
new file mode 100644
index 0000000..aa52224
--- /dev/null
+++ b/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.txt
@@ -0,0 +1,30 @@
+# Search Criteria, lease_yearly_future_installment_inflows
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2011-07-27 13:14:29',
+		'docstatus': 0,
+		'modified': '2011-07-27 13:14:29',
+		'modified_by': 'Administrator',
+		'owner': 'Administrator'
+	},
+
+	# These values are common for all Search Criteria
+	{
+		'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Aging Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
+		'criteria_name': 'Lease Yearly Future Installment Inflows',
+		'doc_type': 'GL Entry',
+		'doctype': 'Search Criteria',
+		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
+		'module': 'Accounts',
+		'name': '__common__',
+		'standard': 'Yes'
+	},
+
+	# Search Criteria, lease_yearly_future_installment_inflows
+	{
+		'doctype': 'Search Criteria',
+		'name': 'lease_yearly_future_installment_inflows'
+	}
+]
\ No newline at end of file
diff --git a/accounts/utils/__init__.py b/accounts/utils/__init__.py
new file mode 100644
index 0000000..e8ca13e
--- /dev/null
+++ b/accounts/utils/__init__.py
@@ -0,0 +1,27 @@
+from webnotes.model.doc import make_autoname, Document, addchild
+# Posts JV
+
+def post_jv(data):
+	jv = Document('Journal Voucher')
+	jv.voucher_type = data.get('voucher_type')
+	jv.naming_series = data.get('naming_series')
+	jv.voucher_date = data.get('cheque_date')
+	jv.posting_date = data.get('cheque_date')
+	jv.cheque_no = data.get('cheque_number')
+	jv.cheque_date = data.get('cheque_date')
+	jv.fiscal_year = data.get('fiscal_year') # To be modified to take care
+	jv.company = data.get('company')
+
+	jv.save(1)
+
+	jc = addchild(jv,'entries','Journal Voucher Detail',0)
+	jc.account = data.get('debit_account')
+	jc.debit = data.get('amount')
+	jc.save()
+
+	jc = addchild(jv,'entries','Journal Voucher Detail',0)
+	jc.account = data.get('credit_account')
+	jc.credit = data.get('amount')
+	jc.save()
+
+	return jv.name
\ No newline at end of file
diff --git a/analysis/doctype/mis_control/mis_control.py b/analysis/doctype/mis_control/mis_control.py
index 08a71f2..5af36e9 100644
--- a/analysis/doctype/mis_control/mis_control.py
+++ b/analysis/doctype/mis_control/mis_control.py
@@ -195,7 +195,7 @@
   # Get Children
   # ------------
   def get_children(self, parent_account, level, pl, company, fy):
-    cl = sql("select distinct account_name, name, debit_or_credit, lft, rgt from `tabAccount` where ifnull(parent_account, '') = %s and ifnull(is_pl_account, 'No')=%s and company=%s order by name asc", (parent_account, pl, company))
+    cl = sql("select distinct account_name, name, debit_or_credit, lft, rgt from `tabAccount` where ifnull(parent_account, '') = %s and ifnull(is_pl_account, 'No')=%s and company=%s and docstatus != 2 order by name asc", (parent_account, pl, company))
     level0_diff = [0 for p in self.period_list]
     if pl=='Yes' and level==0: # switch for income & expenses
       cl = [c for c in cl]
@@ -295,7 +295,7 @@
         sd = self.ysd.strftime('%Y-%m-%d')
         cond = ""
 
-      bal = sql("select SUM(t1.debit), SUM(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= '%s' AND t1.posting_date <= '%s' AND t1.company = '%s' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s and ifnull(is_opening,'No') = 'No' %s" % (sd,ed,company,lft,rgt, cond))
+      bal = sql("select SUM(t1.debit), SUM(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= '%s' AND t1.posting_date <= '%s' AND t1.company = '%s' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s and ifnull(t1.is_opening,'No') = 'No' and ifnull(t1.is_cancelled, 'No') = 'No' %s" % (sd,ed,company,lft,rgt, cond))
       
       
       bal = bal and (flt(bal[0][0]) - flt(bal[0][1])) or 0
@@ -316,7 +316,7 @@
     a = sql("select account_name, name, debit_or_credit, lft, rgt, is_pl_account from `tabAccount` where account_name=%s and company=%s", (acc, company), as_dict=1)
     if a:
       a = a[0]
-      bal = sql("select SUM(IFNULL(t1.debit,0)), SUM(IFNULL(t1.credit,0)) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= %s AND t1.posting_date <= %s AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s and ifnull(is_opening, 'No') = 'No'", (sd,ed,a['lft'],a['rgt']))
+      bal = sql("select SUM(IFNULL(t1.debit,0)), SUM(IFNULL(t1.credit,0)) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= %s AND t1.posting_date <= %s AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s and ifnull(is_opening, 'No') = 'No' and ifnull(t1.is_cancelled, 'No') = 'No'", (sd,ed,a['lft'],a['rgt']))
       if a['debit_or_credit']=='Debit':
         bal = flt(flt(bal[0][0]) - flt(bal[0][1]))
       else:
@@ -341,13 +341,13 @@
     rec_grp = sql("select receivables_group from tabCompany where name=%s", company)
     if rec_grp:
       pa_lft_rgt = sql("select lft, rgt from tabAccount where name=%s and company=%s", (rec_grp[0][0], company))[0]
-      return sql("select t1.account_name, SUM(t2.debit) from tabAccount t1, `tabGL Entry` t2 where t1.lft > %s and t1.rgt < %s and t2.account = t1.name GROUP BY t1.name ORDER BY SUM(t2.debit) desc limit 5", (pa_lft_rgt[0], pa_lft_rgt[1]))
+      return sql("select t1.account_name, SUM(t2.debit) from tabAccount t1, `tabGL Entry` t2 where t1.lft > %s and t1.rgt < %s and t2.account = t1.name  and ifnull(t2.is_cancelled, 'No') = 'No' GROUP BY t1.name ORDER BY SUM(t2.debit) desc limit 5", (pa_lft_rgt[0], pa_lft_rgt[1]))
     else:
       return []
 
   def get_top_5_exp(self, company):
     a = sql("select distinct account_name, name, debit_or_credit, lft, rgt from `tabAccount` where account_name=%s and company=%s", ('Expenses', company), as_dict=1)[0]
-    return sql("select t1.account_name, SUM(t2.debit) from tabAccount t1, `tabGL Entry` t2 where t1.lft>%s and t1.rgt<%s and t1.group_or_ledger = 'Ledger' and t2.account = t1.name and t2.voucher_type != 'Period Closing Voucher' GROUP BY t1.name ORDER BY SUM(t2.debit) desc limit 5", (a['lft'],a['rgt']))
+    return sql("select t1.account_name, SUM(t2.debit) from tabAccount t1, `tabGL Entry` t2 where t1.lft>%s and t1.rgt<%s and t1.group_or_ledger = 'Ledger' and t2.account = t1.name  and ifnull(t2.is_cancelled, 'No') = 'No' and t2.voucher_type != 'Period Closing Voucher' GROUP BY t1.name ORDER BY SUM(t2.debit) desc limit 5", (a['lft'],a['rgt']))
   
   def bl(self, acc, company):
     dt = getdate(nowdate())
diff --git a/buying/doctype/indent/indent.txt b/buying/doctype/indent/indent.txt
index 93767a8..cd6c912 100644
--- a/buying/doctype/indent/indent.txt
+++ b/buying/doctype/indent/indent.txt
@@ -282,6 +282,7 @@
 		'oldfieldtype': 'Data',
 		'options': 'Sales Order',
 		'permlevel': 0,
+		'search_index': 0,
 		'width': '100px'
 	},
 
@@ -338,7 +339,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '150px'
 	},
 
@@ -357,7 +358,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '150px'
 	},
 
@@ -487,7 +488,8 @@
 		'options': 'Term',
 		'permlevel': 0,
 		'print_hide': 1,
-		'report_hide': 1
+		'report_hide': 1,
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/buying/doctype/indent_detail/indent_detail.txt b/buying/doctype/indent_detail/indent_detail.txt
index c81b9cf..c207266 100644
--- a/buying/doctype/indent_detail/indent_detail.txt
+++ b/buying/doctype/indent_detail/indent_detail.txt
@@ -85,7 +85,7 @@
 		'oldfieldtype': 'Data',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '100px'
 	},
 
@@ -132,6 +132,7 @@
 		'options': 'Brand',
 		'permlevel': 1,
 		'print_hide': 1,
+		'search_index': 0,
 		'width': '100px'
 	},
 
@@ -151,7 +152,7 @@
 		'permlevel': 1,
 		'print_hide': 1,
 		'reqd': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -199,6 +200,7 @@
 		'options': 'UOM',
 		'permlevel': 1,
 		'reqd': 1,
+		'search_index': 0,
 		'width': '50px'
 	},
 
diff --git a/buying/doctype/po_detail/po_detail.txt b/buying/doctype/po_detail/po_detail.txt
index 9e4d790..71d78df 100644
--- a/buying/doctype/po_detail/po_detail.txt
+++ b/buying/doctype/po_detail/po_detail.txt
@@ -54,7 +54,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -89,7 +89,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -182,6 +182,7 @@
 		'permlevel': 0,
 		'print_hide': 0,
 		'reqd': 1,
+		'search_index': 0,
 		'trigger': 'Client',
 		'width': '100px'
 	},
@@ -331,7 +332,8 @@
 		'oldfieldtype': 'Link',
 		'options': 'Brand',
 		'permlevel': 1,
-		'print_hide': 1
+		'print_hide': 1,
+		'search_index': 0
 	},
 
 	# DocField
@@ -348,7 +350,7 @@
 		'options': 'Item Group',
 		'permlevel': 1,
 		'print_hide': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/buying/doctype/qa_inspection_report/qa_inspection_report.txt b/buying/doctype/qa_inspection_report/qa_inspection_report.txt
index 5febdec..10890dc 100644
--- a/buying/doctype/qa_inspection_report/qa_inspection_report.txt
+++ b/buying/doctype/qa_inspection_report/qa_inspection_report.txt
@@ -206,7 +206,8 @@
 		'oldfieldtype': 'Link',
 		'options': 'Serial No',
 		'permlevel': 0,
-		'print_hide': 0
+		'print_hide': 0,
+		'search_index': 0
 	},
 
 	# DocField
@@ -219,7 +220,8 @@
 		'oldfieldname': 'batch_no',
 		'oldfieldtype': 'Link',
 		'options': 'Batch',
-		'permlevel': 0
+		'permlevel': 0,
+		'search_index': 0
 	},
 
 	# DocField
@@ -255,7 +257,7 @@
 		'options': 'Delivery Note',
 		'permlevel': 0,
 		'print_hide': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/buying/doctype/supplier/supplier.txt b/buying/doctype/supplier/supplier.txt
index b7797e5..a7a08c3 100644
--- a/buying/doctype/supplier/supplier.txt
+++ b/buying/doctype/supplier/supplier.txt
@@ -5,7 +5,7 @@
 	{
 		'creation': '2010-08-08 17:09:26',
 		'docstatus': 0,
-		'modified': '2011-05-10 17:42:21',
+		'modified': '2011-07-19 16:18:58',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
@@ -25,7 +25,7 @@
 		'show_in_menu': 0,
 		'subject': ' ',
 		'tag_fields': 'supplier_type',
-		'version': 86
+		'version': 87
 	},
 
 	# These values are common for all DocField
@@ -166,21 +166,8 @@
 	# DocField
 	{
 		'doctype': 'DocField',
-		'fieldname': 'supplier_status',
-		'fieldtype': 'Select',
-		'idx': 6,
-		'label': 'Supplier Status',
-		'oldfieldname': 'supplier_status',
-		'oldfieldtype': 'Select',
-		'options': '\nApproved\nUnapproved',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 7,
+		'idx': 6,
 		'label': 'Address & Contacts',
 		'oldfieldtype': 'Column Break',
 		'permlevel': 0
@@ -192,7 +179,7 @@
 		'depends_on': 'eval:doc.__islocal',
 		'doctype': 'DocField',
 		'fieldtype': 'HTML',
-		'idx': 8,
+		'idx': 7,
 		'label': 'Address Desc',
 		'options': '<em>Addresses will appear only when you save the supplier</em>',
 		'permlevel': 0
@@ -203,7 +190,7 @@
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldtype': 'HTML',
-		'idx': 9,
+		'idx': 8,
 		'label': 'Address HTML',
 		'permlevel': 1
 	},
@@ -212,7 +199,7 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 10,
+		'idx': 9,
 		'permlevel': 0,
 		'width': '50%'
 	},
@@ -223,7 +210,7 @@
 		'depends_on': 'eval:doc.__islocal',
 		'doctype': 'DocField',
 		'fieldtype': 'HTML',
-		'idx': 11,
+		'idx': 10,
 		'label': 'Contact Desc',
 		'options': '<em>Contact Details will appear only when you save the supplier</em>',
 		'permlevel': 0
@@ -233,7 +220,7 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'HTML',
-		'idx': 12,
+		'idx': 11,
 		'label': 'Contact HTML',
 		'permlevel': 1
 	},
@@ -242,7 +229,7 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 13,
+		'idx': 12,
 		'label': 'More Info',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0
@@ -255,7 +242,7 @@
 		'doctype': 'DocField',
 		'fieldname': 'company',
 		'fieldtype': 'Link',
-		'idx': 14,
+		'idx': 13,
 		'in_filter': 1,
 		'label': 'Company',
 		'oldfieldname': 'company',
@@ -263,7 +250,7 @@
 		'options': 'Company',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -273,7 +260,7 @@
 		'doctype': 'DocField',
 		'fieldname': 'supplier_details',
 		'fieldtype': 'Text',
-		'idx': 15,
+		'idx': 14,
 		'label': 'Supplier Details',
 		'oldfieldname': 'supplier_details',
 		'oldfieldtype': 'Code',
@@ -284,7 +271,7 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 16,
+		'idx': 15,
 		'permlevel': 0,
 		'width': '50%'
 	},
@@ -294,7 +281,7 @@
 		'doctype': 'DocField',
 		'fieldname': 'credit_days',
 		'fieldtype': 'Int',
-		'idx': 17,
+		'idx': 16,
 		'label': 'Credit Days',
 		'permlevel': 0
 	},
@@ -304,7 +291,7 @@
 		'doctype': 'DocField',
 		'fieldname': 'website',
 		'fieldtype': 'Data',
-		'idx': 18,
+		'idx': 17,
 		'label': 'Website',
 		'oldfieldname': 'website',
 		'oldfieldtype': 'Data',
@@ -317,7 +304,7 @@
 		'depends_on': 'eval:!doc.__islocal',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 19,
+		'idx': 18,
 		'label': 'Transaction History',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0
@@ -329,7 +316,7 @@
 		'depends_on': 'eval:!doc.__islocal',
 		'doctype': 'DocField',
 		'fieldtype': 'HTML',
-		'idx': 20,
+		'idx': 19,
 		'label': 'History HTML',
 		'oldfieldtype': 'HTML',
 		'permlevel': 0
@@ -340,7 +327,7 @@
 		'doctype': 'DocField',
 		'fieldname': 'trash_reason',
 		'fieldtype': 'Small Text',
-		'idx': 21,
+		'idx': 20,
 		'label': 'Trash Reason',
 		'oldfieldname': 'trash_reason',
 		'oldfieldtype': 'Small Text',
diff --git a/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.py b/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.py
index 486cc6d..159d393 100644
--- a/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.py
+++ b/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.py
@@ -1,2 +1,3 @@
+msgprint(colwidths)
 colwidths[col_idx['Pending Quantity To Receive']] = '200px'
 colwidths[col_idx['Pending Amount To Receive']] = '200px'
\ No newline at end of file
diff --git a/hr/doctype/attendance/attendance.txt b/hr/doctype/attendance/attendance.txt
index a52225e..4f189b1 100644
--- a/hr/doctype/attendance/attendance.txt
+++ b/hr/doctype/attendance/attendance.txt
@@ -141,7 +141,7 @@
 		'oldfieldtype': 'Select',
 		'options': '\nPresent\nAbsent\nHalf Day',
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -193,7 +193,7 @@
 		'oldfieldname': 'att_date',
 		'oldfieldtype': 'Date',
 		'reqd': 1,
-		'search_index': 0
+		'search_index': 1
 	},
 
 	# DocField
diff --git a/hr/doctype/educational_qualifications/educational_qualifications.txt b/hr/doctype/educational_qualifications/educational_qualifications.txt
index 21f4a9a..d57139b 100644
--- a/hr/doctype/educational_qualifications/educational_qualifications.txt
+++ b/hr/doctype/educational_qualifications/educational_qualifications.txt
@@ -75,7 +75,7 @@
 		'oldfieldtype': 'Select',
 		'options': '\nGraduate\nPost Graduate\nUnder Graduate',
 		'reqd': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/hr/doctype/employee/employee.txt b/hr/doctype/employee/employee.txt
index cbe281d..49a494b 100644
--- a/hr/doctype/employee/employee.txt
+++ b/hr/doctype/employee/employee.txt
@@ -173,7 +173,8 @@
 		'oldfieldname': 'employee_name',
 		'oldfieldtype': 'Data',
 		'permlevel': 0,
-		'reqd': 1
+		'reqd': 1,
+		'search_index': 1
 	},
 
 	# DocField
@@ -275,7 +276,7 @@
 		'options': '\nActive\nLeft',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -408,7 +409,8 @@
 		'oldfieldtype': 'Link',
 		'options': 'Department',
 		'permlevel': 0,
-		'reqd': 1
+		'reqd': 1,
+		'search_index': 1
 	},
 
 	# DocField
diff --git a/hr/doctype/expense_voucher/expense_voucher.txt b/hr/doctype/expense_voucher/expense_voucher.txt
index 0f7812e..596d4b5 100644
--- a/hr/doctype/expense_voucher/expense_voucher.txt
+++ b/hr/doctype/expense_voucher/expense_voucher.txt
@@ -189,7 +189,7 @@
 		'oldfieldname': 'employee_name',
 		'oldfieldtype': 'Data',
 		'permlevel': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '150px'
 	},
 
diff --git a/hr/doctype/leave_allocation/leave_allocation.txt b/hr/doctype/leave_allocation/leave_allocation.txt
index 0b0c96c..b147a7f 100644
--- a/hr/doctype/leave_allocation/leave_allocation.txt
+++ b/hr/doctype/leave_allocation/leave_allocation.txt
@@ -136,7 +136,7 @@
 		'in_filter': 1,
 		'label': 'Employee Name',
 		'permlevel': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/hr/doctype/leave_application/leave_application.txt b/hr/doctype/leave_application/leave_application.txt
index 11d01e6..06b4170 100644
--- a/hr/doctype/leave_application/leave_application.txt
+++ b/hr/doctype/leave_application/leave_application.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-02-17 13:25:56',
+		'creation': '2011-02-10 14:10:08',
 		'docstatus': 0,
-		'modified': '2011-07-08 13:28:15',
+		'modified': '2011-07-11 12:48:49',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
@@ -54,28 +54,28 @@
 
 	# DocPerm
 	{
-		'amend': 0,
-		'cancel': 0,
+		'amend': 1,
+		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
 		'idx': 1,
+		'match': 'owner',
 		'permlevel': 0,
-		'role': 'Employee',
-		'submit': 0,
+		'submit': 1,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
 		'doctype': 'DocPerm',
 		'idx': 2,
+		'match': 'owner',
 		'permlevel': 0,
-		'role': 'HR User',
-		'submit': 1,
-		'write': 1
+		'submit': 0,
+		'write': 0
 	},
 
 	# DocPerm
@@ -86,6 +86,19 @@
 		'doctype': 'DocPerm',
 		'idx': 3,
 		'permlevel': 0,
+		'role': 'HR User',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': 'DocPerm',
+		'idx': 4,
+		'permlevel': 0,
 		'role': 'HR Manager',
 		'submit': 1,
 		'write': 1
@@ -93,28 +106,18 @@
 
 	# DocPerm
 	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
 		'doctype': 'DocPerm',
-		'idx': 4,
+		'idx': 5,
 		'permlevel': 1,
-		'role': 'HR User',
-		'submit': 0,
-		'write': 0
+		'role': 'HR User'
 	},
 
 	# DocPerm
 	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
 		'doctype': 'DocPerm',
-		'idx': 5,
+		'idx': 6,
 		'permlevel': 1,
-		'role': 'HR Manager',
-		'submit': 0,
-		'write': 0
+		'role': 'HR Manager'
 	},
 
 	# DocField
@@ -149,7 +152,7 @@
 		'in_filter': 1,
 		'label': 'Employee Name',
 		'permlevel': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -201,7 +204,7 @@
 		'options': 'link:Fiscal Year',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -234,6 +237,7 @@
 		'idx': 10,
 		'label': 'From Date',
 		'permlevel': 0,
+		'search_index': 1,
 		'trigger': 'Client'
 	},
 
@@ -246,6 +250,7 @@
 		'idx': 11,
 		'label': 'To Date',
 		'permlevel': 0,
+		'search_index': 1,
 		'trigger': 'Client'
 	},
 
diff --git a/hr/doctype/salary_slip/salary_slip.txt b/hr/doctype/salary_slip/salary_slip.txt
index d2ce4e3..423b6c0 100644
--- a/hr/doctype/salary_slip/salary_slip.txt
+++ b/hr/doctype/salary_slip/salary_slip.txt
@@ -5,7 +5,7 @@
 	{
 		'creation': '2010-08-08 17:09:20',
 		'docstatus': 0,
-		'modified': '2011-07-13 17:38:55',
+		'modified': '2011-07-27 13:10:28',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
@@ -21,7 +21,7 @@
 		'server_code_error': ' ',
 		'show_in_menu': 0,
 		'subject': 'For %(employee_name)s, %(designation)s',
-		'version': 392
+		'version': 393
 	},
 
 	# These values are common for all DocField
@@ -51,21 +51,21 @@
 
 	# DocPerm
 	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
 		'doctype': 'DocPerm',
 		'idx': 1,
+		'match': 'owner',
 		'permlevel': 0,
-		'role': 'System Manager',
-		'submit': 1,
-		'write': 1
+		'role': 'Employee',
+		'submit': 0,
+		'write': 0
 	},
 
 	# DocPerm
 	{
 		'amend': 0,
-		'cancel': 0,
 		'create': 1,
 		'doctype': 'DocPerm',
 		'idx': 2,
@@ -77,8 +77,8 @@
 
 	# DocPerm
 	{
-		'amend': 0,
-		'cancel': 0,
+		'amend': 1,
+		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
 		'idx': 3,
@@ -90,28 +90,18 @@
 
 	# DocPerm
 	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
 		'doctype': 'DocPerm',
 		'idx': 4,
 		'permlevel': 1,
-		'role': 'HR User',
-		'submit': 0,
-		'write': 0
+		'role': 'HR User'
 	},
 
 	# DocPerm
 	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
 		'doctype': 'DocPerm',
 		'idx': 5,
 		'permlevel': 1,
-		'role': 'HR Manager',
-		'submit': 0,
-		'write': 0
+		'role': 'HR Manager'
 	},
 
 	# DocField
@@ -148,7 +138,7 @@
 		'options': 'Employee',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 0
+		'search_index': 1
 	},
 
 	# DocField
@@ -178,7 +168,7 @@
 		'options': 'Department',
 		'permlevel': 1,
 		'reqd': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -193,7 +183,7 @@
 		'oldfieldtype': 'Link',
 		'options': 'Designation',
 		'permlevel': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -208,7 +198,7 @@
 		'oldfieldtype': 'Link',
 		'options': 'Branch',
 		'permlevel': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -223,7 +213,7 @@
 		'oldfieldtype': 'Link',
 		'options': 'Grade',
 		'permlevel': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -285,7 +275,7 @@
 		'options': 'Fiscal Year',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/knowledge_base/doctype/question/question.txt b/knowledge_base/doctype/question/question.txt
index 428d269..187789c 100644
--- a/knowledge_base/doctype/question/question.txt
+++ b/knowledge_base/doctype/question/question.txt
@@ -115,7 +115,8 @@
 		'label': 'Tag 1',
 		'oldfieldname': 'tag_1',
 		'oldfieldtype': 'Link',
-		'options': 'Question Tag'
+		'options': 'Question Tag',
+		'search_index': 0
 	},
 
 	# DocField
@@ -136,7 +137,8 @@
 		'label': 'Tag 2',
 		'oldfieldname': 'tag_2',
 		'oldfieldtype': 'Link',
-		'options': 'Question Tag'
+		'options': 'Question Tag',
+		'search_index': 0
 	},
 
 	# DocField
@@ -148,7 +150,8 @@
 		'label': 'Tag 3',
 		'oldfieldname': 'tag_3',
 		'oldfieldtype': 'Link',
-		'options': 'Question Tag'
+		'options': 'Question Tag',
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/patches/erpnext_structure_cleanup.py b/patches/erpnext_structure_cleanup.py
index 8b765de..e78a82e 100644
--- a/patches/erpnext_structure_cleanup.py
+++ b/patches/erpnext_structure_cleanup.py
@@ -195,6 +195,6 @@
 	sync_mapper()
 	delete_unwanted_modules()
 	# landed cost wizard link in stock
-	reload_doc('stock', 'Module Def', 'stock')
+	reload_doc('stock', 'Module Def', 'Stock')
 	
 	sql("commit")
diff --git a/patches/index_patch.py b/patches/index_patch.py
index 8f6c4f2..3ef8ec3 100644
--- a/patches/index_patch.py
+++ b/patches/index_patch.py
@@ -2,6 +2,9 @@
 	This patch removes wrong indexs and add proper indexes in tables
 """
 
+import webnotes
+sql = webnotes.conn.sql
+from webnotes.utils import cint, cstr
 
 def create_proper_index():
 	from webnotes.modules.export_module import export_to_files
@@ -264,29 +267,29 @@
 						'Print Heading': [], 
 						'TDS Rate Detail': ['category']
 					}
-				
-	for dt in dt_index_fields.keys():
-		current_index = sql("show indexes from `tab%s`" % dt)
+	#sql("commit") # only required if run from login
+	exist_dt = [cstr(d[0]) for d in sql("select name from `tabDocType`")]
 	
-		proper_index = dt_index_fields[dt]
+	for dt in [d for d in dt_index_fields.keys() if d in exist_dt]:
+		try:
+			current_index = sql("show indexes from `tab%s`" % dt)
 	
-		for d in current_index:
-			if d[4] not in ['name', 'parent', 'parenttype']:
-				if d[4] not in proper_index:
-					sql("ALTER TABLE `tab%s` DROP INDEX %s" % (dt, d[4]))
-					sql("start transaction")
-					sql("UPDATE `tabDocField` SET search_index = 0 WHERE fieldname = '%s' AND parent = '%s'" % (d[4], dt))
-					sql("commit")
-				else:
-					proper_index.remove(d[4])
+			proper_index = dt_index_fields[dt]
 	
-		for d in proper_index:
-			sql("ALTER TABLE `tab%s` ADD INDEX ( `%s` ) " % (dt, d))
-			sql("start transaction")
-			sql("UPDATE `tabDocField` SET search_index = 1 WHERE fieldname = '%s' AND parent = '%s'" % (d, dt))
-			sql("commit")
-
-		sql("start transaction")		
-		dt_module = sql("select module from `tabDocType` where name = '%s'" % dt)[0][0]
-		export_to_files(record_list = [['DocType', dt]], record_module = dt_module)
-		sql("commit")
+			for d in current_index:
+				if d[4] not in ['name', 'parent', 'parenttype']:
+					if d[4] not in proper_index:
+						sql("ALTER TABLE `tab%s` DROP INDEX %s" % (dt, d[4]))
+						sql("start transaction")
+						sql("UPDATE `tabDocField` SET search_index = 0 WHERE fieldname = '%s' AND parent = '%s'" % (d[4], dt))
+						sql("commit")
+					else:
+						proper_index.remove(d[4])
+	
+			for d in proper_index:
+				sql("ALTER TABLE `tab%s` ADD INDEX ( `%s` ) " % (dt, d))
+				sql("start transaction")
+				sql("UPDATE `tabDocField` SET search_index = 1 WHERE fieldname = '%s' AND parent = '%s'" % (d, dt))
+				sql("commit")
+		except:
+			continue
diff --git a/patches/patch.py b/patches/patch.py
index 6eaced7..86fcff6 100644
--- a/patches/patch.py
+++ b/patches/patch.py
@@ -1,7 +1,7 @@
 # REMEMBER to update this
 # ========================
 
-last_patch = 327
+last_patch = 332
 
 #-------------------------------------------
 
@@ -46,7 +46,7 @@
 		for d in path_list:
 			doclist = eval(open(d,'r').read())
 			webnotes.conn.sql("update `tab%s` set module = '%s' where name = '%s'" % (doclist[0]['doctype'], doclist[0]['module'], doclist[0]['name']))
-	
+
 	elif patch_no==38:
 		import webnotes
 		webnotes.conn.set_global("system_message", "System Updates: Hello! You would have noticed some changes on the Home Page. As a part of our commitment to make the system more friendly and social, we have re-designed the feed so that now you will only see feed that is relevant to you (either you have created something or you have been mentioned in the document).<br><br>On the individual listings, you can add tags and also color them!<br><br>You will also get time-to-time updates from our side here. Do keep sending your feedback at support@erpnext.com.")
@@ -56,7 +56,6 @@
 		pass
 
 	elif patch_no == 40:
-		
 		import_from_files(record_list=[['stock','doctype','item']])
 	elif patch_no == 42:
 		acc = sql("select name, lft, rgt from tabAccount where account_name in ('Incomes', 'Expenses')")
@@ -65,7 +64,7 @@
 	elif patch_no == 43:
 		import webnotes.model
 		webnotes.model.delete_doc('Page', 'Module Manager')
-	
+
 	# cleanup of Service, Customer Support, Utilities Modules
 	# -------------------------------------------------------
 	elif patch_no == 44:
@@ -86,7 +85,7 @@
 
 		# remove utilities
 		webnotes.conn.sql('delete from `tabModule Def` where name in ("Customer Support", "Utilities")')
-		
+
 	elif patch_no == 45:
 		webnotes.conn.sql('delete from tabDocField where options="Ticket Response Detail"')
 
@@ -125,7 +124,6 @@
 	elif patch_no == 56:
 		sql("delete from `tabModule Def Item` where parent = 'CRM' and doc_type = 'Reports' and doc_name = 'Delivery Note' and display_name = 'Territory, Item Group wise GP'")
 	elif patch_no == 57:
-		
 		import_from_files(record_list=[['selling','doctype','sales_order_detail']])
 	elif patch_no == 58:
 		# module def patches
@@ -133,24 +131,24 @@
 		sql("delete from `tabModule Def Item` where doc_type in ('Separator', 'Setup Forms', 'More Reports')")
 		sql("delete from `tabModule Def Item` where doc_name = 'Project Activity'")
 		sql("update `tabModule Def` set module_label = 'People', disabled='No', is_hidden='No' where name = 'My Company'")
-		
+
 		# insert new module items
 		from webnotes.model.doc import make_autoname
 		if not sql("select name from `tabModule Def Item` where parent='Projects' and doc_name='Ticket'"):
-			sql("""insert into `tabModule Def Item` 
-				(name, parent, parenttype, parentfield, docstatus, doc_type, doc_name, display_name, idx) values 
+			sql("""insert into `tabModule Def Item`
+				(name, parent, parenttype, parentfield, docstatus, doc_type, doc_name, display_name, idx) values
 				(%s, 'Projects', 'Module Def', 'items', 0, 'Forms', 'Ticket', 'Task', 1)""", make_autoname('MDI.#####'))
 
 		if not sql("select name from `tabModule Def Item` where parent='Projects' and doc_name='Timesheet'"):
-			sql("""insert into `tabModule Def Item` 
-				(name, parent, parenttype, parentfield, docstatus, doc_type, doc_name, display_name, idx) values 
+			sql("""insert into `tabModule Def Item`
+				(name, parent, parenttype, parentfield, docstatus, doc_type, doc_name, display_name, idx) values
 				(%s, 'Projects', 'Module Def', 'items', 0, 'Forms', 'Timesheet', 'Timesheet', 2)""", make_autoname('MDI.#####'))
-			
+
 		if not sql("select name from `tabModule Def Item` where parent='Projects' and doc_name='Projects'"):
-			sql("""insert into `tabModule Def Item` 
-				(name, parent, parenttype, parentfield, docstatus, doc_type, doc_name, display_name, idx) values 
+			sql("""insert into `tabModule Def Item`
+				(name, parent, parenttype, parentfield, docstatus, doc_type, doc_name, display_name, idx) values
 				(%s, 'Projects', 'Module Def', 'items', 0, 'Pages', 'Projects', 'Gantt Chart', 1)""", make_autoname('MDI.#####'))
-				
+
 	elif patch_no == 59:
 		webnotes.conn.set_value('Control Panel',None,'mail_footer','')
 		webnotes.conn.set_global('global_mail_footer','<div style="margin-top:8px; padding: 8px; font-size: 11px; text-align:right; border-top: 1px solid #AAA">Sent via <a href="https://www.erpnext.com">ERPNext</a></div>')
@@ -160,16 +158,14 @@
 		sql("delete from `tabTDS Category Account` where company not in (select name from tabCompany)")
 	elif patch_no == 62:
 		# Import Supplier Quotation
-		
 		import_from_files(record_list=[['buying','doctype','supplier_quotation']])
 		# Adding Status Filter
 		sql("update tabDocType set search_fields = concat('status,',search_fields) where name IN ('Delivery Note','Leave Transaction')")
 		# Import Other Charges
-		
+
 		import_from_files(record_list=[['setup','doctype','other_charges']])
 	elif patch_no == 63:
 		sql("update `tabDocField` set permlevel = 1 where fieldname in ('return_date', 'return_details') and parent = 'Sales and Purchase Return Wizard'")
-		
 		import_from_files(record_list = [['accounts', 'doctype', 'rv_detail'], ['stock', 'doctype', 'sales_and_purchase_return_wizard'], ['stock', 'doctype', 'stock_entry']])
 	elif patch_no == 64:
 		sql("update tabDocField set `hidden` = 1, `print_hide` = 1, `report_hide` = 1 where options in ('RFQ','Supplier Quotation')")
@@ -183,7 +179,7 @@
 		import webnotes
 		webnotes.conn.set_global("system_message", """<h3>UI Updates</h3>Based on user feedback, we have made a couple of changes in the UI:<ul><li>Sidebar menus are now collapsable</li><li>Forms are now scrollable (we removed the confusing tabs)</li><li>Feed is a lot more descriptive</li></ul>Do send us your feedback!""")
 		webnotes.conn.set_global("system_message_id", "4")
-		
+
 		sql("update `tabModule Def Item` set doc_type = 'Setup Forms' where doc_name in ('TDS Payment', 'TDS Return Acknowledgement', 'Form 16A', 'Period Closing Voucher', 'IT Checklist')")
 		from webnotes.session_cache import clear_cache
 		clear_cache(webnotes.session['user'])
@@ -212,7 +208,7 @@
 			for d in fld_map:
 				emp_obj.doc.fields[d] = prof_obj.doc.fields[d]
 			emp_obj.doc.current_accommodation_type = prof_obj.doc.present_accommodation_type
-		 
+
 			# address
 			per_addr = cstr(e[2]) + '\n' + cstr(e[3]) + '\n' + cstr(e[4]) + '\n' + cstr(e[5]) + ', ' + cstr(e[6]) + '\n' + 'PIN - ' + cstr(e[7]) + '\n' + 'Ph. No' + cstr(e[8])
 			cur_addr = cstr(e[9]) + '\n' + cstr(e[10]) + '\n' + cstr(e[11]) + '\n' + cstr(e[12]) + ', ' + cstr(e[13]) + '\n' + 'PIN - ' + cstr(e[14]) + '\n' + 'Ph. No' + cstr(e[15])
@@ -244,7 +240,7 @@
 	elif patch_no == 70:
 		# update search criteria module -> System
 		sql("update tabDocType set module='System' where name='Search Criteria'")
-		
+
 		# Cleanups to Contact
 		sql("update tabDocField set fieldtype='Data' where options='Designation' and parent='Contact'")
 		sql("update tabDocField set fieldtype='Data' where options='Department' and parent='Contact'")
@@ -254,10 +250,10 @@
 		from webnotes.modules.import_module import import_from_files
 		import_from_files(record_list=[['utilities','doctype','contact']])
 
-		
+
 		# remove last_contact_date from Lead
 		sql("delete from tabDocField where fieldname='last_contact_date' and parent='Lead'")
-		
+
 	elif patch_no == 71:
 		# Make Stock Qty and Conversion Factor field editable. Also no need to mention Conversion factor in table can do it directly
 		sql("update `tabDocField` set `permlevel` = 0, `width` = '100px', `trigger` = 'Client' where parent IN ('PO Detail','Purchase Receipt Detail') and fieldname in ('stock_qty','conversion_factor')")
@@ -266,18 +262,18 @@
 	elif patch_no == 72:
 		# Core Patch
 		# ----------
-		
+
 		from webnotes.modules.import_module import import_from_files
-		
+
 		# import module def
 		import_from_files(record_list = [['core', 'Module Def', 'Core']])
 	elif patch_no == 73:
 		# set module in DocTypes
 		sql("update tabDocType set module='Core' where name in ('DocType', 'DocField', 'DocPerm', 'Role', 'UserRole', 'Profile', 'Print Format', 'DocFormat', 'Control Panel', 'Event', 'Event Role', 'Event User', 'DefaultValue', 'Default Home Page', 'File', 'File Group', 'File Data', 'Letter Head', 'Module Def', 'Module Def Item', 'Module Def Role', 'Page', 'Page Role', 'Search Criteria', 'DocType Label', 'DocType Mapper', 'Field Mapper Detail', 'Table Mapper Detail')")
-		
+
 		# set module in Page
 		sql("update tabPage set module='Core' where name='Login Page'")
-		
+
 		# move file browser to Tools
 		sql("update tabPage set module='Tools' where name='File Browser'")
 		sql("update tabDocType set module='Tools' where name='File Browser Control'")
@@ -351,7 +347,6 @@
 		p.add_permission('Salary Slip', 'Employee', 1, read = 1, match = 'owner')
 	elif patch_no == 79:
 		# Import Modules
-		
 		import_from_files(record_list=[['hr','doctype','leave_application'],['hr','doctype','leave_allocation'],['hr','doctype','leave_control_panel'],['hr','doctype','holiday_list'],['hr','doctype','holiday_list_detail'],['hr','Module Def','Payroll']])
 	elif patch_no == 80:
 		# Holiday List
@@ -405,7 +400,6 @@
 
 	elif patch_no == 81:
 		# Import Modules
-		
 		import_from_files(record_list=[['hr','Module Def','Payroll']])
 	elif patch_no == 82:
 		sql("update tabDocType set search_fields = 'employee,leave_type,total_leaves_allocated,fiscal_year' where name = 'Leave Allocation'")
@@ -432,13 +426,11 @@
 		sql("update tabDocPerm set `match` = '' where parent = 'Leave Application' and role = 'HR User'")
 	elif patch_no == 86:
 		# Import Modules
-		
 		import_from_files(record_list=[['hr','doctype','leave_type']])
 	elif patch_no == 87:
 		sql("update `tabLeave Type` set is_lwp = 1 where name = 'Leave Without Pay'")
 	elif patch_no == 88:
 		# Import Modules
-		
 		import_from_files(record_list=[['hr','doctype','leave_allocation']])
 	elif patch_no == 89:
 		sql("delete from `tabModule Def Item` where doc_type = 'Setup Forms' and doc_name in ('Payroll Rule', 'IT Checklist', 'Employee Profile') and parent = 'Payroll'")
@@ -457,10 +449,8 @@
 		sql("update `tabTable Mapper Detail` set validation_logic = 'qty > ifnull(billed_qty,0) and docstatus = 1' where parent = 'Sales Order-Receivable Voucher' and from_table = 'Sales Order Detail'")
 		sql("update `tabField Mapper Detail` set from_field = 'customer' where to_field = 'customer' and parent = 'Sales Order-Receivable Voucher'")
 	elif patch_no == 94:
-		
 		import_from_files(record_list=[['selling','doctype','sms_center']])
 	elif patch_no == 95:
-		
 		import_from_files(record_list=[['mapper','DocType Mapper','Sales Order-Receivable Voucher'], ['mapper','DocType Mapper','Delivery Note-Receivable Voucher']])
 	elif patch_no == 96:
 		sql("delete from `tabModule Def Item` where doc_type = 'Reports' and display_name = 'Cenvat Credit - Input or Capital Goods' and parent = 'Accounts'")
@@ -490,7 +480,6 @@
 	elif patch_no == 103:
 		sql("update tabDocField set fieldname = '' where fieldtype = 'HTML'")
 	elif patch_no == 104:
-		
 		import_from_files(record_list=[['hr','search_criteria','stdsrch_00001'],['hr','search_criteria','stdsrch_00002'],['hr','search_criteria','stdsrch_00003'],['hr','Module Def','Payroll'],['hr','doctype','leave_application'],['hr','doctype','leave_allocation']])
 	elif patch_no == 105:
 		# Employee Leave Balance
@@ -535,7 +524,7 @@
 		# patch for timesheet cleanup
 		from webnotes.model import delete_doc
 		delete_doc('DocType', 'Timesheet Detail')
-		
+
 		from webnotes.modules.import_module import import_from_files
 		import_from_files(record_list = [['Projects', 'DocType', 'Timesheet'], ['Projects', 'DocType', 'Timesheet Detail'], ['Projects', 'DocType', 'Activity Type']])
 
@@ -543,7 +532,7 @@
 		# again!
 		from webnotes.model import delete_doc
 		delete_doc('DocType', 'Timesheet Detail')
-		
+
 		from webnotes.modules.import_module import import_from_files
 		import_from_files(record_list = [['Projects', 'DocType', 'Timesheet Detail']])
 	elif patch_no == 117:
@@ -646,13 +635,13 @@
 	elif patch_no == 142:
 		# fixes to letter head and personalize
 		from webnotes.model import delete_doc
-		
+
 		delete_doc('DocType', 'Batch Settings')
 		delete_doc('DocType', 'Batch Settings Detail')
 		delete_doc('DocType', 'Social Badge')
 		delete_doc('Page', 'Personalize Page')
 		delete_doc('DocType', 'Personalize Page Control')
-		
+
 		import_from_files(record_list=[['core','doctype','letter_head'], ['setup','doctype','personalize']])
 	elif patch_no == 144:
 		webnotes.conn.sql("update tabDocField set fieldtype='Code' where parent='Letter Head' and fieldname='content'")
@@ -917,7 +906,7 @@
 		reload_doc('knowledge_base', 'page', 'questions')
 		reload_doc('knowledge_base', 'Module Def', 'Knowledge Base')
 		sql("update `tabModule Def` set disabled='No' where name='Knowledge Base'")
-	elif patch_no == 229:		
+	elif patch_no == 229:
 		reload_doc('knowledge_base', 'page', 'question_view')
 	elif patch_no == 230:
 		reload_doc('buying', 'doctype', 'indent')
@@ -933,7 +922,7 @@
 	elif patch_no == 234:
 		sql("update `tabTable Mapper Detail` set validation_logic = 'docstatus=1' where parent = 'Sales Order-Indent' and from_table = 'Sales Order Detail'")
 	elif patch_no == 235:
-		for sc in sql("""select name from `tabSearch Criteria` where ifnull(name,'') 
+		for sc in sql("""select name from `tabSearch Criteria` where ifnull(name,'')
 			like 'srch%' or ifnull(name,'') like '%stdsrch'"""):
 			try:
 				get_obj('Search Criteria', sc[0]).rename()
@@ -951,7 +940,6 @@
 	elif patch_no == 239:
 		reload_doc('core', 'doctype', 'docfield')
 		reload_doc('core', 'doctype', 'doctype')
-		
 		from patches.old_patches.feed_patch import set_subjects_and_tagfields
 		set_subjects_and_tagfields()
 	elif patch_no == 240:
@@ -1026,7 +1014,7 @@
 		sql("update `tabItem` set description_html = replace(description_html, 'http://46.4.50.84/v170-test/', '')")
 	elif patch_no == 257:
 		from patches.old_patches.customer_address import run_old_data_sync_patch
-		run_old_data_sync_patch()	
+		run_old_data_sync_patch()
 	elif patch_no == 258:
 		sql("update tabDocField set `default`=NULL where fieldname = 'naming_series'")
 	elif patch_no == 259:
@@ -1050,7 +1038,7 @@
 	elif patch_no == 263:
 		ol = ['','Open','To Reply','Waiting for Customer','Hold','Closed']
 		sql("update tabDocField set options=%s where parent=%s and fieldname=%s", ('\n'.join(ol), 'Support Ticket', 'status'))
-	elif patch_no == 264:	
+	elif patch_no == 264:
 		sql("delete from tabDocField where parent = 'Customer Issue' and (fieldname = 'issue_in' or fieldname = 'issue_category')")
 		sql("update tabDocField set options=NULL where parent='Support Ticket' and label = 'Send'")
 	elif patch_no == 266:
@@ -1077,12 +1065,12 @@
 		reload_doc('selling','doctype','sales_order')
 		reload_doc('stock','doctype','delivery_note')
 		sql("delete from tabDocField where fieldname='per_amt_billed' and parent in ('Sales Order', 'Delivery Note')")
-		
-		sql("""update `tabSales Order` set delivery_status = if(ifnull(per_delivered,0) < 0.001, 'Not Delivered', 
+
+		sql("""update `tabSales Order` set delivery_status = if(ifnull(per_delivered,0) < 0.001, 'Not Delivered',
 				if(per_delivered >= 99.99, 'Fully Delivered', 'Partly Delivered'))""")
-		sql("""update `tabSales Order` set billing_status = if(ifnull(per_billed,0) < 0.001, 'Not Billed', 
+		sql("""update `tabSales Order` set billing_status = if(ifnull(per_billed,0) < 0.001, 'Not Billed',
 				if(per_billed >= 99.99, 'Fully Billed', 'Partly Billed'))""")
-		sql("""update `tabDelivery Note` set billing_status = if(ifnull(per_billed,0) < 0.001, 'Not Billed', 
+		sql("""update `tabDelivery Note` set billing_status = if(ifnull(per_billed,0) < 0.001, 'Not Billed',
 				if(per_billed >= 99.99, 'Fully Billed', 'Partly Billed'))""")
 	elif patch_no == 272:
 		from webnotes.model import delete_doc
@@ -1116,7 +1104,7 @@
 			rec = sql("select voucher_type, voucher_no, ifnull(is_cancelled, 'No') from `tab%s` where modified >= '2011-06-15 01:00:00' group by voucher_no" % t)
 			for d in rec:
 				sql("update `tab%s` set docstatus = %s where name = '%s'" % (d[0], d[2]=='No' and 1 or 2, d[1]))
-			
+
 		other_dt = ['Enquiry', 'Quotation', 'Sales Order', 'Indent', 'Purchase Order', 'Production Order', 'Customer Issue', 'Installation Note']
 		for dt in other_dt:
 			rec = sql("select name, status from `tab%s` where modified >= '2011-06-15 01:00:00'" % dt)
@@ -1151,9 +1139,9 @@
 		reload_doc('accounts', 'doctype', 'payable_voucher')
 	elif patch_no == 289:
 		sql("update `tabDocType` set subject = 'From %(supplier_name)s worth %(grand_total)s due on %(due_date)s | %(outstanding_amount)s outstanding' where name = 'Payable Voucher'")
-		sql("update `tabDocType` set search_fields = 'status,transaction_date,customer,lead,order_type' where name = 'Quotation'")		
+		sql("update `tabDocType` set search_fields = 'status,transaction_date,customer,lead,order_type' where name = 'Quotation'")
 	elif patch_no == 290:
-		count = sql("""SELECT * FROM  `tabModule Def` 
+		count = sql("""SELECT * FROM  `tabModule Def`
 			   WHERE `module_name` LIKE 'Home'""")
 		if not count:
 			md = Document('Module Def')
@@ -1236,14 +1224,14 @@
 			rec = sql("select voucher_type, voucher_no, ifnull(is_cancelled, 'No') from `tab%s` where modified >= '2011-07-06 10:00:00' group by voucher_no" % t)
 			for d in rec:
 				sql("update `tab%s` set docstatus = %s where name = '%s'" % (d[0], d[2]=='No' and 1 or 2, d[1]))
-			
+
 		other_dt = ['Enquiry', 'Quotation', 'Sales Order', 'Indent', 'Purchase Order', 'Production Order', 'Customer Issue', 'Installation Note']
 		for dt in other_dt:
 			rec = sql("select name, status from `tab%s` where modified >= '2011-07-06 10:00:00'" % dt)
 			for r in rec:
 				sql("update `tab%s` set docstatus = %s where name = '%s'" % (dt, (r[1] in ['Submitted', 'Closed'] and 1 or r[1]=='Cancelled' and 2 or 0), r[0]))
-				
-				
+
+
 		dt_list = ['Delivery Note', 'Purchase Receipt']
 		for dt in dt_list:
 			sql("update `tab%s` set status = 'Submitted' where docstatus = 1 and modified >='2011-07-06 10:00:00'" % dt)
@@ -1254,7 +1242,7 @@
 			tbl = sql("select options from `tabDocField` where fieldtype = 'Table' and parent = '%s'" % d)
 			for t in tbl:
 				sql("update `tab%s` t1, `tab%s` t2 set t1.docstatus = t2.docstatus where t1.parent = t2.name" % (t[0], d))
-				
+
 	elif patch_no == 314:
 		# delete double feed
 		sql("delete from tabFeed where subject like 'New %'")
@@ -1273,7 +1261,7 @@
 	elif patch_no == 316:
 		pass
 	elif patch_no == 317:
-		sql("update `tabPage` set name = 'profile-settings' where page_name = 'Profile Settings'")	
+		sql("update `tabPage` set name = 'profile-settings' where page_name = 'Profile Settings'")
 	elif patch_no == 318:
 		reload_doc('utilities', 'doctype', 'bulk_rename_tool')
 	elif patch_no == 319:
@@ -1300,7 +1288,7 @@
 	elif patch_no == 327:
 		# patch for support email settings now moved to email settings
 		reload_doc('setup','doctype','email_settings')
-		
+
 		# map fields from support to email settings
 		field_map = {
 			'support_email': 'email',
@@ -1311,14 +1299,40 @@
 			'sync_support_mails': 'integrate_incoming',
 			'signature': 'support_signature'
 		}
-		
+
 		for key in field_map:
 			webnotes.conn.set_value('Email Settings',None,key, \
 				webnotes.conn.get_value('Support Email Settings',None,field_map[key]))
-		
+
 		# delete support email settings
 		from webnotes.model import delete_doc
 		delete_doc('DocType', 'Support Email Settings')
 
 		reload_doc('support','doctype','support_ticket')
 		sql("delete from tabDocField where fieldname='problem_description' and parent='Support Ticket'")
+	elif patch_no == 328:
+		if webnotes.conn.get_value('Control Panel', None, 'account_id') != 'axjanak2011':
+			sql("delete from `tabDocField` where fieldname = 'supplier_status' and parent = 'Supplier'")
+	elif patch_no == 329:
+		reload_doc('utilities', 'doctype', 'rename_tool')
+		reload_doc('utilities', 'doctype', 'bulk_rename_tool')
+	elif patch_no == 330:
+		reload_doc('accounts', 'doctype', 'lease_agreement')
+		reload_doc('accounts', 'doctype', 'lease_installment')
+
+		reload_doc('accounts', 'search_criteria', 'lease_agreement_list')
+		reload_doc('accounts', 'search_criteria', 'lease_monthly_future_installment_inflows')
+		reload_doc('accounts', 'search_criteria', 'lease_overdue_age_wise')
+		reload_doc('accounts', 'search_criteria', 'lease_over_due_list')
+		reload_doc('accounts', 'search_criteria', 'lease_receipts_client_wise')
+		reload_doc('accounts', 'search_criteria', 'lease_receipt_summary_year_to_date')
+		reload_doc('accounts', 'search_criteria', 'lease_yearly_future_installment_inflows')
+
+		reload_doc('accounts', 'Module Def', 'Accounts')
+	elif patch_no == 331:
+		p = get_obj('Patch Util')
+		# permission
+		p.add_permission('Lease Agreement', 'Accounts Manager', 0, read = 1, write=1,submit=1, cancel=1,amend=1)
+		p.add_permission('Lease Agreement', 'Accounts Manager', 1, read = 1)
+	elif patch_no == 332:
+		sql("update `tabDocField` set permlevel=1, hidden = 1 where parent = 'Bulk Rename Tool' and fieldname = 'file_list'")
diff --git a/production/doctype/bill_of_materials/bill_of_materials.txt b/production/doctype/bill_of_materials/bill_of_materials.txt
index 4e788d7..37d8b69 100644
--- a/production/doctype/bill_of_materials/bill_of_materials.txt
+++ b/production/doctype/bill_of_materials/bill_of_materials.txt
@@ -12,6 +12,7 @@
 
 	# These values are common for all DocType
 	{
+		'_last_update': '1309508837',
 		'allow_attach': 0,
 		'allow_copy': 0,
 		'allow_email': 0,
diff --git a/production/doctype/bom_operation/bom_operation.txt b/production/doctype/bom_operation/bom_operation.txt
index 873faec..9bc7f9e 100644
--- a/production/doctype/bom_operation/bom_operation.txt
+++ b/production/doctype/bom_operation/bom_operation.txt
@@ -114,6 +114,7 @@
 		'options': 'Workstation',
 		'permlevel': 0,
 		'reqd': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
diff --git a/production/doctype/bom_replace_utility_detail/bom_replace_utility_detail.txt b/production/doctype/bom_replace_utility_detail/bom_replace_utility_detail.txt
index ab18e44..d36f26b 100644
--- a/production/doctype/bom_replace_utility_detail/bom_replace_utility_detail.txt
+++ b/production/doctype/bom_replace_utility_detail/bom_replace_utility_detail.txt
@@ -99,6 +99,7 @@
 		'oldfieldname': 'bom_created',
 		'oldfieldtype': 'Link',
 		'options': 'Bill Of Materials',
-		'permlevel': 1
+		'permlevel': 1,
+		'search_index': 0
 	}
 ]
\ No newline at end of file
diff --git a/production/doctype/flat_bom_detail/flat_bom_detail.txt b/production/doctype/flat_bom_detail/flat_bom_detail.txt
index 4b8812b..7339300 100644
--- a/production/doctype/flat_bom_detail/flat_bom_detail.txt
+++ b/production/doctype/flat_bom_detail/flat_bom_detail.txt
@@ -162,7 +162,8 @@
 		'label': 'Stock UOM',
 		'oldfieldname': 'stock_uom',
 		'oldfieldtype': 'Link',
-		'options': 'UOM'
+		'options': 'UOM',
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/production/doctype/pp_detail/pp_detail.txt b/production/doctype/pp_detail/pp_detail.txt
index 61a34bd..482fae2 100644
--- a/production/doctype/pp_detail/pp_detail.txt
+++ b/production/doctype/pp_detail/pp_detail.txt
@@ -131,7 +131,7 @@
 		'oldfieldtype': 'Date',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '100px'
 	},
 
@@ -146,6 +146,7 @@
 		'oldfieldtype': 'Link',
 		'options': 'Bill Of Materials',
 		'permlevel': 0,
+		'search_index': 0,
 		'width': '100px'
 	},
 
diff --git a/production/doctype/production_order/production_order.txt b/production/doctype/production_order/production_order.txt
index 7df6397..c927edf 100644
--- a/production/doctype/production_order/production_order.txt
+++ b/production/doctype/production_order/production_order.txt
@@ -180,6 +180,7 @@
 		'options': 'Bill Of Materials',
 		'permlevel': 1,
 		'reqd': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
@@ -306,7 +307,8 @@
 		'oldfieldtype': 'Link',
 		'options': 'Warehouse',
 		'permlevel': 0,
-		'reqd': 1
+		'reqd': 1,
+		'search_index': 0
 	},
 
 	# DocField
@@ -323,7 +325,8 @@
 		'oldfieldtype': 'Link',
 		'options': 'Warehouse',
 		'permlevel': 0,
-		'reqd': 1
+		'reqd': 1,
+		'search_index': 0
 	},
 
 	# DocField
@@ -367,7 +370,8 @@
 		'oldfieldtype': 'Link',
 		'options': 'Company',
 		'permlevel': 0,
-		'reqd': 1
+		'reqd': 1,
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/production/doctype/update_delivery_date_detail/update_delivery_date_detail.txt b/production/doctype/update_delivery_date_detail/update_delivery_date_detail.txt
index f8499ce..646a97e 100644
--- a/production/doctype/update_delivery_date_detail/update_delivery_date_detail.txt
+++ b/production/doctype/update_delivery_date_detail/update_delivery_date_detail.txt
@@ -86,7 +86,8 @@
 		'oldfieldname': 'state',
 		'oldfieldtype': 'Link',
 		'options': 'State',
-		'permlevel': 0
+		'permlevel': 0,
+		'search_index': 0
 	},
 
 	# DocField
@@ -100,7 +101,8 @@
 		'oldfieldtype': 'Link',
 		'options': 'Territory',
 		'permlevel': 1,
-		'print_hide': 1
+		'print_hide': 1,
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/projects/doctype/project/project.txt b/projects/doctype/project/project.txt
index b144246..3d57e12 100644
--- a/projects/doctype/project/project.txt
+++ b/projects/doctype/project/project.txt
@@ -94,7 +94,8 @@
 		'oldfieldname': 'project_name',
 		'oldfieldtype': 'Data',
 		'permlevel': 0,
-		'reqd': 1
+		'reqd': 1,
+		'search_index': 1
 	},
 
 	# DocField
@@ -112,7 +113,7 @@
 		'options': 'Open\nCompleted\nCancelled',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -356,7 +357,7 @@
 		'oldfieldname': 'customer_name',
 		'oldfieldtype': 'Data',
 		'permlevel': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -401,6 +402,7 @@
 		'options': 'Territory',
 		'permlevel': 0,
 		'reqd': 0,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
@@ -438,7 +440,8 @@
 		'oldfieldname': 'customer_group',
 		'oldfieldtype': 'Link',
 		'options': 'Customer Group',
-		'permlevel': 1
+		'permlevel': 1,
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/projects/doctype/timesheet/timesheet.txt b/projects/doctype/timesheet/timesheet.txt
index 462b64b..839da19 100644
--- a/projects/doctype/timesheet/timesheet.txt
+++ b/projects/doctype/timesheet/timesheet.txt
@@ -145,7 +145,8 @@
 		'oldfieldtype': 'Link',
 		'options': 'Profile',
 		'permlevel': 0,
-		'reqd': 1
+		'reqd': 1,
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/projects/doctype/timesheet_detail/timesheet_detail.txt b/projects/doctype/timesheet_detail/timesheet_detail.txt
index a96c14b..0098228 100644
--- a/projects/doctype/timesheet_detail/timesheet_detail.txt
+++ b/projects/doctype/timesheet_detail/timesheet_detail.txt
@@ -75,6 +75,7 @@
 		'options': 'Activity Type',
 		'permlevel': 0,
 		'reqd': 1,
+		'search_index': 0,
 		'width': '200px'
 	},
 
diff --git a/selling/doctype/customer/customer.txt b/selling/doctype/customer/customer.txt
index 364b148..24271ee 100644
--- a/selling/doctype/customer/customer.txt
+++ b/selling/doctype/customer/customer.txt
@@ -5,14 +5,14 @@
 	{
 		'creation': '2010-08-08 17:08:56',
 		'docstatus': 0,
-		'modified': '2011-05-26 17:31:31',
+		'modified': '2011-07-20 10:42:05',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1306834669',
+		'_last_update': '1309508837',
 		'allow_print': 0,
 		'allow_trash': 1,
 		'colour': 'White:FFF',
@@ -26,7 +26,7 @@
 		'show_in_menu': 0,
 		'subject': "eval:'%(customer_name)s'=='%(name)s' ? ' ' : '%(customer_name)s'",
 		'tag_fields': 'customer_group,customer_type',
-		'version': 431
+		'version': 433
 	},
 
 	# These values are common for all DocField
@@ -176,7 +176,7 @@
 		'idx': 4,
 		'label': 'Series',
 		'no_copy': 1,
-		'options': '\nCUST\nCUSTMUM',
+		'options': '\nCUST\nCUSTMUM\nCUSTOM',
 		'permlevel': 0,
 		'print_hide': 0
 	},
@@ -340,7 +340,7 @@
 		'options': 'Company',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/selling/doctype/enquiry/enquiry.txt b/selling/doctype/enquiry/enquiry.txt
index c13ad46..260e077 100644
--- a/selling/doctype/enquiry/enquiry.txt
+++ b/selling/doctype/enquiry/enquiry.txt
@@ -187,7 +187,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 0,
-		'search_index': 0,
+		'search_index': 1,
 		'trigger': 'Client'
 	},
 
@@ -244,6 +244,7 @@
 		'options': 'Lead',
 		'permlevel': 0,
 		'print_hide': 1,
+		'search_index': 1,
 		'trigger': 'Client'
 	},
 
@@ -326,6 +327,7 @@
 		'oldfieldtype': 'Date',
 		'permlevel': 0,
 		'reqd': 1,
+		'search_index': 1,
 		'width': '50px'
 	},
 
@@ -405,7 +407,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
@@ -426,7 +428,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 0,
-		'search_index': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
@@ -492,7 +494,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -509,7 +511,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/selling/doctype/enquiry_detail/enquiry_detail.txt b/selling/doctype/enquiry_detail/enquiry_detail.txt
index bd9275b..284b436 100644
--- a/selling/doctype/enquiry_detail/enquiry_detail.txt
+++ b/selling/doctype/enquiry_detail/enquiry_detail.txt
@@ -90,7 +90,8 @@
 		'oldfieldname': 'item_group',
 		'oldfieldtype': 'Link',
 		'options': 'Item Group',
-		'print_hide': 1
+		'print_hide': 1,
+		'search_index': 0
 	},
 
 	# DocField
@@ -104,7 +105,8 @@
 		'oldfieldname': 'brand',
 		'oldfieldtype': 'Link',
 		'options': 'Brand',
-		'print_hide': 1
+		'print_hide': 1,
+		'search_index': 0
 	},
 
 	# DocField
@@ -140,6 +142,7 @@
 		'label': 'UOM',
 		'oldfieldname': 'uom',
 		'oldfieldtype': 'Link',
-		'options': 'UOM'
+		'options': 'UOM',
+		'search_index': 0
 	}
 ]
\ No newline at end of file
diff --git a/selling/doctype/installation_note/installation_note.txt b/selling/doctype/installation_note/installation_note.txt
index adfce20..8feb2f5 100644
--- a/selling/doctype/installation_note/installation_note.txt
+++ b/selling/doctype/installation_note/installation_note.txt
@@ -201,7 +201,7 @@
 		'oldfieldtype': 'Data',
 		'permlevel': 1,
 		'reqd': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -257,7 +257,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -292,7 +292,8 @@
 		'oldfieldname': 'inst_date',
 		'oldfieldtype': 'Date',
 		'permlevel': 0,
-		'reqd': 1
+		'reqd': 1,
+		'search_index': 1
 	},
 
 	# DocField
@@ -340,7 +341,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
diff --git a/selling/doctype/installed_item_details/installed_item_details.txt b/selling/doctype/installed_item_details/installed_item_details.txt
index 7971cb5..3b4632c 100644
--- a/selling/doctype/installed_item_details/installed_item_details.txt
+++ b/selling/doctype/installed_item_details/installed_item_details.txt
@@ -140,7 +140,7 @@
 		'oldfieldtype': 'Data',
 		'permlevel': 1,
 		'print_hide': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '150px'
 	},
 
diff --git a/selling/doctype/lead/lead.txt b/selling/doctype/lead/lead.txt
index a476c66..2387323 100644
--- a/selling/doctype/lead/lead.txt
+++ b/selling/doctype/lead/lead.txt
@@ -188,7 +188,7 @@
 		'options': "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign\nWebsite",
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
@@ -239,7 +239,7 @@
 		'oldfieldtype': 'Data',
 		'permlevel': 0,
 		'reqd': 0,
-		'search_index': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
@@ -350,7 +350,7 @@
 		'options': '\nHot\nWarm\nCold',
 		'permlevel': 0,
 		'reqd': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -616,7 +616,7 @@
 		'oldfieldtype': 'Link',
 		'options': 'Profile',
 		'permlevel': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -633,7 +633,7 @@
 		'options': '\nLower Income\nMiddle Income\nUpper Income',
 		'permlevel': 0,
 		'reqd': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/selling/doctype/quotation/quotation.txt b/selling/doctype/quotation/quotation.txt
index e198b86..6763c2d 100644
--- a/selling/doctype/quotation/quotation.txt
+++ b/selling/doctype/quotation/quotation.txt
@@ -414,7 +414,7 @@
 		'permlevel': 0,
 		'print_hide': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -435,7 +435,7 @@
 		'permlevel': 1,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -520,7 +520,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
@@ -539,7 +539,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 0,
-		'search_index': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
@@ -584,7 +584,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'trigger': 'Client',
 		'width': '100px'
 	},
@@ -1035,7 +1035,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'trigger': 'Client',
 		'width': '150px'
 	},
@@ -1055,7 +1055,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/selling/doctype/quotation_detail/quotation_detail.txt b/selling/doctype/quotation_detail/quotation_detail.txt
index 074443b..23c86fa 100644
--- a/selling/doctype/quotation_detail/quotation_detail.txt
+++ b/selling/doctype/quotation_detail/quotation_detail.txt
@@ -73,7 +73,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '150px'
 	},
 
@@ -260,7 +260,7 @@
 		'options': 'Item Group',
 		'permlevel': 1,
 		'print_hide': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -276,7 +276,7 @@
 		'options': 'Brand',
 		'permlevel': 1,
 		'print_hide': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '150px'
 	},
 
diff --git a/selling/doctype/return_detail/return_detail.txt b/selling/doctype/return_detail/return_detail.txt
index 7091b3f..4c1e2f7 100644
--- a/selling/doctype/return_detail/return_detail.txt
+++ b/selling/doctype/return_detail/return_detail.txt
@@ -75,7 +75,8 @@
 		'oldfieldname': 'uom',
 		'oldfieldtype': 'Link',
 		'options': 'UOM',
-		'permlevel': 1
+		'permlevel': 1,
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/selling/doctype/sales_order_detail/sales_order_detail.txt b/selling/doctype/sales_order_detail/sales_order_detail.txt
index e89768c..7e46d74 100644
--- a/selling/doctype/sales_order_detail/sales_order_detail.txt
+++ b/selling/doctype/sales_order_detail/sales_order_detail.txt
@@ -394,7 +394,7 @@
 		'options': 'Brand',
 		'permlevel': 1,
 		'print_hide': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -410,7 +410,7 @@
 		'options': 'Item Group',
 		'permlevel': 1,
 		'print_hide': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/setup/doctype/authorization_rule/authorization_rule.txt b/setup/doctype/authorization_rule/authorization_rule.txt
index ef20f36..a436495 100644
--- a/setup/doctype/authorization_rule/authorization_rule.txt
+++ b/setup/doctype/authorization_rule/authorization_rule.txt
@@ -79,7 +79,8 @@
 		'oldfieldname': 'company',
 		'oldfieldtype': 'Link',
 		'options': 'Company',
-		'reqd': 0
+		'reqd': 0,
+		'search_index': 0
 	},
 
 	# DocField
@@ -157,7 +158,8 @@
 		'label': 'Applicable To (Employee)',
 		'oldfieldname': 'to_emp',
 		'oldfieldtype': 'Link',
-		'options': 'Employee'
+		'options': 'Employee',
+		'search_index': 0
 	},
 
 	# DocField
@@ -171,7 +173,8 @@
 		'label': 'Applicable To (Designation)',
 		'oldfieldname': 'to_designation',
 		'oldfieldtype': 'Link',
-		'options': 'Designation'
+		'options': 'Designation',
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/setup/doctype/company/company.txt b/setup/doctype/company/company.txt
index a7498d6..15ba781 100644
--- a/setup/doctype/company/company.txt
+++ b/setup/doctype/company/company.txt
@@ -5,7 +5,7 @@
 	{
 		'creation': '2010-08-08 17:08:55',
 		'docstatus': 0,
-		'modified': '2011-07-06 11:42:34',
+		'modified': '2011-07-01 17:43:29',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
diff --git a/setup/doctype/naming_series_options/naming_series_options.txt b/setup/doctype/naming_series_options/naming_series_options.txt
index f30686d..b964556 100644
--- a/setup/doctype/naming_series_options/naming_series_options.txt
+++ b/setup/doctype/naming_series_options/naming_series_options.txt
@@ -66,7 +66,8 @@
 		'idx': 1,
 		'label': 'Doc Type',
 		'oldfieldname': 'doc_type',
-		'oldfieldtype': 'Data'
+		'oldfieldtype': 'Data',
+		'search_index': 1
 	},
 
 	# DocField
diff --git a/setup/doctype/other_charges/other_charges.txt b/setup/doctype/other_charges/other_charges.txt
index b9908fc..ac9c6c5 100644
--- a/setup/doctype/other_charges/other_charges.txt
+++ b/setup/doctype/other_charges/other_charges.txt
@@ -160,7 +160,7 @@
 		'oldfieldtype': 'Data',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -186,7 +186,7 @@
 		'options': 'Company',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/setup/doctype/sales_partner/sales_partner.txt b/setup/doctype/sales_partner/sales_partner.txt
index a61a9fb..18b3abb 100644
--- a/setup/doctype/sales_partner/sales_partner.txt
+++ b/setup/doctype/sales_partner/sales_partner.txt
@@ -191,7 +191,7 @@
 		'oldfieldtype': 'Select',
 		'options': '\nChannel Partner\nDistributor\nDealer\nAgent\nRetailer\nImplementation Partner\nReseller',
 		'permlevel': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/setup/doctype/sales_person/sales_person.txt b/setup/doctype/sales_person/sales_person.txt
index 0ffcd74..0680c38 100644
--- a/setup/doctype/sales_person/sales_person.txt
+++ b/setup/doctype/sales_person/sales_person.txt
@@ -156,7 +156,7 @@
 		'oldfieldtype': 'Data',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -281,7 +281,7 @@
 		'oldfieldtype': 'Select',
 		'options': 'link:Country',
 		'permlevel': 0,
-		'search_index': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
@@ -297,7 +297,7 @@
 		'oldfieldtype': 'Select',
 		'options': 'link:State',
 		'permlevel': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -324,7 +324,8 @@
 		'oldfieldname': 'territory',
 		'oldfieldtype': 'Link',
 		'options': 'Territory',
-		'permlevel': 0
+		'permlevel': 0,
+		'search_index': 0
 	},
 
 	# DocField
@@ -397,7 +398,8 @@
 		'oldfieldname': 'distribution_id',
 		'oldfieldtype': 'Link',
 		'options': 'Budget Distribution',
-		'permlevel': 0
+		'permlevel': 0,
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/setup/doctype/term/term.txt b/setup/doctype/term/term.txt
index f169780..fe3bd75 100644
--- a/setup/doctype/term/term.txt
+++ b/setup/doctype/term/term.txt
@@ -155,7 +155,7 @@
 		'oldfieldtype': 'Data',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/setup/doctype/territory/territory.txt b/setup/doctype/territory/territory.txt
index 0bf94f3..a4de2d6 100644
--- a/setup/doctype/territory/territory.txt
+++ b/setup/doctype/territory/territory.txt
@@ -160,7 +160,7 @@
 		'oldfieldtype': 'Link',
 		'options': 'Sales Person',
 		'permlevel': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -267,7 +267,8 @@
 		'oldfieldname': 'distribution_id',
 		'oldfieldtype': 'Link',
 		'options': 'Budget Distribution',
-		'permlevel': 0
+		'permlevel': 0,
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/setup/doctype/upload_accounts_transactions/__init__.py b/setup/doctype/upload_accounts_transactions/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/doctype/upload_accounts_transactions/__init__.py
diff --git a/setup/doctype/upload_accounts_transactions/upload_accounts_transactions.js b/setup/doctype/upload_accounts_transactions/upload_accounts_transactions.js
new file mode 100644
index 0000000..041638f
--- /dev/null
+++ b/setup/doctype/upload_accounts_transactions/upload_accounts_transactions.js
@@ -0,0 +1,18 @@
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+	if(!doc.file_list) {
+		set_field_options('Upload Accounts Transactions Help', '<div class="help_box">To upload transactions, please attach a (.csv) file with 5 columns - <b>Date, Transaction Number, Account, Debit Amount, Credit Amount</b> (no headings necessary). See attachments box in the right column</div>')
+	} else {
+		set_field_options('Upload Accounts Transactions Help', '<div class="help_box">To update transactions from the attachment, please click on "Upload Accounts Transactions"</div>')
+	}
+}
+
+cur_frm.cscript['Upload Accounts Transactions'] = function(doc, cdt, cdn) {
+	if(confirm("This action will append all transactions and cannot be un-done. Are you sure you want to continue?")) {
+		$c_obj([doc], 'upload_accounts_transactions', '', function(r, rt) { });
+	}
+}
diff --git a/setup/doctype/upload_accounts_transactions/upload_accounts_transactions.py b/setup/doctype/upload_accounts_transactions/upload_accounts_transactions.py
new file mode 100644
index 0000000..2028e5f
--- /dev/null
+++ b/setup/doctype/upload_accounts_transactions/upload_accounts_transactions.py
@@ -0,0 +1,103 @@
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+
+# -----------------------------------------------------------------------------------------
+
+class DocType:
+	def __init__(self, d, dl):
+		self.doc, self.doclist = d, dl
+		self.cl = []
+
+	# upload transactions
+	def upload_accounts_transactions(self):
+		import csv
+		data = csv.reader(self.get_csv_data().splitlines())
+
+		abbr = sql("select concat(' - ',abbr) as abbr from tabCompany where name=%s",self.doc.company)
+		updated = 0
+		jv_name=''
+#		jv = Document('Journal Voucher')
+		global line,jv,name,jv_go
+		for line in data:
+			if len(line)>=7: #Minimum no of fields
+				if line[3]!=jv_name: #Create JV
+					if jv_name!='':
+						jv_go = get_obj('Journal Voucher',name, with_children=1)
+						jv_go.validate()
+						jv_go.on_submit()
+
+					jv_name=line[3]
+					jv = Document('Journal Voucher')
+					jv.voucher_type = line[0]
+					jv.naming_series = line[1]
+					jv.voucher_date = formatdate(line[2])
+					jv.posting_date = formatdate(line[2])
+#					jv.name = line[3]
+					jv.fiscal_year = self.doc.fiscal_year
+					jv.company = self.doc.company
+					jv.remark = len(line)==8 and line[3]+' '+line[7] or line[3]+' Uploaded Record'
+					jv.docstatus=1
+					jv.save(1)
+					name=jv.name
+
+					jc = addchild(jv,'entries','Journal Voucher Detail',0)
+					jc.account = line[4]+abbr[0][0]
+					jc.cost_center=len(line)==9 and line[8] or self.doc.default_cost_center
+					if line[5]!='':
+						jc.debit = line[5]
+					else:
+						jc.credit = line[6]
+					jc.save()
+
+				else: #Create JV Child
+					jc = addchild(jv,'entries','Journal Voucher Detail',0)
+					jc.account = line[4]+abbr[0][0]
+					jc.cost_center=len(line)==9 and line[8] or self.doc.default_cost_center
+					if line[5]!='':
+						jc.debit = line[5]
+					else:
+						jc.credit = line[6]
+					jc.save()
+			else:
+				msgprint("[Ignored] Incorrect format: %s" % str(line))
+		if jv_name!='':
+			jv_go = get_obj('Journal Voucher',name, with_children=1)
+			jv_go.validate()
+			jv_go.on_submit()
+
+		msgprint("<b>%s</b> items updated" % updated)
+
+	# clear prices
+	def clear_prices(self):
+		cnt = sql("select count(*) from `tabRef Rate Detail` where price_list_name = %s", self.doc.name)
+		sql("delete from `tabRef Rate Detail` where price_list_name = %s", self.doc.name)
+		msgprint("%s prices cleared" % cnt[0][0])
+
+	# Update CSV data
+	def get_csv_data(self):
+		if not self.doc.file_list:
+		  msgprint("File not attached!")
+		  raise Exception
+
+		fid = self.doc.file_list.split(',')[1]
+
+		from webnotes.utils import file_manager
+		fn, content = file_manager.get_file(fid)
+
+		if not type(content) == str:
+		  content = content.tostring()
+
+		return content
diff --git a/setup/doctype/upload_accounts_transactions/upload_accounts_transactions.txt b/setup/doctype/upload_accounts_transactions/upload_accounts_transactions.txt
new file mode 100644
index 0000000..d637a88
--- /dev/null
+++ b/setup/doctype/upload_accounts_transactions/upload_accounts_transactions.txt
@@ -0,0 +1,126 @@
+# DocType, Upload Accounts Transactions
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2011-07-18 14:56:48',
+		'docstatus': 0,
+		'modified': '2011-07-19 12:19:13',
+		'modified_by': 'Administrator',
+		'owner': 'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'_last_update': '1310985428',
+		'allow_attach': 1,
+		'colour': 'White:FFF',
+		'doctype': 'DocType',
+		'issingle': 1,
+		'max_attachments': 1,
+		'module': 'Setup',
+		'name': '__common__',
+		'section_style': 'Simple',
+		'show_in_menu': 1,
+		'version': 5
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': 'DocField',
+		'name': '__common__',
+		'parent': 'Upload Accounts Transactions',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0
+	},
+
+	# These values are common for all DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': 'DocPerm',
+		'execute': 1,
+		'idx': 1,
+		'name': '__common__',
+		'parent': 'Upload Accounts Transactions',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'Accounts Manager',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocType, Upload Accounts Transactions
+	{
+		'doctype': 'DocType',
+		'name': 'Upload Accounts Transactions'
+	},
+
+	# DocPerm
+	{
+		'doctype': 'DocPerm'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldtype': 'HTML',
+		'idx': 1,
+		'label': 'Usage',
+		'options': '<div class="help_box">\n<b>Upload Account Transactions Help</b>\n<p>To update the account transactions, upload a CSV file with five columns Date, Transaction Number, Account Name, Credit and Debit amount and click on the "Upload Account Transactions" button. The system will add the transactions.\n</div>'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Link',
+		'idx': 2,
+		'label': 'Fiscal Year',
+		'options': 'Fiscal Year',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Link',
+		'idx': 3,
+		'label': 'Company',
+		'options': 'Company',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'default_cost_center',
+		'fieldtype': 'Link',
+		'idx': 4,
+		'label': 'Default Cost Center',
+		'options': 'Cost Center',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'file_list',
+		'fieldtype': 'Small Text',
+		'hidden': 1,
+		'idx': 5,
+		'label': 'File List'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldtype': 'Button',
+		'idx': 6,
+		'label': 'Upload Accounts Transactions'
+	}
+]
\ No newline at end of file
diff --git a/setup/doctype/workflow_rule/workflow_rule.txt b/setup/doctype/workflow_rule/workflow_rule.txt
index d95a481..7c35826 100644
--- a/setup/doctype/workflow_rule/workflow_rule.txt
+++ b/setup/doctype/workflow_rule/workflow_rule.txt
@@ -106,7 +106,7 @@
 		'oldfieldtype': 'Select',
 		'options': '\nActive\nInactive',
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/stock/doctype/bin/bin.txt b/stock/doctype/bin/bin.txt
index 2ecbcf0..6a40297 100644
--- a/stock/doctype/bin/bin.txt
+++ b/stock/doctype/bin/bin.txt
@@ -162,7 +162,7 @@
 		'label': 'Reserved Quantity',
 		'oldfieldname': 'reserved_qty',
 		'oldfieldtype': 'Currency',
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -176,7 +176,7 @@
 		'label': 'Actual Quantity',
 		'oldfieldname': 'actual_qty',
 		'oldfieldtype': 'Currency',
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -190,7 +190,7 @@
 		'label': 'Ordered Quantity',
 		'oldfieldname': 'ordered_qty',
 		'oldfieldtype': 'Currency',
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -204,7 +204,7 @@
 		'label': 'Indented Quantity',
 		'oldfieldname': 'indented_qty',
 		'oldfieldtype': 'Currency',
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -217,7 +217,7 @@
 		'label': 'Planned Qty',
 		'oldfieldname': 'planned_qty',
 		'oldfieldtype': 'Currency',
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -258,7 +258,7 @@
 		'label': 'UOM',
 		'oldfieldname': 'stock_uom',
 		'oldfieldtype': 'Data',
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/stock/doctype/delivery_note/delivery_note.txt b/stock/doctype/delivery_note/delivery_note.txt
index 0c1cc52..97280e9 100644
--- a/stock/doctype/delivery_note/delivery_note.txt
+++ b/stock/doctype/delivery_note/delivery_note.txt
@@ -332,7 +332,7 @@
 		'permlevel': 0,
 		'print_hide': 0,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '100px'
 	},
 
@@ -352,7 +352,7 @@
 		'permlevel': 1,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '150px'
 	},
 
@@ -372,7 +372,7 @@
 		'oldfieldtype': 'Currency',
 		'permlevel': 1,
 		'print_hide': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -391,7 +391,7 @@
 		'oldfieldtype': 'Currency',
 		'permlevel': 1,
 		'print_hide': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -439,7 +439,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -453,7 +453,7 @@
 		'options': 'Customer Group',
 		'permlevel': 0,
 		'print_hide': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -1014,7 +1014,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '150px'
 	},
 
@@ -1032,7 +1032,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '150px'
 	},
 
diff --git a/stock/doctype/delivery_note_detail/delivery_note_detail.txt b/stock/doctype/delivery_note_detail/delivery_note_detail.txt
index f5dd8bf..78aea32 100644
--- a/stock/doctype/delivery_note_detail/delivery_note_detail.txt
+++ b/stock/doctype/delivery_note_detail/delivery_note_detail.txt
@@ -285,7 +285,8 @@
 		'oldfieldtype': 'Link',
 		'options': 'Batch',
 		'permlevel': 0,
-		'print_hide': 1
+		'print_hide': 1,
+		'search_index': 0
 	},
 
 	# DocField
@@ -299,7 +300,8 @@
 		'oldfieldtype': 'Link',
 		'options': 'Item Group',
 		'permlevel': 1,
-		'print_hide': 1
+		'print_hide': 1,
+		'search_index': 0
 	},
 
 	# DocField
@@ -314,6 +316,7 @@
 		'options': 'Brand',
 		'permlevel': 1,
 		'print_hide': 1,
+		'search_index': 0,
 		'width': '150px'
 	},
 
@@ -423,7 +426,7 @@
 		'oldfieldtype': 'Data',
 		'permlevel': 1,
 		'print_hide': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '150px'
 	},
 
@@ -455,7 +458,7 @@
 		'oldfieldtype': 'Data',
 		'permlevel': 1,
 		'print_hide': 1,
-		'search_index': 0,
+		'search_index': 1,
 		'width': '150px'
 	},
 
diff --git a/stock/doctype/delivery_note_packing_detail/delivery_note_packing_detail.txt b/stock/doctype/delivery_note_packing_detail/delivery_note_packing_detail.txt
index 10fdfda..3924c13 100644
--- a/stock/doctype/delivery_note_packing_detail/delivery_note_packing_detail.txt
+++ b/stock/doctype/delivery_note_packing_detail/delivery_note_packing_detail.txt
@@ -178,7 +178,8 @@
 		'oldfieldname': 'uom',
 		'oldfieldtype': 'Link',
 		'options': 'UOM',
-		'permlevel': 1
+		'permlevel': 1,
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/stock/doctype/item/item.txt b/stock/doctype/item/item.txt
index a20c968..ec42ff4 100644
--- a/stock/doctype/item/item.txt
+++ b/stock/doctype/item/item.txt
@@ -12,7 +12,7 @@
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1308741898',
+		'_last_update': '1309508838',
 		'allow_attach': 1,
 		'allow_trash': 1,
 		'autoname': 'field:item_code',
@@ -197,7 +197,7 @@
 		'oldfieldtype': 'Data',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -241,7 +241,8 @@
 		'options': 'Brand',
 		'permlevel': 0,
 		'print_hide': 1,
-		'reqd': 0
+		'reqd': 0,
+		'search_index': 0
 	},
 
 	# DocField
@@ -312,7 +313,8 @@
 		'oldfieldtype': 'Link',
 		'options': 'UOM',
 		'permlevel': 0,
-		'reqd': 1
+		'reqd': 1,
+		'search_index': 0
 	},
 
 	# DocField
@@ -355,7 +357,8 @@
 		'oldfieldname': 'default_warehouse',
 		'oldfieldtype': 'Link',
 		'options': 'Warehouse',
-		'permlevel': 0
+		'permlevel': 0,
+		'search_index': 0
 	},
 
 	# DocField
@@ -556,6 +559,7 @@
 		'oldfieldtype': 'Link',
 		'options': 'Account',
 		'permlevel': 0,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
@@ -571,7 +575,8 @@
 		'oldfieldname': 'cost_center',
 		'oldfieldtype': 'Link',
 		'options': 'Cost Center',
-		'permlevel': 0
+		'permlevel': 0,
+		'search_index': 0
 	},
 
 	# DocField
@@ -719,7 +724,8 @@
 		'idx': 43,
 		'label': 'Default Income Account',
 		'options': 'Account',
-		'permlevel': 0
+		'permlevel': 0,
+		'search_index': 0
 	},
 
 	# DocField
@@ -730,7 +736,8 @@
 		'idx': 44,
 		'label': 'Cost Center',
 		'options': 'Cost Center',
-		'permlevel': 0
+		'permlevel': 0,
+		'search_index': 0
 	},
 
 	# DocField
@@ -872,7 +879,8 @@
 		'oldfieldname': 'default_bom',
 		'oldfieldtype': 'Link',
 		'options': 'Bill Of Materials',
-		'permlevel': 1
+		'permlevel': 1,
+		'search_index': 0
 	},
 
 	# DocField
@@ -912,19 +920,6 @@
 	# DocField
 	{
 		'doctype': 'DocField',
-		'fieldname': 'item_attachments_details',
-		'fieldtype': 'Table',
-		'idx': 58,
-		'label': 'Item Attachments Details',
-		'oldfieldname': 'item_attachments_details',
-		'oldfieldtype': 'Table',
-		'options': 'Item Attachments Detail',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
 		'fieldname': 'file_list',
 		'fieldtype': 'Text',
 		'hidden': 1,
diff --git a/stock/doctype/landed_cost_detail/landed_cost_detail.txt b/stock/doctype/landed_cost_detail/landed_cost_detail.txt
index 78efae5..57c7370 100644
--- a/stock/doctype/landed_cost_detail/landed_cost_detail.txt
+++ b/stock/doctype/landed_cost_detail/landed_cost_detail.txt
@@ -49,7 +49,8 @@
 		'label': 'Account Head',
 		'oldfieldname': 'account_head',
 		'oldfieldtype': 'Link',
-		'options': 'Account'
+		'options': 'Account',
+		'search_index': 1
 	},
 
 	# DocField
diff --git a/stock/doctype/landed_cost_master/landed_cost_master.txt b/stock/doctype/landed_cost_master/landed_cost_master.txt
index e405274..71374f8 100644
--- a/stock/doctype/landed_cost_master/landed_cost_master.txt
+++ b/stock/doctype/landed_cost_master/landed_cost_master.txt
@@ -12,6 +12,7 @@
 
 	# These values are common for all DocType
 	{
+		'_last_update': '1309508838',
 		'autoname': 'field:title',
 		'colour': 'White:FFF',
 		'doctype': 'DocType',
diff --git a/stock/doctype/lc_pr_detail/lc_pr_detail.txt b/stock/doctype/lc_pr_detail/lc_pr_detail.txt
index 706af56..d09285d 100644
--- a/stock/doctype/lc_pr_detail/lc_pr_detail.txt
+++ b/stock/doctype/lc_pr_detail/lc_pr_detail.txt
@@ -48,7 +48,8 @@
 		'label': 'Purchase Receipt No',
 		'oldfieldname': 'purchase_receipt_no',
 		'oldfieldtype': 'Link',
-		'options': 'Purchase Receipt'
+		'options': 'Purchase Receipt',
+		'search_index': 1
 	},
 
 	# DocField
diff --git a/stock/doctype/purchase_receipt/purchase_receipt.txt b/stock/doctype/purchase_receipt/purchase_receipt.txt
index 9759630..31f6cd6 100644
--- a/stock/doctype/purchase_receipt/purchase_receipt.txt
+++ b/stock/doctype/purchase_receipt/purchase_receipt.txt
@@ -338,7 +338,7 @@
 		'oldfieldtype': 'Date',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'trigger': 'Client',
 		'width': '100px'
 	},
@@ -359,7 +359,7 @@
 		'permlevel': 1,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '150px'
 	},
 
@@ -888,7 +888,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '150px'
 	},
 
@@ -906,7 +906,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '150px'
 	},
 
diff --git a/stock/doctype/purchase_receipt_detail/purchase_receipt_detail.txt b/stock/doctype/purchase_receipt_detail/purchase_receipt_detail.txt
index d030b9e..a8e0d47 100644
--- a/stock/doctype/purchase_receipt_detail/purchase_receipt_detail.txt
+++ b/stock/doctype/purchase_receipt_detail/purchase_receipt_detail.txt
@@ -100,6 +100,7 @@
 		'options': 'UOM',
 		'permlevel': 0,
 		'reqd': 1,
+		'search_index': 0,
 		'trigger': 'Client',
 		'width': '100px'
 	},
@@ -324,6 +325,7 @@
 		'options': 'Batch',
 		'permlevel': 0,
 		'print_hide': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
@@ -342,6 +344,7 @@
 		'options': 'Warehouse',
 		'permlevel': 1,
 		'print_hide': 1,
+		'search_index': 0,
 		'width': '100px'
 	},
 
@@ -358,7 +361,8 @@
 		'oldfieldtype': 'Link',
 		'options': 'QA Inspection Report',
 		'permlevel': 0,
-		'print_hide': 1
+		'print_hide': 1,
+		'search_index': 0
 	},
 
 	# DocField
@@ -373,7 +377,8 @@
 		'oldfieldtype': 'Link',
 		'options': 'Brand',
 		'permlevel': 1,
-		'print_hide': 1
+		'print_hide': 1,
+		'search_index': 0
 	},
 
 	# DocField
@@ -390,7 +395,7 @@
 		'options': 'Item Group',
 		'permlevel': 1,
 		'print_hide': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -474,7 +479,7 @@
 		'permlevel': 1,
 		'print_hide': 1,
 		'reqd': 0,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '150px'
 	},
 
diff --git a/stock/doctype/ref_rate_detail/ref_rate_detail.txt b/stock/doctype/ref_rate_detail/ref_rate_detail.txt
index 078fadc..1774b08 100644
--- a/stock/doctype/ref_rate_detail/ref_rate_detail.txt
+++ b/stock/doctype/ref_rate_detail/ref_rate_detail.txt
@@ -34,8 +34,7 @@
 		'parent': 'Ref Rate Detail',
 		'parentfield': 'fields',
 		'parenttype': 'DocType',
-		'permlevel': 0,
-		'search_index': 1
+		'permlevel': 0
 	},
 
 	# DocType, Ref Rate Detail
@@ -54,7 +53,8 @@
 		'oldfieldname': 'price_list_name',
 		'oldfieldtype': 'Select',
 		'options': 'link:Price List',
-		'reqd': 1
+		'reqd': 1,
+		'search_index': 1
 	},
 
 	# DocField
@@ -66,7 +66,8 @@
 		'label': 'Ref Rate',
 		'oldfieldname': 'ref_rate',
 		'oldfieldtype': 'Currency',
-		'reqd': 0
+		'reqd': 0,
+		'search_index': 0
 	},
 
 	# DocField
@@ -79,6 +80,7 @@
 		'oldfieldname': 'ref_currency',
 		'oldfieldtype': 'Select',
 		'options': 'link:Currency',
-		'reqd': 1
+		'reqd': 1,
+		'search_index': 1
 	}
 ]
\ No newline at end of file
diff --git a/stock/doctype/sales_bom/sales_bom.txt b/stock/doctype/sales_bom/sales_bom.txt
index 8863eb2..b97458a 100644
--- a/stock/doctype/sales_bom/sales_bom.txt
+++ b/stock/doctype/sales_bom/sales_bom.txt
@@ -268,6 +268,7 @@
 		'oldfieldname': 'stock_uom',
 		'oldfieldtype': 'Link',
 		'options': 'UOM',
-		'permlevel': 0
+		'permlevel': 0,
+		'search_index': 0
 	}
 ]
\ No newline at end of file
diff --git a/stock/doctype/sales_bom_detail/sales_bom_detail.txt b/stock/doctype/sales_bom_detail/sales_bom_detail.txt
index 31d2f1a..3b104e7 100644
--- a/stock/doctype/sales_bom_detail/sales_bom_detail.txt
+++ b/stock/doctype/sales_bom_detail/sales_bom_detail.txt
@@ -114,6 +114,7 @@
 		'oldfieldname': 'uom',
 		'oldfieldtype': 'Link',
 		'options': 'UOM',
-		'permlevel': 1
+		'permlevel': 1,
+		'search_index': 0
 	}
 ]
\ No newline at end of file
diff --git a/stock/doctype/serial_no/serial_no.txt b/stock/doctype/serial_no/serial_no.txt
index dd250ee..9aa6119 100644
--- a/stock/doctype/serial_no/serial_no.txt
+++ b/stock/doctype/serial_no/serial_no.txt
@@ -193,7 +193,7 @@
 		'oldfieldtype': 'Data',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -628,7 +628,7 @@
 		'oldfieldtype': 'Select',
 		'options': '\nUnder Warranty\nOut of Warranty\nUnder AMC\nOut of AMC',
 		'permlevel': 0,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '150px'
 	},
 
@@ -715,7 +715,7 @@
 		'options': 'link:Company',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -729,7 +729,7 @@
 		'options': 'link:Fiscal Year',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/stock/doctype/stock_entry/stock_entry.txt b/stock/doctype/stock_entry/stock_entry.txt
index 951986f..d7477c2 100644
--- a/stock/doctype/stock_entry/stock_entry.txt
+++ b/stock/doctype/stock_entry/stock_entry.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2009-05-12 16:46:45',
+		'creation': '2010-08-08 17:09:25',
 		'docstatus': 0,
-		'modified': '2011-07-10 14:12:39',
+		'modified': '2011-07-11 12:48:52',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
@@ -76,7 +76,7 @@
 		'doctype': 'DocPerm',
 		'idx': 1,
 		'permlevel': 0,
-		'role': 'Material User',
+		'role': 'Material Manager',
 		'submit': 1,
 		'write': 1
 	},
@@ -89,28 +89,35 @@
 		'doctype': 'DocPerm',
 		'idx': 2,
 		'permlevel': 1,
-		'role': 'Material User',
+		'role': 'Material Manager',
 		'submit': 0,
 		'write': 0
 	},
 
 	# DocPerm
 	{
-		'create': 0,
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
 		'doctype': 'DocPerm',
 		'idx': 3,
-		'permlevel': 2,
-		'role': 'Production User',
+		'permlevel': 0,
+		'role': 'Material User',
+		'submit': 1,
 		'write': 1
 	},
 
 	# DocPerm
 	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
 		'doctype': 'DocPerm',
 		'idx': 4,
-		'permlevel': 2,
-		'role': 'Production Manager',
-		'write': 1
+		'permlevel': 1,
+		'role': 'Material User',
+		'submit': 0,
+		'write': 0
 	},
 
 	# DocPerm
@@ -136,11 +143,21 @@
 
 	# DocPerm
 	{
+		'create': 0,
+		'doctype': 'DocPerm',
+		'idx': 7,
+		'permlevel': 2,
+		'role': 'Production User',
+		'write': 1
+	},
+
+	# DocPerm
+	{
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 7,
+		'idx': 8,
 		'permlevel': 0,
 		'role': 'Production Manager',
 		'submit': 1,
@@ -150,34 +167,17 @@
 	# DocPerm
 	{
 		'doctype': 'DocPerm',
-		'idx': 8,
+		'idx': 9,
 		'permlevel': 1,
 		'role': 'Production Manager'
 	},
 
 	# DocPerm
 	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 9,
-		'permlevel': 1,
-		'role': 'Material Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
 		'doctype': 'DocPerm',
 		'idx': 10,
-		'permlevel': 0,
-		'role': 'Material Manager',
-		'submit': 1,
+		'permlevel': 2,
+		'role': 'Production Manager',
 		'write': 1
 	},
 
@@ -209,14 +209,13 @@
 		'doctype': 'DocField',
 		'fieldname': 'naming_series',
 		'fieldtype': 'Select',
-		'hidden': 0,
 		'idx': 3,
 		'in_filter': 0,
 		'label': 'Series',
 		'no_copy': 1,
 		'oldfieldname': 'naming_series',
 		'oldfieldtype': 'Select',
-		'options': '\nSTE',
+		'options': 'STE',
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 0,
@@ -231,7 +230,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'amendment_date',
 		'fieldtype': 'Date',
-		'hidden': 0,
 		'idx': 4,
 		'in_filter': 0,
 		'label': 'Amendment Date',
@@ -241,7 +239,6 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 0,
-		'reqd': 0,
 		'search_index': 0
 	},
 
@@ -252,7 +249,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'purpose',
 		'fieldtype': 'Select',
-		'hidden': 0,
 		'idx': 5,
 		'in_filter': 1,
 		'label': 'Purpose',
@@ -261,7 +257,6 @@
 		'oldfieldtype': 'Select',
 		'options': 'Material Issue\nMaterial Receipt\nMaterial Transfer\nSales Return\nPurchase Return\nSubcontracting\nProduction Order',
 		'permlevel': 0,
-		'print_hide': 0,
 		'report_hide': 0,
 		'reqd': 1,
 		'search_index': 0,
@@ -286,8 +281,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 0,
-		'reqd': 0,
-		'search_index': 0,
+		'search_index': 1,
 		'trigger': 'Client'
 	},
 
@@ -309,8 +303,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 0,
-		'reqd': 0,
-		'search_index': 0,
+		'search_index': 1,
 		'trigger': 'Client'
 	},
 
@@ -345,7 +338,6 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 0,
-		'reqd': 0,
 		'search_index': 0,
 		'trigger': 'Client'
 	},
@@ -356,7 +348,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'supplier_name',
 		'fieldtype': 'Data',
-		'hidden': 0,
 		'idx': 10,
 		'in_filter': 0,
 		'label': 'Supplier Name',
@@ -364,9 +355,7 @@
 		'oldfieldname': 'supplier_name',
 		'oldfieldtype': 'Data',
 		'permlevel': 1,
-		'print_hide': 0,
 		'report_hide': 0,
-		'reqd': 0,
 		'search_index': 0
 	},
 
@@ -385,9 +374,7 @@
 		'oldfieldname': 'supplier_address',
 		'oldfieldtype': 'Small Text',
 		'permlevel': 0,
-		'print_hide': 0,
 		'report_hide': 0,
-		'reqd': 0,
 		'search_index': 0,
 		'trigger': 'Client'
 	},
@@ -410,7 +397,6 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 0,
-		'reqd': 0,
 		'search_index': 0,
 		'trigger': 'Client'
 	},
@@ -429,9 +415,7 @@
 		'oldfieldname': 'customer_name',
 		'oldfieldtype': 'Data',
 		'permlevel': 1,
-		'print_hide': 0,
 		'report_hide': 0,
-		'reqd': 0,
 		'search_index': 0
 	},
 
@@ -449,9 +433,7 @@
 		'oldfieldname': 'customer_address',
 		'oldfieldtype': 'Small Text',
 		'permlevel': 0,
-		'print_hide': 0,
 		'report_hide': 0,
-		'reqd': 0,
 		'search_index': 0
 	},
 
@@ -473,7 +455,6 @@
 		'permlevel': 2,
 		'print_hide': 1,
 		'report_hide': 0,
-		'reqd': 0,
 		'search_index': 0,
 		'trigger': 'Client'
 	},
@@ -496,8 +477,7 @@
 		'permlevel': 2,
 		'print_hide': 1,
 		'report_hide': 0,
-		'reqd': 0,
-		'search_index': 0,
+		'search_index': 1,
 		'trigger': 'Client'
 	},
 
@@ -507,7 +487,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'fg_completed_qty',
 		'fieldtype': 'Currency',
-		'hidden': 0,
 		'idx': 17,
 		'in_filter': 0,
 		'label': 'FG Completed Qty',
@@ -517,7 +496,6 @@
 		'permlevel': 2,
 		'print_hide': 1,
 		'report_hide': 0,
-		'reqd': 0,
 		'search_index': 0,
 		'trigger': 'Client'
 	},
@@ -527,15 +505,13 @@
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldtype': 'HTML',
-		'hidden': 0,
 		'idx': 18,
 		'label': 'Warehouse HTML',
 		'no_copy': 0,
 		'oldfieldtype': 'HTML',
 		'options': "<div class='columnHeading'>Warehouse</div>",
 		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 0
+		'print_hide': 1
 	},
 
 	# DocField
@@ -545,7 +521,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'from_warehouse',
 		'fieldtype': 'Link',
-		'hidden': 0,
 		'idx': 19,
 		'in_filter': 0,
 		'label': 'Source Warehouse',
@@ -569,7 +544,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'to_warehouse',
 		'fieldtype': 'Link',
-		'hidden': 0,
 		'idx': 20,
 		'in_filter': 0,
 		'label': 'Target Warehouse',
@@ -581,7 +555,7 @@
 		'print_hide': 1,
 		'report_hide': 0,
 		'reqd': 0,
-		'search_index': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
@@ -616,7 +590,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'transfer_date',
 		'fieldtype': 'Date',
-		'hidden': 0,
 		'idx': 23,
 		'in_filter': 1,
 		'label': 'Transfer Date',
@@ -627,7 +600,7 @@
 		'print_hide': 0,
 		'report_hide': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -637,7 +610,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'posting_date',
 		'fieldtype': 'Date',
-		'hidden': 0,
 		'idx': 24,
 		'in_filter': 1,
 		'label': 'Posting Date',
@@ -657,7 +629,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'posting_time',
 		'fieldtype': 'Time',
-		'hidden': 0,
 		'idx': 25,
 		'in_filter': 0,
 		'label': 'Posting Time',
@@ -677,7 +648,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'amended_from',
 		'fieldtype': 'Link',
-		'hidden': 0,
 		'idx': 26,
 		'in_filter': 0,
 		'label': 'Amended From',
@@ -688,7 +658,6 @@
 		'permlevel': 1,
 		'print_hide': 1,
 		'report_hide': 0,
-		'reqd': 0,
 		'search_index': 0
 	},
 
@@ -698,7 +667,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'transporter',
 		'fieldtype': 'Data',
-		'hidden': 0,
 		'idx': 27,
 		'in_filter': 0,
 		'label': 'Transporter',
@@ -708,7 +676,6 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 0,
-		'reqd': 0,
 		'search_index': 0
 	},
 
@@ -718,7 +685,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'is_excisable_goods',
 		'fieldtype': 'Select',
-		'hidden': 0,
 		'idx': 28,
 		'in_filter': 0,
 		'label': 'Is Excisable Goods',
@@ -729,7 +695,6 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 0,
-		'reqd': 0,
 		'search_index': 0
 	},
 
@@ -739,7 +704,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'excisable_goods',
 		'fieldtype': 'Select',
-		'hidden': 0,
 		'idx': 29,
 		'in_filter': 0,
 		'label': 'Excisable Goods',
@@ -750,7 +714,6 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 0,
-		'reqd': 0,
 		'search_index': 0
 	},
 
@@ -771,7 +734,6 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 0,
-		'reqd': 0,
 		'search_index': 0
 	},
 
@@ -781,7 +743,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'remarks',
 		'fieldtype': 'Text',
-		'hidden': 0,
 		'idx': 31,
 		'in_filter': 0,
 		'label': 'Remarks',
@@ -839,25 +800,6 @@
 
 	# DocField
 	{
-		'allow_on_submit': 0,
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'hidden': 0,
-		'idx': 35,
-		'in_filter': 0,
-		'label': 'Get Current Stock',
-		'no_copy': 0,
-		'oldfieldtype': 'Button',
-		'options': 'get_stock_and_rate',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 0,
-		'reqd': 0,
-		'search_index': 0
-	},
-
-	# DocField
-	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
 		'idx': 36,
@@ -881,7 +823,6 @@
 		'permlevel': 2,
 		'print_hide': 1,
 		'report_hide': 0,
-		'reqd': 0,
 		'search_index': 0
 	},
 
@@ -902,7 +843,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'mtn_details',
 		'fieldtype': 'Table',
-		'hidden': 0,
 		'idx': 39,
 		'in_filter': 0,
 		'label': 'MTN Details',
@@ -913,7 +853,6 @@
 		'permlevel': 0,
 		'print_hide': 0,
 		'report_hide': 0,
-		'reqd': 0,
 		'search_index': 0
 	},
 
@@ -923,7 +862,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'total_amount',
 		'fieldtype': 'Currency',
-		'hidden': 0,
 		'idx': 40,
 		'in_filter': 0,
 		'label': 'Total Amount',
@@ -933,7 +871,6 @@
 		'permlevel': 1,
 		'print_hide': 1,
 		'report_hide': 0,
-		'reqd': 0,
 		'search_index': 0
 	},
 
@@ -953,7 +890,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'company',
 		'fieldtype': 'Link',
-		'hidden': 0,
 		'idx': 42,
 		'in_filter': 1,
 		'label': 'Company',
@@ -965,7 +901,7 @@
 		'print_hide': 1,
 		'report_hide': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -974,7 +910,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'fiscal_year',
 		'fieldtype': 'Select',
-		'hidden': 0,
 		'idx': 43,
 		'in_filter': 0,
 		'label': 'Fiscal Year',
@@ -986,7 +921,7 @@
 		'print_hide': 1,
 		'report_hide': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -995,7 +930,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'select_print_heading',
 		'fieldtype': 'Link',
-		'hidden': 0,
 		'idx': 44,
 		'in_filter': 0,
 		'label': 'Select Print Heading',
@@ -1004,9 +938,7 @@
 		'oldfieldtype': 'Link',
 		'options': 'Print Heading',
 		'permlevel': 0,
-		'print_hide': 0,
 		'report_hide': 0,
-		'reqd': 0,
 		'search_index': 0
 	}
 ]
\ No newline at end of file
diff --git a/stock/doctype/stock_entry_detail/stock_entry_detail.txt b/stock/doctype/stock_entry_detail/stock_entry_detail.txt
index b4fca09..1d2408b 100644
--- a/stock/doctype/stock_entry_detail/stock_entry_detail.txt
+++ b/stock/doctype/stock_entry_detail/stock_entry_detail.txt
@@ -135,6 +135,7 @@
 		'options': 'Batch',
 		'permlevel': 0,
 		'print_hide': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
@@ -152,7 +153,7 @@
 		'permlevel': 1,
 		'print_hide': 1,
 		'reqd': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -196,6 +197,7 @@
 		'options': 'UOM',
 		'permlevel': 0,
 		'reqd': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
diff --git a/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt b/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt
index 603f095..823837a 100644
--- a/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt
+++ b/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt
@@ -12,7 +12,7 @@
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1307707462',
+		'_last_update': '1309508840',
 		'autoname': 'SLE/.########',
 		'colour': 'White:FFF',
 		'doctype': 'DocType',
@@ -163,7 +163,7 @@
 		'oldfieldtype': 'Select',
 		'options': 'link:Warehouse Type',
 		'permlevel': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -194,7 +194,7 @@
 		'oldfieldname': 'posting_time',
 		'oldfieldtype': 'Time',
 		'permlevel': 1,
-		'search_index': 0,
+		'search_index': 1,
 		'width': '100px'
 	},
 
@@ -210,7 +210,7 @@
 		'oldfieldname': 'transaction_date',
 		'oldfieldtype': 'Date',
 		'permlevel': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '100px'
 	},
 
@@ -225,7 +225,7 @@
 		'oldfieldname': 'voucher_type',
 		'oldfieldtype': 'Data',
 		'permlevel': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '150px'
 	},
 
@@ -240,7 +240,7 @@
 		'oldfieldname': 'voucher_no',
 		'oldfieldtype': 'Data',
 		'permlevel': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '150px'
 	},
 
@@ -394,7 +394,7 @@
 		'oldfieldname': 'company',
 		'oldfieldtype': 'Data',
 		'permlevel': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '150px'
 	},
 
@@ -409,7 +409,7 @@
 		'oldfieldname': 'fiscal_year',
 		'oldfieldtype': 'Data',
 		'permlevel': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '150px'
 	},
 
@@ -425,7 +425,7 @@
 		'oldfieldtype': 'Select',
 		'options': '\nYes\nNo',
 		'permlevel': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '100px'
 	},
 
@@ -441,7 +441,7 @@
 		'oldfieldtype': 'Select',
 		'options': '\nYes\nNo',
 		'permlevel': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'width': '100px'
 	}
 ]
\ No newline at end of file
diff --git a/stock/doctype/stock_reconciliation/stock_reconciliation.txt b/stock/doctype/stock_reconciliation/stock_reconciliation.txt
index 1080a27..771068d 100644
--- a/stock/doctype/stock_reconciliation/stock_reconciliation.txt
+++ b/stock/doctype/stock_reconciliation/stock_reconciliation.txt
@@ -12,7 +12,7 @@
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1307707462',
+		'_last_update': '1309508840',
 		'allow_attach': 1,
 		'colour': 'White:FFF',
 		'doctype': 'DocType',
@@ -131,7 +131,8 @@
 		'oldfieldname': 'reconciliation_date',
 		'oldfieldtype': 'Date',
 		'permlevel': 0,
-		'reqd': 1
+		'reqd': 1,
+		'search_index': 1
 	},
 
 	# DocField
@@ -185,7 +186,7 @@
 		'oldfieldtype': 'Link',
 		'options': 'Company',
 		'permlevel': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -200,7 +201,7 @@
 		'oldfieldtype': 'Select',
 		'options': 'link:Fiscal Year',
 		'permlevel': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/stock/doctype/warehouse/warehouse.txt b/stock/doctype/warehouse/warehouse.txt
index 3d69b07..1363eef 100644
--- a/stock/doctype/warehouse/warehouse.txt
+++ b/stock/doctype/warehouse/warehouse.txt
@@ -244,7 +244,7 @@
 		'oldfieldtype': 'Link',
 		'options': 'Company',
 		'permlevel': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/support/doctype/customer_issue/customer_issue.txt b/support/doctype/customer_issue/customer_issue.txt
index 93c274f..122f92d 100644
--- a/support/doctype/customer_issue/customer_issue.txt
+++ b/support/doctype/customer_issue/customer_issue.txt
@@ -167,7 +167,7 @@
 		'options': '\nOpen\nClosed\nWork In Progress\nCancelled',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -340,7 +340,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -371,7 +371,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
@@ -389,7 +389,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -563,7 +563,7 @@
 		'oldfieldname': 'allocated_on',
 		'oldfieldtype': 'Date',
 		'permlevel': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -578,7 +578,7 @@
 		'oldfieldtype': 'Link',
 		'options': 'Sales Person',
 		'permlevel': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -627,7 +627,7 @@
 		'oldfieldname': 'resolution_date',
 		'oldfieldtype': 'Date',
 		'permlevel': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -643,7 +643,7 @@
 		'oldfieldtype': 'Link',
 		'options': 'Sales Person',
 		'permlevel': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/support/doctype/item_maintenance_detail/item_maintenance_detail.txt b/support/doctype/item_maintenance_detail/item_maintenance_detail.txt
index ff5d211..4d4e26a 100644
--- a/support/doctype/item_maintenance_detail/item_maintenance_detail.txt
+++ b/support/doctype/item_maintenance_detail/item_maintenance_detail.txt
@@ -150,7 +150,7 @@
 		'options': 'Sales Person',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/support/doctype/maintenance_schedule/maintenance_schedule.txt b/support/doctype/maintenance_schedule/maintenance_schedule.txt
index 3881aa3..a053cf9 100644
--- a/support/doctype/maintenance_schedule/maintenance_schedule.txt
+++ b/support/doctype/maintenance_schedule/maintenance_schedule.txt
@@ -167,7 +167,7 @@
 		'oldfieldtype': 'Data',
 		'permlevel': 1,
 		'reqd': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -252,7 +252,7 @@
 		'options': '\nDraft\nSubmitted\nCancelled',
 		'permlevel': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -297,7 +297,7 @@
 		'options': 'Company',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -313,7 +313,7 @@
 		'options': 'Territory',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt b/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt
index 01cf7f0..edd8091 100644
--- a/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt
+++ b/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt
@@ -112,7 +112,7 @@
 		'options': 'Sales Person',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/support/doctype/maintenance_visit/maintenance_visit.txt b/support/doctype/maintenance_visit/maintenance_visit.txt
index 2485f57..76cf56f 100644
--- a/support/doctype/maintenance_visit/maintenance_visit.txt
+++ b/support/doctype/maintenance_visit/maintenance_visit.txt
@@ -241,7 +241,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -258,7 +258,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -410,7 +410,7 @@
 		'options': '\nScheduled\nUnscheduled\nBreakdown',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/support/doctype/support_ticket/support_ticket.txt b/support/doctype/support_ticket/support_ticket.txt
index 1b11a72..8164764 100644
--- a/support/doctype/support_ticket/support_ticket.txt
+++ b/support/doctype/support_ticket/support_ticket.txt
@@ -251,7 +251,7 @@
 		'oldfieldtype': 'Data',
 		'permlevel': 2,
 		'reqd': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -376,7 +376,7 @@
 		'oldfieldname': 'resolution_date',
 		'oldfieldtype': 'Date',
 		'permlevel': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/utilities/doctype/address/address.txt b/utilities/doctype/address/address.txt
index e7ff8cc..4f44806 100644
--- a/utilities/doctype/address/address.txt
+++ b/utilities/doctype/address/address.txt
@@ -117,7 +117,7 @@
 		'label': 'City/Town',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -129,7 +129,7 @@
 		'in_filter': 1,
 		'label': 'Pincode',
 		'permlevel': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -144,7 +144,7 @@
 		'options': 'link:Country',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
@@ -214,6 +214,7 @@
 		'label': 'Customer',
 		'options': 'Customer',
 		'permlevel': 0,
+		'search_index': 1,
 		'trigger': 'Client'
 	},
 
@@ -240,6 +241,7 @@
 		'label': 'Supplier',
 		'options': 'Supplier',
 		'permlevel': 0,
+		'search_index': 1,
 		'trigger': 'Client'
 	},
 
diff --git a/utilities/doctype/gl_mapper_detail/gl_mapper_detail.txt b/utilities/doctype/gl_mapper_detail/gl_mapper_detail.txt
index 404e8fc..bf77e7c 100644
--- a/utilities/doctype/gl_mapper_detail/gl_mapper_detail.txt
+++ b/utilities/doctype/gl_mapper_detail/gl_mapper_detail.txt
@@ -173,7 +173,7 @@
 		'label': 'Fiscal Year',
 		'oldfieldname': 'fiscal_year',
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -202,7 +202,7 @@
 		'in_filter': 1,
 		'label': 'Company',
 		'oldfieldname': 'company',
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
diff --git a/utilities/doctype/rename_tool/rename_tool.txt b/utilities/doctype/rename_tool/rename_tool.txt
index 9269185..3b8a5dd 100755
--- a/utilities/doctype/rename_tool/rename_tool.txt
+++ b/utilities/doctype/rename_tool/rename_tool.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-06-23 11:03:25',
+		'creation': '2011-06-27 10:52:02',
 		'docstatus': 0,
-		'modified': '2011-07-01 17:46:42',
+		'modified': '2011-07-26 00:59:27',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
@@ -70,7 +70,7 @@
 		'fieldtype': 'Select',
 		'idx': 1,
 		'label': 'Select DocType',
-		'options': 'link:DocType'
+		'options': '\nAccount\nCompany\nCustomer\nSupplier\nEmployee\nWarehouse\nItem'
 	},
 
 	# DocField