cleanup and fixes
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index ddccab2..11239d5 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -69,10 +69,8 @@
 		cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript.make_bank_voucher);
 	
 	if(doc.docstatus==1) { 
-		unhide_field(['repair_outstanding_amt']); 
 		cur_frm.add_custom_button('View Ledger', cur_frm.cscript.view_ledger_entry);
-	} else hide_field(['repair_outstanding_amt']);
-	
+	}	
 	cur_frm.cscript.is_opening(doc, dt, dn);
 }
 
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt
index bc59d22..524fa07 100755
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-03-27 14:35:45',
+		'creation': '2012-04-11 13:17:19',
 		'docstatus': 0,
-		'modified': '2012-03-27 14:45:49',
+		'modified': '2012-04-12 18:09:05',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -13,6 +13,7 @@
 	# These values are common for all DocType
 	{
 		'_last_update': u'1330345793',
+		'allow_attach': 1,
 		'colour': u'White:FFF',
 		'default_print_format': u'Standard',
 		'doctype': 'DocType',
@@ -25,7 +26,7 @@
 		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'subject': u'From %(supplier_name)s worth %(grand_total)s due on %(due_date)s | %(outstanding_amount)s outstanding',
-		'version': 521
+		'version': 522
 	},
 
 	# These values are common for all DocField
@@ -55,18 +56,42 @@
 
 	# DocPerm
 	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Accounts Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
 		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': u'Accounts User',
+		'role': u'Accounts Manager',
 		'submit': 1,
 		'write': 1
 	},
 
 	# DocPerm
 	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Accounts User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
 		'doctype': u'DocPerm',
 		'permlevel': 1,
 		'role': u'Purchase User'
@@ -86,46 +111,22 @@
 
 	# DocPerm
 	{
-		'doctype': u'DocPerm',
-		'match': u'supplier',
-		'permlevel': 0,
-		'role': u'Supplier'
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Accounts Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
 		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': u'Accounts Manager',
+		'role': u'Accounts User',
 		'submit': 1,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
 		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Accounts User',
-		'submit': 0,
-		'write': 0
+		'match': u'supplier',
+		'permlevel': 0,
+		'role': u'Supplier'
 	},
 
 	# DocField
@@ -1103,32 +1104,6 @@
 
 	# DocField
 	{
-		'colour': u'White:FFF',
-		'depends_on': u'eval:!doc.__islocal',
-		'doctype': u'DocField',
-		'fieldname': u'actions',
-		'fieldtype': u'Section Break',
-		'label': u'Actions',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'repair_outstanding_amt',
-		'fieldtype': u'Button',
-		'label': u'Repair Outstanding Amt',
-		'oldfieldtype': u'Button',
-		'options': u'repair_pv_outstanding',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
 		'doctype': u'DocField',
 		'fieldname': u'against_expense_account',
 		'fieldtype': u'Small Text',
@@ -1140,5 +1115,17 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
+		'hidden': 1,
+		'label': u'File List',
+		'no_copy': 1,
+		'permlevel': 0,
+		'print_hide': 1
 	}
-]
+]
\ No newline at end of file
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index 22b386c..33dc481 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -33,6 +33,7 @@
 	if(!doc.currency) doc.currency = sys_defaults.currency;
 	if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
 	if(!doc.transaction_date) set_multiple(cdt,cdn,{transaction_date:get_today()});
+	if(!doc.is_subcontracted) set_multiple(cdt, cdn, {is_subcontracted:'No'});
 	
 	if(doc.__islocal){
 		hide_field(['supplier_name','supplier_address','contact_person','address_display','contact_display','contact_mobile','contact_email']);
@@ -79,9 +80,6 @@
 		
 	if(doc.docstatus == 1 && doc.status == 'Stopped')
 		cur_frm.add_custom_button('Unstop Purchase Order', cur_frm.cscript['Unstop Purchase Order']);
-
-	if(doc.docstatus == 1) unhide_field(['repair_purchase_order']);
-	else hide_field(['repair_purchase_order']);
 }
 
 
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.txt b/erpnext/buying/doctype/purchase_order/purchase_order.txt
index 6c10db8..ec6e776 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.txt
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-03-27 14:35:51',
+		'creation': '2012-04-11 13:17:34',
 		'docstatus': 0,
