Merge branch 'master' of github.com:webnotes/erpnext
diff --git a/erpnext/accounts/doctype/pv_detail/pv_detail.txt b/erpnext/accounts/doctype/pv_detail/pv_detail.txt
index f14b44b..e1181b0 100755
--- a/erpnext/accounts/doctype/pv_detail/pv_detail.txt
+++ b/erpnext/accounts/doctype/pv_detail/pv_detail.txt
@@ -5,7 +5,7 @@
 	{
 		'creation': '2010-08-08 17:09:17',
 		'docstatus': 0,
-		'modified': '2011-12-13 12:06:35',
+		'modified': '2011-12-14 10:44:21',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
@@ -14,6 +14,7 @@
 	{
 		'autoname': 'EVD.######',
 		'colour': 'White:FFF',
+		'default_print_format': 'Standard',
 		'doctype': 'DocType',
 		'istable': 1,
 		'module': 'Accounts',
@@ -21,7 +22,7 @@
 		'section_style': 'Tray',
 		'server_code_error': ' ',
 		'show_in_menu': 0,
-		'version': 39
+		'version': 42
 	},
 
 	# These values are common for all DocField
@@ -73,18 +74,6 @@
 	# DocField
 	{
 		'doctype': 'DocField',
-		'fieldname': 'brand',
-		'fieldtype': 'Data',
-		'label': 'Brand',
-		'oldfieldname': 'brand',
-		'oldfieldtype': 'Data',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
 		'fieldname': 'description',
 		'fieldtype': 'Text',
 		'label': 'Description',
@@ -97,21 +86,6 @@
 	# DocField
 	{
 		'doctype': 'DocField',
-		'fieldname': 'item_group',
-		'fieldtype': 'Link',
-		'in_filter': 1,
-		'label': 'Item Group',
-		'oldfieldname': 'item_group',
-		'oldfieldtype': 'Link',
-		'options': 'Item Group',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
 		'fieldname': 'qty',
 		'fieldtype': 'Currency',
 		'label': 'Qty',
@@ -126,6 +100,52 @@
 	# DocField
 	{
 		'doctype': 'DocField',
+		'fieldname': 'import_ref_rate',
+		'fieldtype': 'Currency',
+		'label': 'Ref Rate ',
+		'permlevel': 0,
+		'trigger': 'Client'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'discount_rate',
+		'fieldtype': 'Currency',
+		'label': 'Discount %',
+		'permlevel': 0,
+		'trigger': 'Client'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'import_rate',
+		'fieldtype': 'Currency',
+		'label': 'Rate ',
+		'oldfieldname': 'import_rate',
+		'oldfieldtype': 'Currency',
+		'permlevel': 0,
+		'print_hide': 0,
+		'reqd': 1,
+		'trigger': 'Client'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'import_amount',
+		'fieldtype': 'Currency',
+		'label': 'Amount',
+		'oldfieldname': 'import_amount',
+		'oldfieldtype': 'Currency',
+		'permlevel': 1,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
 		'fieldname': 'purchase_ref_rate',
 		'fieldtype': 'Currency',
 		'label': 'Ref Rate *',
@@ -162,52 +182,6 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'discount_rate',
-		'fieldtype': 'Currency',
-		'label': 'Discount %',
-		'permlevel': 0,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'import_ref_rate',
-		'fieldtype': 'Currency',
-		'label': 'Ref Rate ',
-		'permlevel': 0,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'import_rate',
-		'fieldtype': 'Currency',
-		'label': 'Rate ',
-		'oldfieldname': 'import_rate',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'print_hide': 0,
-		'reqd': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'import_amount',
-		'fieldtype': 'Currency',
-		'label': 'Amount',
-		'oldfieldname': 'import_amount',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1,
-		'reqd': 1
-	},
-
-	# DocField
-	{
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldname': 'expense_head',
@@ -241,6 +215,46 @@
 
 	# DocField
 	{
+		'colour': 'White:FFF',
+		'doctype': 'DocField',
+		'fieldname': 'project_name',
+		'fieldtype': 'Link',
+		'in_filter': 1,
+		'label': 'Project Name',
+		'options': 'Project',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'brand',
+		'fieldtype': 'Data',
+		'label': 'Brand',
+		'oldfieldname': 'brand',
+		'oldfieldtype': 'Data',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'item_group',
+		'fieldtype': 'Link',
+		'in_filter': 1,
+		'label': 'Item Group',
+		'oldfieldname': 'item_group',
+		'oldfieldtype': 'Link',
+		'options': 'Item Group',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
 		'doctype': 'DocField',
 		'fieldname': 'purchase_order',
 		'fieldtype': 'Link',
diff --git a/erpnext/buying/doctype/po_detail/po_detail.txt b/erpnext/buying/doctype/po_detail/po_detail.txt
index c8d831b..1512666 100755
--- a/erpnext/buying/doctype/po_detail/po_detail.txt
+++ b/erpnext/buying/doctype/po_detail/po_detail.txt
@@ -5,7 +5,7 @@
 	{
 		'creation': '2010-08-08 17:09:12',
 		'docstatus': 0,
-		'modified': '2011-12-13 13:02:05',
+		'modified': '2011-12-14 10:49:46',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
@@ -14,6 +14,7 @@
 	{
 		'autoname': 'POD/.#####',
 		'colour': 'White:FFF',
+		'default_print_format': 'Standard',
 		'doctype': 'DocType',
 		'istable': 1,
 		'module': 'Buying',
@@ -21,7 +22,7 @@
 		'section_style': 'Tray',
 		'server_code_error': ' ',
 		'show_in_menu': 0,
-		'version': 59
+		'version': 60
 	},
 
 	# These values are common for all DocField
@@ -104,6 +105,7 @@
 
 	# DocField
 	{
+		'default': '0.00',
 		'doctype': 'DocField',
 		'fieldname': 'qty',
 		'fieldtype': 'Currency',
@@ -119,43 +121,15 @@
 	# DocField
 	{
 		'doctype': 'DocField',
-		'fieldname': 'purchase_rate',
+		'fieldname': 'import_ref_rate',
 		'fieldtype': 'Currency',
-		'label': 'Rate (Default Curr.) *',
-		'oldfieldname': 'purchase_rate',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'trigger': 'Client',
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'purchase_ref_rate',
-		'fieldtype': 'Currency',
-		'label': 'Ref Rate *',
+		'label': 'Ref Rate ',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
 		'doctype': 'DocField',
-		'fieldname': 'amount',
-		'fieldtype': 'Currency',
-		'label': 'Amount  (Default Curr.)',
-		'oldfieldname': 'amount',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
 		'fieldname': 'discount_rate',
 		'fieldtype': 'Currency',
 		'label': 'Discount %',
@@ -180,15 +154,6 @@
 	# DocField
 	{
 		'doctype': 'DocField',
-		'fieldname': 'import_ref_rate',
-		'fieldtype': 'Currency',
-		'label': 'Ref Rate ',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
 		'fieldname': 'import_amount',
 		'fieldtype': 'Currency',
 		'label': 'Amount',
@@ -200,14 +165,23 @@
 	# DocField
 	{
 		'doctype': 'DocField',
-		'fieldname': 'uom',
-		'fieldtype': 'Link',
-		'label': 'UOM',
-		'oldfieldname': 'uom',
-		'oldfieldtype': 'Link',
-		'options': 'UOM',
+		'fieldname': 'purchase_ref_rate',
+		'fieldtype': 'Currency',
+		'label': 'Ref Rate *',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'default': '0.00',
+		'doctype': 'DocField',
+		'fieldname': 'purchase_rate',
+		'fieldtype': 'Currency',
+		'label': 'Rate (Default Curr.) *',
+		'oldfieldname': 'purchase_rate',
+		'oldfieldtype': 'Currency',
 		'permlevel': 0,
-		'print_hide': 0,
+		'print_hide': 1,
 		'reqd': 1,
 		'trigger': 'Client',
 		'width': '100px'
@@ -215,6 +189,20 @@
 
 	# DocField
 	{
+		'default': '0.00',
+		'doctype': 'DocField',
+		'fieldname': 'amount',
+		'fieldtype': 'Currency',
+		'label': 'Amount  (Default Curr.)',
+		'oldfieldname': 'amount',
+		'oldfieldtype': 'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'reqd': 1
+	},
+
+	# DocField
+	{
 		'doctype': 'DocField',
 		'fieldname': 'warehouse',
 		'fieldtype': 'Link',
@@ -231,6 +219,35 @@
 
 	# DocField
 	{
+		'doctype': 'DocField',
+		'fieldname': 'project_name',
+		'fieldtype': 'Link',
+		'in_filter': 1,
+		'label': 'Project Name',
+		'options': 'Project',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'uom',
+		'fieldtype': 'Link',
+		'label': 'UOM',
+		'oldfieldname': 'uom',
+		'oldfieldtype': 'Link',
+		'options': 'UOM',
+		'permlevel': 0,
+		'print_hide': 0,
+		'reqd': 1,
+		'trigger': 'Client',
+		'width': '100px'
+	},
+
+	# DocField
+	{
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldname': 'conversion_factor',
@@ -248,21 +265,6 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'prevdoc_doctype',
-		'fieldtype': 'Data',
-		'hidden': 1,
-		'label': 'Prevdoc DocType',
-		'no_copy': 0,
-		'oldfieldname': 'prevdoc_doctype',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
 		'doctype': 'DocField',
 		'fieldname': 'stock_uom',
 		'fieldtype': 'Data',
@@ -280,6 +282,21 @@
 	{
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
+		'fieldname': 'prevdoc_doctype',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'label': 'Prevdoc DocType',
+		'no_copy': 0,
+		'oldfieldname': 'prevdoc_doctype',
+		'oldfieldtype': 'Data',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'doctype': 'DocField',
 		'fieldname': 'prevdoc_docname',
 		'fieldtype': 'Link',
 		'hidden': 0,
@@ -359,6 +376,7 @@
 
 	# DocField
 	{
+		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldname': 'stock_qty',
 		'fieldtype': 'Currency',
@@ -367,7 +385,7 @@
 		'no_copy': 1,
 		'oldfieldname': 'stock_qty',
 		'oldfieldtype': 'Currency',
-		'permlevel': 0,
+		'permlevel': 1,
 		'print_hide': 1,
 		'trigger': 'Client',
 		'width': '100px'
@@ -389,6 +407,7 @@
 
 	# DocField
 	{
+		'default': '0.00',
 		'doctype': 'DocField',
 		'fieldname': 'billed_qty',
 		'fieldtype': 'Currency',
diff --git a/erpnext/patches/Discount_purchase_cycle.py b/erpnext/patches/Discount_purchase_cycle.py
index f786439..34fd498 100755
--- a/erpnext/patches/Discount_purchase_cycle.py
+++ b/erpnext/patches/Discount_purchase_cycle.py
@@ -7,3 +7,8 @@
 	reload_doc('stock', 'doctype', 'purchase_receipt_detail')
 	if webnotes.conn.sql("select name from `tabDocField` where parent = 'PO Detail' and fieldname = 'discount'"):
 		webnotes.conn.sql("update `tabPO Detail` set discount_rate=discount")
+
+	# Features setup
+	reload_doc('setup', 'doctype', 'features_setup')
+	from webnotes.model.code import get_obj
+	get_obj('Features Setup').validate()
diff --git a/erpnext/patches/reload_rv.py b/erpnext/patches/reload_rv.py
index 5f3bc21..7b47b4c 100644
--- a/erpnext/patches/reload_rv.py
+++ b/erpnext/patches/reload_rv.py
@@ -5,4 +5,5 @@
 
 	reload_doc('accounts', 'doctype', 'receivable_voucher')
 
+	reload_doc('setup', 'doctype', 'features_setup')
 	get_obj('Features setup').validate()
diff --git a/erpnext/setup/doctype/features_setup/features_setup.py b/erpnext/setup/doctype/features_setup/features_setup.py
index f12d282..3a549d9 100644
--- a/erpnext/setup/doctype/features_setup/features_setup.py
+++ b/erpnext/setup/doctype/features_setup/features_setup.py
@@ -8,7 +8,6 @@
 		"""
 		from webnotes.model import default_fields 
 		from webnotes.utils import set_default
-		
 		for key in self.doc.fields:
 			if key not in default_fields:
 				set_default(key, self.doc.fields[key])
diff --git a/erpnext/setup/doctype/features_setup/features_setup.txt b/erpnext/setup/doctype/features_setup/features_setup.txt
index d0f02d5..a7c6fe8 100644
--- a/erpnext/setup/doctype/features_setup/features_setup.txt
+++ b/erpnext/setup/doctype/features_setup/features_setup.txt
@@ -5,14 +5,14 @@
 	{
 		'creation': '2011-09-07 11:59:05',
 		'docstatus': 0,
-		'modified': '2011-12-06 18:48:53',
+		'modified': '2011-12-14 11:05:55',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1323176623',
+		'_last_update': '1323840127',
 		'colour': 'White:FFF',
 		'default_print_format': 'Standard',
 		'doctype': 'DocType',
@@ -22,7 +22,7 @@
 		'name_case': 'Title Case',
 		'section_style': 'Simple',
 		'show_in_menu': 1,
-		'version': 24
+		'version': 26
 	},
 
 	# These values are common for all DocField
@@ -179,7 +179,17 @@
 		'doctype': 'DocField',
 		'fieldname': 'fs_discounts',
 		'fieldtype': 'Check',
-		'label': 'Discounts'
+		'label': 'Sales Discounts'
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'description': 'Discount Fields will be available in Purchase Order, Purchase Receipt, Purchase Invoice',
+		'doctype': 'DocField',
+		'fieldname': 'fs_purchase_discounts',
+		'fieldtype': 'Check',
+		'label': 'Purchase Discounts'
 	},
 
 	# DocField
diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js
index 291265b..07c1629 100644
--- a/erpnext/startup/startup.js
+++ b/erpnext/startup/startup.js
@@ -572,6 +572,11 @@
 		'Receivable Voucher': {'entries':['adj_rate']},
 		'Sales Order': {'sales_order_details':['adj_rate','ref_rate']}
 	},
+	'fs_purchase_discounts': {
+		'Purchase Order': {'po_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']},
+		'Purchase Receipt': {'purchase_receipt_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']},
+		'Payable Voucher': {'entries':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}
+	},
 	'fs_brands': {
 		'Delivery Note': {'delivery_note_details':['brand']},
 		'Indent': {'indent_details':['brand']},
diff --git a/erpnext/stock/doctype/purchase_receipt_detail/purchase_receipt_detail.txt b/erpnext/stock/doctype/purchase_receipt_detail/purchase_receipt_detail.txt
index afe8d99..9aacefd 100755
--- a/erpnext/stock/doctype/purchase_receipt_detail/purchase_receipt_detail.txt
+++ b/erpnext/stock/doctype/purchase_receipt_detail/purchase_receipt_detail.txt
@@ -5,7 +5,7 @@
 	{
 		'creation': '2010-08-08 17:09:16',
 		'docstatus': 0,
-		'modified': '2011-12-13 13:03:11',
+		'modified': '2011-12-14 10:50:00',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
@@ -14,6 +14,7 @@
 	{
 		'autoname': 'GRND/.#######',
 		'colour': 'White:FFF',
+		'default_print_format': 'Standard',
 		'doctype': 'DocType',
 		'istable': 1,
 		'module': 'Stock',
@@ -21,7 +22,7 @@
 		'section_style': 'Tray',
 		'server_code_error': ' ',
 		'show_in_menu': 0,
-		'version': 71
+		'version': 73
 	},
 
 	# These values are common for all DocField
@@ -103,6 +104,20 @@
 	{
 		'default': '0.00',
 		'doctype': 'DocField',
+		'fieldname': 'qty',
+		'fieldtype': 'Currency',
+		'label': 'Accepted Quantity',
+		'oldfieldname': 'qty',
+		'oldfieldtype': 'Currency',
+		'permlevel': 0,
+		'trigger': 'Client',
+		'width': '100px'
+	},
+
+	# DocField
+	{
+		'default': '0.00',
+		'doctype': 'DocField',
 		'fieldname': 'rejected_qty',
 		'fieldtype': 'Currency',
 		'in_filter': 0,
@@ -117,14 +132,34 @@
 
 	# DocField
 	{
+		'doctype': 'DocField',
+		'fieldname': 'import_ref_rate',
+		'fieldtype': 'Currency',
+		'label': 'Ref Rate ',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'discount_rate',
+		'fieldtype': 'Currency',
+		'label': 'Discount  %',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
 		'default': '0.00',
 		'doctype': 'DocField',
-		'fieldname': 'qty',
+		'fieldname': 'import_rate',
 		'fieldtype': 'Currency',
-		'label': 'Accepted Quantity',
-		'oldfieldname': 'qty',
+		'label': 'Rate',
+		'oldfieldname': 'import_rate',
 		'oldfieldtype': 'Currency',
 		'permlevel': 0,
+		'print_hide': 0,
 		'trigger': 'Client',
 		'width': '100px'
 	},
@@ -132,6 +167,17 @@
 	# DocField
 	{
 		'doctype': 'DocField',
+		'fieldname': 'import_amount',
+		'fieldtype': 'Currency',
+		'label': 'Amount',
+		'oldfieldname': 'import_amount',
+		'oldfieldtype': 'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
 		'fieldname': 'purchase_ref_rate',
 		'fieldtype': 'Currency',
 		'label': 'Ref Rate *',
@@ -141,6 +187,7 @@
 	# DocField
 	{
 		'colour': 'White:FFF',
+		'default': '0.00',
 		'doctype': 'DocField',
 		'fieldname': 'purchase_rate',
 		'fieldtype': 'Currency',
@@ -156,6 +203,7 @@
 
 	# DocField
 	{
+		'default': '0.00',
 		'doctype': 'DocField',
 		'fieldname': 'amount',
 		'fieldtype': 'Currency',
@@ -171,6 +219,21 @@
 
 	# DocField
 	{
+		'doctype': 'DocField',
+		'fieldname': 'warehouse',
+		'fieldtype': 'Link',
+		'hidden': 0,
+		'label': 'Accepted Warehouse',
+		'oldfieldname': 'warehouse',
+		'oldfieldtype': 'Link',
+		'options': 'Warehouse',
+		'permlevel': 0,
+		'print_hide': 0,
+		'width': '100px'
+	},
+
+	# DocField
+	{
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldname': 'uom',
@@ -188,50 +251,6 @@
 	# DocField
 	{
 		'doctype': 'DocField',
-		'fieldname': 'discount_rate',
-		'fieldtype': 'Currency',
-		'label': 'Discount  %',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'import_rate',
-		'fieldtype': 'Currency',
-		'label': 'Rate',
-		'oldfieldname': 'import_rate',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'print_hide': 0,
-		'trigger': 'Client',
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'import_ref_rate',
-		'fieldtype': 'Currency',
-		'label': 'Ref Rate ',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'import_amount',
-		'fieldtype': 'Currency',
-		'label': 'Amount',
-		'oldfieldname': 'import_amount',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
 		'fieldname': 'conversion_factor',
 		'fieldtype': 'Currency',
 		'label': 'Conversion Factor',
@@ -247,21 +266,6 @@
 	# DocField
 	{
 		'doctype': 'DocField',
-		'fieldname': 'warehouse',
-		'fieldtype': 'Link',
-		'hidden': 0,
-		'label': 'Accepted Warehouse',
-		'oldfieldname': 'warehouse',
-		'oldfieldtype': 'Link',
-		'options': 'Warehouse',
-		'permlevel': 0,
-		'print_hide': 0,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
 		'fieldname': 'stock_uom',
 		'fieldtype': 'Data',
 		'label': 'Stock UOM',
@@ -292,6 +296,50 @@
 
 	# DocField
 	{
+		'colour': 'White:FFF',
+		'doctype': 'DocField',
+		'fieldname': 'schedule_date',
+		'fieldtype': 'Date',
+		'label': 'Schedule date',
+		'no_copy': 1,
+		'oldfieldname': 'schedule_date',
+		'oldfieldtype': 'Date',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'doctype': 'DocField',
+		'fieldname': 'project_name',
+		'fieldtype': 'Link',
+		'in_filter': 1,
+		'label': 'Project Name',
+		'options': 'Project',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'doctype': 'DocField',
+		'fieldname': 'qa_no',
+		'fieldtype': 'Link',
+		'label': 'QA No',
+		'no_copy': 1,
+		'oldfieldname': 'qa_no',
+		'oldfieldtype': 'Link',
+		'options': 'QA Inspection Report',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
 		'doctype': 'DocField',
 		'fieldname': 'brand',
 		'fieldtype': 'Link',
@@ -324,24 +372,9 @@
 	{
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
-		'fieldname': 'schedule_date',
-		'fieldtype': 'Date',
-		'label': 'Schedule date',
-		'no_copy': 1,
-		'oldfieldname': 'schedule_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
 		'fieldname': 'serial_no',
 		'fieldtype': 'Text',
+		'in_filter': 1,
 		'label': 'Serial No',
 		'no_copy': 1,
 		'oldfieldname': 'serial_no',
@@ -368,21 +401,6 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'qa_no',
-		'fieldtype': 'Link',
-		'label': 'QA No',
-		'no_copy': 1,
-		'oldfieldname': 'qa_no',
-		'oldfieldtype': 'Link',
-		'options': 'QA Inspection Report',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
 		'doctype': 'DocField',
 		'fieldname': 'stock_qty',
 		'fieldtype': 'Currency',
@@ -460,6 +478,7 @@
 
 	# DocField
 	{
+		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldname': 'item_tax_amount',
 		'fieldtype': 'Currency',
@@ -510,6 +529,7 @@
 
 	# DocField
 	{
+		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldname': 'valuation_rate',
 		'fieldtype': 'Currency',
@@ -519,13 +539,14 @@
 		'no_copy': 1,
 		'oldfieldname': 'valuation_rate',
 		'oldfieldtype': 'Currency',
-		'permlevel': 0,
+		'permlevel': 1,
 		'print_hide': 1,
 		'width': '80px'
 	},
 
 	# DocField
 	{
+		'colour': 'White:FFF',
 		'description': 'Tax detail table fetched from item master as a string and stored in this field.\nUsed for Purchase Other Charges',
 		'doctype': 'DocField',
 		'fieldname': 'item_tax_rate',