-		'modified': '2012-03-27 18:46:29',
+		'modified': '2012-04-12 18:11:33',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -13,6 +13,7 @@
 	# These values are common for all DocType
 	{
 		'_last_update': u'1330339817',
+		'allow_attach': 1,
 		'colour': u'White:FFF',
 		'default_print_format': u'Standard',
 		'doctype': 'DocType',
@@ -27,7 +28,7 @@
 		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'subject': u'To %(supplier_name)s on %(transaction_date)s | %(per_received)s% delivered',
-		'version': 502
+		'version': 503
 	},
 
 	# These values are common for all DocField
@@ -57,6 +58,54 @@
 
 	# DocPerm
 	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Purchase Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Purchase Manager',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
@@ -90,54 +139,6 @@
 		'write': 1
 	},
 
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Purchase Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Purchase Manager',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Material User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Material User',
-		'submit': 0,
-		'write': 0
-	},
-
 	# DocField
 	{
 		'colour': u'White:FFF',
@@ -1044,14 +1045,13 @@
 
 	# DocField
 	{
-		'allow_on_submit': 1,
 		'doctype': u'DocField',
-		'fieldname': u'repair_purchase_order',
-		'fieldtype': u'Button',
-		'label': u'Repair Purchase Order',
-		'oldfieldtype': u'Button',
-		'options': u'repair_purchase_order',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
+		'hidden': 1,
+		'label': u'File List',
+		'no_copy': 1,
 		'permlevel': 0,
 		'print_hide': 1
 	}
-]
+]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index 7e81b88..8761881 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -71,9 +71,6 @@
 	 cur_frm.add_custom_button('Make Purchase Invoice', cur_frm.cscript['Make Purchase Invoice']);
 	 cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
 	}
-	else{
-		hide_field(['Repair Purchase Receipt']);
-	}
 }
 
 
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt
index cb66d6f..7b5c82c 100755
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-03-27 14:36:34',
+		'creation': '2012-04-11 13:18:46',
 		'docstatus': 0,
-		'modified': '2012-03-27 18:51:48',
+		'modified': '2012-04-12 17:50:10',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -13,6 +13,7 @@
 	# These values are common for all DocType
 	{
 		'_last_update': u'1330593645',
+		'allow_attach': 1,
 		'colour': u'White:FFF',
 		'default_print_format': u'Standard',
 		'doctype': 'DocType',
@@ -27,7 +28,7 @@
 		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'subject': u'From %(supplier_name)s against %(purchase_order)s on %(posting_date)s',
-		'version': 326
+		'version': 327
 	},
 
 	# These values are common for all DocField
@@ -57,6 +58,54 @@
 
 	# DocPerm
 	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material Manager',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material User',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
@@ -90,54 +139,6 @@
 		'write': 1
 	},
 
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Material Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Material Manager',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Material User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Material User',
-		'submit': 1,
-		'write': 1
-	},
-
 	# DocField
 	{
 		'colour': u'White:FFF',
@@ -594,6 +595,18 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'get_current_stock',
+		'fieldtype': u'Button',
+		'label': u'Get Current Stock',
+		'oldfieldtype': u'Button',
+		'options': u'get_current_stock',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
 		'fieldname': u'recalculate_values',
 		'fieldtype': u'Button',
 		'label': u'Re-Calculate Values',
@@ -1133,18 +1146,6 @@
 	# DocField
 	{
 		'doctype': u'DocField',
-		'fieldname': u'get_current_stock',
-		'fieldtype': u'Button',
-		'label': u'Get Current Stock',
-		'oldfieldtype': u'Button',
-		'options': u'get_current_stock',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
 		'fieldname': u'pr_raw_material_details',
 		'fieldtype': u'Table',
 		'label': u'Purchase Receipt Item Supplieds',
@@ -1158,15 +1159,13 @@
 
 	# DocField
 	{
-		'allow_on_submit': 1,
-		'colour': u'White:FFF',
 		'doctype': u'DocField',
-		'fieldname': u'repair_purchase_receipt',
-		'fieldtype': u'Button',
-		'label': u'Repair Purchase Receipt',
-		'oldfieldtype': u'Button',
-		'options': u'repair_purchase_receipt',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
+		'hidden': 1,
+		'label': u'File List',
+		'no_copy': 1,
 		'permlevel': 0,
 		'print_hide': 1
 	}
-]
+]
\ No newline at end of file