Merge branch 'master' of github.com:webnotes/erpnext
diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js
index 12b57d9..c2b478e 100644
--- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js
+++ b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js
@@ -18,6 +18,8 @@
 		if(!doc.voucher_date) set_multiple(dt,dn,{voucher_date:get_today()});
 		if(!doc.due_date) set_multiple(dt,dn,{due_date:get_today()});
 		if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
+		if(!doc.currency && sys_defaults.currency) set_multiple(cdt,cdn,{currency:sys_defaults.currency});
+		if(!doc.price_list_currency) set_multiple(cdt, cdn, {price_list_currency: doc.currency, plc_conversion_rate: 1});
 
 		//for previously created sales invoice, set required field related to pos
 		if(doc.is_pos ==1) cur_frm.cscript.is_pos(doc, dt, dn);
@@ -234,13 +236,6 @@
 
 /* **************************** TRIGGERS ********************************** */
 
-
-
-// Posting Date
-// ------------
-//cur_frm.cscript.posting_date = cur_frm.cscript.debit_to;
-
-
 // Get Items based on SO or DN Selected
 cur_frm.cscript['Get Items'] = function(doc, dt, dn) {
 	var callback = function(r,rt) {
diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py
index 57d8c55..20b0ed8 100644
--- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py
+++ b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py
@@ -164,6 +164,10 @@
 				ret['actual_qty']= actual_qty and flt(actual_qty[0][0]) or 0
 		return ret
  
+	# Fetch ref rate from item master as per selected price list
+	def get_adj_percent(self, arg=''):
+		get_obj('Sales Common').get_adj_percent(self)
+
 
 	# Get tax rate if account type is tax
 	# ------------------------------------
diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt
index eedb01c..497c99f 100644
--- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt
+++ b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt
@@ -5,7 +5,7 @@
 	{
 		'creation': '2010-08-08 17:09:18',
 		'docstatus': 0,
-		'modified': '2011-12-08 16:28:22',
+		'modified': '2011-12-20 18:23:36',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
@@ -21,7 +21,7 @@
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1323341785',
+		'_last_update': '1324367593',
 		'change_log': '1. Change in pull_details method dt.-26-06-2009',
 		'colour': 'White:FFF',
 		'default_print_format': 'Standard',
@@ -34,7 +34,7 @@
 		'server_code_error': ' ',
 		'show_in_menu': 0,
 		'subject': 'To %(customer_name)s worth %(currency)s %(grand_total_export)s due on %(due_date)s | %(outstanding_amount)s outstanding',
-		'version': 388
+		'version': 391
 	},
 
 	# These values are common for all DocFormat
@@ -470,42 +470,26 @@
 	# DocField
 	{
 		'colour': 'White:FFF',
-		'description': 'Select Items from Sales Order',
+		'description': 'Select the currency in which price list is maintained',
 		'doctype': 'DocField',
-		'fieldname': 'sales_order_main',
-		'fieldtype': 'Link',
-		'label': 'Sales Order',
-		'oldfieldname': 'sales_order_main',
-		'oldfieldtype': 'Link',
-		'options': 'Sales Order',
+		'fieldname': 'price_list_currency',
+		'fieldtype': 'Select',
+		'label': 'Price List Currency',
+		'options': 'link:Currency',
 		'permlevel': 0,
-		'print_hide': 1
+		'reqd': 1
 	},
 
 	# DocField
 	{
 		'colour': 'White:FFF',
-		'description': 'Select Items from Delivery Note',
+		'description': 'Rate at which Price list currency is converted to your currency',
 		'doctype': 'DocField',
-		'fieldname': 'delivery_note_main',
-		'fieldtype': 'Link',
-		'label': 'Delivery Note',
-		'oldfieldname': 'delivery_note_main',
-		'oldfieldtype': 'Link',
-		'options': 'Delivery Note',
+		'fieldname': 'plc_conversion_rate',
+		'fieldtype': 'Currency',
+		'label': 'Price List Currency Conversion Rate',
 		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Get Items',
-		'oldfieldtype': 'Button',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': 'Client'
+		'reqd': 1
 	},
 
 	# DocField
@@ -546,6 +530,47 @@
 
 	# DocField
 	{
+		'colour': 'White:FFF',
+		'description': 'Select Items from Sales Order',
+		'doctype': 'DocField',
+		'fieldname': 'sales_order_main',
+		'fieldtype': 'Link',
+		'label': 'Sales Order',
+		'oldfieldname': 'sales_order_main',
+		'oldfieldtype': 'Link',
+		'options': 'Sales Order',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'description': 'Select Items from Delivery Note',
+		'doctype': 'DocField',
+		'fieldname': 'delivery_note_main',
+		'fieldtype': 'Link',
+		'label': 'Delivery Note',
+		'oldfieldname': 'delivery_note_main',
+		'oldfieldtype': 'Link',
+		'options': 'Delivery Note',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldtype': 'Button',
+		'label': 'Get Items',
+		'oldfieldtype': 'Button',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': 'Client'
+	},
+
+	# DocField
+	{
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
 		'permlevel': 0
diff --git a/erpnext/hr/doctype/attendance/attendance.txt b/erpnext/hr/doctype/attendance/attendance.txt
index 4f189b1..9c795bb 100644
--- a/erpnext/hr/doctype/attendance/attendance.txt
+++ b/erpnext/hr/doctype/attendance/attendance.txt
@@ -5,15 +5,16 @@
 	{
 		'creation': '2010-09-23 10:26:03',
 		'docstatus': 0,
-		'modified': '2011-06-27 14:39:08',
+		'modified': '2011-12-19 14:11:15',
 		'modified_by': 'Administrator',
 		'owner': 'ashwini@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1308808105',
+		'_last_update': '1317365120',
 		'colour': 'White:FFF',
+		'default_print_format': 'Standard',
 		'doctype': 'DocType',
 		'document_type': 'Master',
 		'module': 'HR',
@@ -22,7 +23,7 @@
 		'section_style': 'Simple',
 		'server_code_error': ' ',
 		'show_in_menu': 0,
-		'version': 74
+		'version': 75
 	},
 
 	# These values are common for all DocField
@@ -72,7 +73,6 @@
 	{
 		'amend': 0,
 		'doctype': 'DocPerm',
-		'idx': 1,
 		'role': 'System Manager'
 	},
 
@@ -80,7 +80,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 1,
 		'label': 'Attendance Details',
 		'oldfieldtype': 'Section Break',
 		'options': 'Simple'
@@ -91,7 +90,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'naming_series',
 		'fieldtype': 'Select',
-		'idx': 2,
 		'label': 'Naming Series',
 		'no_copy': 1,
 		'oldfieldname': 'naming_series',
@@ -106,7 +104,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'employee',
 		'fieldtype': 'Link',
-		'idx': 3,
 		'in_filter': 1,
 		'label': 'Employee',
 		'oldfieldname': 'employee',
@@ -122,7 +119,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'employee_name',
 		'fieldtype': 'Data',
-		'idx': 4,
 		'label': 'Employee Name',
 		'oldfieldname': 'employee_name',
 		'oldfieldtype': 'Data'
@@ -134,27 +130,14 @@
 		'doctype': 'DocField',
 		'fieldname': 'status',
 		'fieldtype': 'Select',
-		'idx': 5,
 		'in_filter': 1,
 		'label': 'Status',
+		'no_copy': 1,
 		'oldfieldname': 'status',
 		'oldfieldtype': 'Select',
 		'options': '\nPresent\nAbsent\nHalf Day',
 		'reqd': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'shifts',
-		'fieldtype': 'Select',
-		'idx': 6,
-		'label': 'Shifts',
-		'oldfieldname': 'shifts',
-		'oldfieldtype': 'Select',
-		'options': '\nDay\nNight',
-		'reqd': 0
+		'search_index': 1
 	},
 
 	# DocField
@@ -164,7 +147,6 @@
 		'fieldname': 'leave_type',
 		'fieldtype': 'Link',
 		'hidden': 1,
-		'idx': 7,
 		'label': 'Leave Type',
 		'oldfieldname': 'leave_type',
 		'oldfieldtype': 'Link',
@@ -177,7 +159,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 8,
 		'oldfieldtype': 'Column Break',
 		'width': '50%'
 	},
@@ -187,13 +168,12 @@
 		'doctype': 'DocField',
 		'fieldname': 'att_date',
 		'fieldtype': 'Date',
-		'idx': 9,
 		'in_filter': 1,
 		'label': 'Attendance Date',
 		'oldfieldname': 'att_date',
 		'oldfieldtype': 'Date',
 		'reqd': 1,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -201,7 +181,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'fiscal_year',
 		'fieldtype': 'Select',
-		'idx': 10,
 		'in_filter': 1,
 		'label': 'Fiscal Year',
 		'oldfieldname': 'fiscal_year',
@@ -215,7 +194,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'company',
 		'fieldtype': 'Select',
-		'idx': 11,
 		'in_filter': 1,
 		'label': 'Company',
 		'oldfieldname': 'company',
diff --git a/erpnext/patches/delivery_billing_status_patch.py b/erpnext/patches/delivery_billing_status_patch.py
index 1fcd8bf..7de04b7 100644
--- a/erpnext/patches/delivery_billing_status_patch.py
+++ b/erpnext/patches/delivery_billing_status_patch.py
@@ -49,7 +49,7 @@
 	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'))""")
 			
-def run_patch():
+def execute():
 	update_delivered_billed_qty()
 	update_percent()
 	update_status()
diff --git a/erpnext/patches/price_list_patch.py b/erpnext/patches/price_list_patch.py
new file mode 100644
index 0000000..0f485b3
--- /dev/null
+++ b/erpnext/patches/price_list_patch.py
@@ -0,0 +1,13 @@
+def execute():
+	import webnotes
+	from webnotes.modules.module_manager import reload_doc
+
+	reload_doc('accounts', 'doctype', 'receivable_voucher')
+	reload_doc('stock', 'doctype', 'delivery_note')
+	reload_doc('selling', 'doctype', 'sales_order')
+	reload_doc('selling', 'doctype', 'quotation')
+	reload_doc('setup', 'doctype', 'manage_account')
+
+
+	for d in ['Receivable Voucher', 'Delivery Note', 'Sales Order', 'Quotation']:
+		webnotes.conn.sql("update `tab%s` set price_list_currency = currency, plc_conversion_rate = conversion_rate" % d)
diff --git a/erpnext/patches/repost_stock.py b/erpnext/patches/repost_stock.py
index 680e06f..a19494c 100644
--- a/erpnext/patches/repost_stock.py
+++ b/erpnext/patches/repost_stock.py
@@ -2,6 +2,7 @@
     import webnotes
     sql = webnotes.conn.sql
     from webnotes.model.code import get_obj
+    from webnotes.utils import flt
 
     # update incoming rate in serial nos
     sr = sql("""select name, item_code, purchase_document_no from `tabSerial No`
diff --git a/erpnext/projects/doctype/project_milestone/project_milestone.txt b/erpnext/projects/doctype/project_milestone/project_milestone.txt
index eab533b..6d45a7c 100644
--- a/erpnext/projects/doctype/project_milestone/project_milestone.txt
+++ b/erpnext/projects/doctype/project_milestone/project_milestone.txt
@@ -5,21 +5,22 @@
 	{
 		'creation': '2010-08-08 17:09:15',
 		'docstatus': 0,
-		'modified': '2011-01-05 15:24:43',
-		'modified_by': 'sneha@webnotestech.com',
+		'modified': '2011-12-19 14:11:40',
+		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
 		'colour': 'White:FFF',
+		'default_print_format': 'Standard',
 		'doctype': 'DocType',
 		'istable': 1,
 		'module': 'Projects',
 		'name': '__common__',
 		'section_style': 'Simple',
 		'server_code_error': ' ',
-		'version': 2
+		'version': 4
 	},
 
 	# These values are common for all DocField
@@ -43,7 +44,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'milestone_date',
 		'fieldtype': 'Date',
-		'idx': 1,
 		'label': 'Milestone Date',
 		'oldfieldname': 'milestone_date',
 		'oldfieldtype': 'Date'
@@ -52,18 +52,8 @@
 	# DocField
 	{
 		'doctype': 'DocField',
-		'fieldname': 'actual_completion_date_',
-		'fieldtype': 'Date',
-		'idx': 2,
-		'label': 'Actual Completion Date '
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
 		'fieldname': 'milestone',
 		'fieldtype': 'Text',
-		'idx': 3,
 		'label': 'Milestone',
 		'oldfieldname': 'milestone',
 		'oldfieldtype': 'Text',
@@ -75,8 +65,8 @@
 		'doctype': 'DocField',
 		'fieldname': 'status',
 		'fieldtype': 'Select',
-		'idx': 4,
 		'label': 'Status',
+		'no_copy': 1,
 		'oldfieldname': 'status',
 		'oldfieldtype': 'Select',
 		'options': 'Pending\nCompleted'
diff --git a/erpnext/selling/doctype/enquiry/enquiry.txt b/erpnext/selling/doctype/enquiry/enquiry.txt
index 260e077..0bf3b7f 100644
--- a/erpnext/selling/doctype/enquiry/enquiry.txt
+++ b/erpnext/selling/doctype/enquiry/enquiry.txt
@@ -5,15 +5,16 @@
 	{
 		'creation': '2010-08-08 17:09:00',
 		'docstatus': 0,
-		'modified': '2011-05-12 18:27:46',
+		'modified': '2011-12-19 14:11:27',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1305205067',
+		'_last_update': '1316075905',
 		'colour': 'White:FFF',
+		'default_print_format': 'Standard',
 		'doctype': 'DocType',
 		'document_type': 'Transaction',
 		'module': 'Selling',
@@ -23,7 +24,7 @@
 		'server_code_error': ' ',
 		'show_in_menu': 0,
 		'subject': 'To %(customer_name)s%(lead_name)s on %(transaction_date)s',
-		'version': 586
+		'version': 587
 	},
 
 	# These values are common for all DocField
@@ -57,7 +58,6 @@
 		'cancel': 0,
 		'create': 0,
 		'doctype': 'DocPerm',
-		'idx': 1,
 		'permlevel': 1,
 		'role': 'Sales Manager',
 		'submit': 0,
@@ -70,7 +70,6 @@
 		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 2,
 		'permlevel': 0,
 		'role': 'System Manager',
 		'submit': 1,
@@ -80,7 +79,6 @@
 	# DocPerm
 	{
 		'doctype': 'DocPerm',
-		'idx': 3,
 		'permlevel': 1,
 		'role': 'System Manager'
 	},
@@ -91,7 +89,6 @@
 		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 4,
 		'permlevel': 0,
 		'role': 'Sales User',
 		'submit': 1,
@@ -104,7 +101,6 @@
 		'cancel': 0,
 		'create': 0,
 		'doctype': 'DocPerm',
-		'idx': 5,
 		'permlevel': 1,
 		'role': 'Sales User',
 		'submit': 0,
@@ -117,7 +113,6 @@
 		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 6,
 		'permlevel': 0,
 		'role': 'Sales Manager',
 		'submit': 1,
@@ -130,7 +125,6 @@
 		'description': 'Enter customer enquiry for which you might raise a quotation in future',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 1,
 		'label': 'Basic Info',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0
@@ -143,7 +137,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'naming_series',
 		'fieldtype': 'Select',
-		'idx': 2,
 		'label': 'Series',
 		'no_copy': 1,
 		'oldfieldname': 'naming_series',
@@ -159,7 +152,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'enquiry_from',
 		'fieldtype': 'Select',
-		'idx': 3,
 		'label': 'Enquiry From',
 		'oldfieldname': 'enquiry_from',
 		'oldfieldtype': 'Select',
@@ -178,7 +170,6 @@
 		'fieldname': 'customer',
 		'fieldtype': 'Link',
 		'hidden': 0,
-		'idx': 4,
 		'in_filter': 1,
 		'label': 'Customer',
 		'oldfieldname': 'customer',
@@ -187,7 +178,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 0,
-		'search_index': 1,
+		'search_index': 0,
 		'trigger': 'Client'
 	},
 
@@ -196,7 +187,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'customer_address',
 		'fieldtype': 'Link',
-		'idx': 5,
 		'in_filter': 1,
 		'label': 'Customer Address',
 		'options': 'Address',
@@ -210,7 +200,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'contact_person',
 		'fieldtype': 'Link',
-		'idx': 6,
 		'in_filter': 1,
 		'label': 'Contact Person',
 		'options': 'Contact',
@@ -224,7 +213,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'customer_name',
 		'fieldtype': 'Data',
-		'idx': 7,
 		'label': 'Customer Name',
 		'permlevel': 1,
 		'print_hide': 0
@@ -236,7 +224,6 @@
 		'fieldname': 'lead',
 		'fieldtype': 'Link',
 		'hidden': 0,
-		'idx': 8,
 		'in_filter': 1,
 		'label': 'Lead',
 		'oldfieldname': 'lead',
@@ -244,7 +231,6 @@
 		'options': 'Lead',
 		'permlevel': 0,
 		'print_hide': 1,
-		'search_index': 1,
 		'trigger': 'Client'
 	},
 
@@ -254,7 +240,6 @@
 		'fieldname': 'lead_name',
 		'fieldtype': 'Data',
 		'hidden': 0,
-		'idx': 9,
 		'label': 'Name',
 		'oldfieldname': 'lead_name',
 		'oldfieldtype': 'Data',
@@ -267,7 +252,6 @@
 		'fieldname': 'address_display',
 		'fieldtype': 'Small Text',
 		'hidden': 0,
-		'idx': 10,
 		'label': 'Address',
 		'oldfieldname': 'address',
 		'oldfieldtype': 'Small Text',
@@ -279,7 +263,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'contact_display',
 		'fieldtype': 'Small Text',
-		'idx': 11,
 		'label': 'Contact',
 		'permlevel': 1
 	},
@@ -289,7 +272,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'contact_mobile',
 		'fieldtype': 'Text',
-		'idx': 12,
 		'label': 'Contact Mobile No',
 		'permlevel': 1
 	},
@@ -299,7 +281,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'contact_email',
 		'fieldtype': 'Text',
-		'idx': 13,
 		'label': 'Contact Email',
 		'permlevel': 1
 	},
@@ -308,7 +289,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 14,
 		'oldfieldtype': 'Column Break',
 		'permlevel': 0,
 		'width': '50%'
@@ -321,13 +301,11 @@
 		'doctype': 'DocField',
 		'fieldname': 'transaction_date',
 		'fieldtype': 'Date',
-		'idx': 15,
 		'label': 'Enquiry Date',
 		'oldfieldname': 'transaction_date',
 		'oldfieldtype': 'Date',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 1,
 		'width': '50px'
 	},
 
@@ -337,7 +315,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'enquiry_type',
 		'fieldtype': 'Select',
-		'idx': 16,
 		'label': 'Enquiry Type',
 		'oldfieldname': 'enquiry_type',
 		'oldfieldtype': 'Select',
@@ -353,7 +330,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'status',
 		'fieldtype': 'Select',
-		'idx': 17,
 		'label': 'Status',
 		'no_copy': 1,
 		'oldfieldname': 'status',
@@ -368,7 +344,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'amended_from',
 		'fieldtype': 'Data',
-		'idx': 18,
 		'label': 'Amended From',
 		'no_copy': 1,
 		'oldfieldname': 'amended_from',
@@ -383,7 +358,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'amendment_date',
 		'fieldtype': 'Date',
-		'idx': 19,
 		'label': 'Amendment Date',
 		'no_copy': 1,
 		'oldfieldname': 'amendment_date',
@@ -400,26 +374,25 @@
 		'doctype': 'DocField',
 		'fieldname': 'territory',
 		'fieldtype': 'Link',
-		'idx': 20,
 		'in_filter': 1,
 		'label': 'Territory',
 		'options': 'Territory',
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 0,
+		'search_index': 1,
 		'trigger': 'Client'
 	},
 
 	# DocField
 	{
 		'colour': 'White:FFF',
+		'depends_on': 'eval:doc.enquiry_from=="Customer"',
 		'description': '<a href="javascript:cur_frm.cscript.CGHelp();">To Manage Customer Groups, click here</a>',
 		'doctype': 'DocField',
 		'fieldname': 'customer_group',
 		'fieldtype': 'Link',
 		'hidden': 0,
-		'idx': 21,
 		'in_filter': 1,
 		'label': 'Customer Group',
 		'oldfieldname': 'customer_group',
@@ -428,7 +401,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 0,
-		'search_index': 0,
+		'search_index': 1,
 		'trigger': 'Client'
 	},
 
@@ -437,7 +410,6 @@
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 22,
 		'label': 'Items',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0
@@ -450,7 +422,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'enquiry_details',
 		'fieldtype': 'Table',
-		'idx': 23,
 		'label': 'Enquiry Details',
 		'oldfieldname': 'enquiry_details',
 		'oldfieldtype': 'Table',
@@ -464,7 +435,6 @@
 		'description': 'Filing in Additional Information about the Enquiry will help you analyze your data better.',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 24,
 		'label': 'More Info',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0
@@ -474,7 +444,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 25,
 		'oldfieldtype': 'Column Break',
 		'permlevel': 0,
 		'width': '50%'
@@ -485,7 +454,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'company',
 		'fieldtype': 'Link',
-		'idx': 26,
 		'in_filter': 1,
 		'label': 'Company',
 		'oldfieldname': 'company',
@@ -494,7 +462,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 0
+		'search_index': 1
 	},
 
 	# DocField
@@ -502,7 +470,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'fiscal_year',
 		'fieldtype': 'Select',
-		'idx': 27,
 		'in_filter': 1,
 		'label': 'Fiscal Year',
 		'oldfieldname': 'fiscal_year',
@@ -511,7 +478,7 @@
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
-		'search_index': 0
+		'search_index': 1
 	},
 
 	# DocField
@@ -519,7 +486,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'source',
 		'fieldtype': 'Select',
-		'idx': 28,
 		'label': 'Source',
 		'oldfieldname': 'source',
 		'oldfieldtype': 'Select',
@@ -534,7 +500,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'campaign',
 		'fieldtype': 'Link',
-		'idx': 29,
 		'label': 'Campaign',
 		'oldfieldname': 'campaign',
 		'oldfieldtype': 'Link',
@@ -549,7 +514,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'order_lost_reason',
 		'fieldtype': 'Small Text',
-		'idx': 30,
 		'label': 'Order Lost Reason',
 		'no_copy': 1,
 		'oldfieldname': 'order_lost_reason',
@@ -562,7 +526,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 31,
 		'oldfieldtype': 'Column Break',
 		'permlevel': 0,
 		'width': '50%'
@@ -575,7 +538,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'contact_by',
 		'fieldtype': 'Link',
-		'idx': 32,
 		'in_filter': 1,
 		'label': 'Next Contact By',
 		'oldfieldname': 'contact_by',
@@ -592,7 +554,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'contact_date',
 		'fieldtype': 'Date',
-		'idx': 33,
 		'label': 'Next Contact Date',
 		'oldfieldname': 'contact_date',
 		'oldfieldtype': 'Date',
@@ -608,7 +569,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'last_contact_date',
 		'fieldtype': 'Date',
-		'idx': 34,
 		'label': 'Last Contact Date',
 		'no_copy': 1,
 		'oldfieldname': 'last_contact_date',
@@ -622,7 +582,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'to_discuss',
 		'fieldtype': 'Small Text',
-		'idx': 35,
 		'label': 'To Discuss',
 		'no_copy': 1,
 		'oldfieldname': 'to_discuss',
@@ -636,7 +595,6 @@
 		'description': 'Keep a track of communication related to this enquiry which will help for future reference.',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 36,
 		'label': 'Communication History',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0
@@ -649,7 +607,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'follow_up',
 		'fieldtype': 'Table',
-		'idx': 37,
 		'label': 'Follow Up',
 		'oldfieldname': 'follow_up',
 		'oldfieldtype': 'Table',
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index 21eceb9..4c205a9 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -18,7 +18,8 @@
   if(!doc.transaction_date) set_multiple(cdt,cdn,{transaction_date:get_today()});
   if(!doc.conversion_rate) set_multiple(cdt,cdn,{conversion_rate:'1.00'});
   if(!doc.currency && sys_defaults.currency) set_multiple(cdt,cdn,{currency:sys_defaults.currency});
-  //if(!doc.price_list_name && sys_defaults.price_list_name) set_multiple(cdt,cdn,{price_list_name:sys_defaults.price_list_name});
+  if(!doc.price_list_currency) set_multiple(cdt, cdn, {price_list_currency: doc.currency, plc_conversion_rate: 1});
+
   if(!doc.company && sys_defaults.company) set_multiple(cdt,cdn,{company:sys_defaults.company});
   if(!doc.fiscal_year && sys_defaults.fiscal_year) set_multiple(cdt,cdn,{fiscal_year:sys_defaults.fiscal_year});
 
@@ -51,7 +52,6 @@
     hide_field(['lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory']);
     doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = "";
   }
-  //refresh_many(['lead','customer']);
 }
 
 
@@ -59,10 +59,6 @@
 //================ hide - unhide fields on basis of quotation to either lead or customer ===============================
 cur_frm.cscript.quotation_to = function(doc,cdt,cdn){
   cur_frm.cscript.lead_cust_show(doc,cdt,cdn);
-  //doc.customer_address = doc.territory = doc.contact_no = doc.email_id = "";
-  //refresh_many(['territory','customer_address','contact_no','email_id']);
-  //doc.address_display = doc.contact_display = "";
-  //refresh_many(['address_display','contact_display']);
 }
 
 
@@ -80,31 +76,8 @@
 
   if (!doc.docstatus) hide_field(['Update Follow up']);
   else unhide_field(['Update Follow up']);
-  //cur_frm.cscript.lead_cust_show(doc,cdt,cdn);
 }
 
-// ============== Lead and its Details ============================
-
-/*
-//================ create new contact ============================================================================
-cur_frm.cscript.new_contact = function(){
-  tn = createLocal('Contact');
-  locals['Contact'][tn].is_customer = 1;
-  if(doc.customer) locals['Contact'][tn].customer = doc.customer;
-  loaddoc('Contact', tn);
-}
-*/
-
-
-// DOCTYPE TRIGGERS
-// ====================================================================================
-
-/*
-// ***************** Get Contact Person based on customer selected *****************
-cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
-  return 'SELECT `tabContact`.contact_name, `tabContact`.email_id FROM `tabContact` WHERE `tabContact`.is_customer = 1 AND `tabContact`.docstatus != 2 AND `tabContact`.customer = "'+ doc.customer +'" AND `tabContact`.docstatus != 2 AND `tabContact`.contact_name LIKE "%s" ORDER BY `tabContact`.contact_name ASC LIMIT 50';
-}
-*/
 
 //customer
 cur_frm.cscript.customer = function(doc,dt,dn) {
@@ -274,14 +247,6 @@
 }
 
 
-
-
-/*
-//get query select Territory
-cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
-  return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"  ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';}
-*/
-
 //===================== Quotation to validation - either customer or lead mandatory ====================
 cur_frm.cscript.quot_to_validate = function(doc,cdt,cdn){
 
@@ -293,14 +258,11 @@
     }
   }
   else if(doc.quotation_to == 'Customer'){
-
     if(!doc.customer){
       alert("Customer is mandatory.");
       validated = false;
     }
-
   }
-
 }
 
 //===================validation function =================================
diff --git a/erpnext/selling/doctype/quotation/quotation.txt b/erpnext/selling/doctype/quotation/quotation.txt
index 6763c2d..86b7b5f 100644
--- a/erpnext/selling/doctype/quotation/quotation.txt
+++ b/erpnext/selling/doctype/quotation/quotation.txt
@@ -5,18 +5,19 @@
 	{
 		'creation': '2010-08-08 17:09:17',
 		'docstatus': 0,
-		'modified': '2011-06-21 17:17:07',
+		'modified': '2011-12-20 14:01:09',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1308741898',
+		'_last_update': '1322549700',
 		'allow_attach': 1,
 		'allow_email': 0,
 		'allow_trash': 1,
 		'colour': 'White:FFF',
+		'default_print_format': 'Standard',
 		'doctype': 'DocType',
 		'document_type': 'Transaction',
 		'hide_toolbar': 0,
@@ -31,7 +32,7 @@
 		'show_in_menu': 0,
 		'subject': 'To %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s',
 		'tag_fields': 'status',
-		'version': 596
+		'version': 597
 	},
 
 	# These values are common for all DocField
@@ -49,8 +50,7 @@
 		'name': '__common__',
 		'parent': 'Quotation',
 		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'read': 1
+		'parenttype': 'DocType'
 	},
 
 	# DocType, Quotation
@@ -61,12 +61,19 @@
 
 	# DocPerm
 	{
+		'doctype': 'DocPerm',
+		'permlevel': 0,
+		'role': 'user print'
+	},
+
+	# DocPerm
+	{
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
 		'doctype': 'DocPerm',
-		'idx': 1,
 		'permlevel': 1,
+		'read': 1,
 		'role': 'Sales Manager',
 		'submit': 0,
 		'write': 0
@@ -78,8 +85,8 @@
 		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 2,
 		'permlevel': 0,
+		'read': 1,
 		'role': 'Sales Manager',
 		'submit': 1,
 		'write': 1
@@ -91,8 +98,8 @@
 		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 3,
 		'permlevel': 0,
+		'read': 1,
 		'role': 'Sales User',
 		'submit': 1,
 		'write': 1
@@ -104,8 +111,8 @@
 		'cancel': 0,
 		'create': 0,
 		'doctype': 'DocPerm',
-		'idx': 4,
 		'permlevel': 1,
+		'read': 1,
 		'role': 'Sales User',
 		'submit': 0,
 		'write': 0
@@ -114,9 +121,9 @@
 	# DocPerm
 	{
 		'doctype': 'DocPerm',
-		'idx': 5,
 		'match': 'customer_name',
 		'permlevel': 0,
+		'read': 1,
 		'role': 'Customer'
 	},
 
@@ -126,8 +133,8 @@
 		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 6,
 		'permlevel': 0,
+		'read': 1,
 		'role': 'Maintenance Manager',
 		'submit': 1,
 		'write': 1
@@ -136,8 +143,8 @@
 	# DocPerm
 	{
 		'doctype': 'DocPerm',
-		'idx': 7,
 		'permlevel': 1,
+		'read': 1,
 		'role': 'Maintenance Manager'
 	},
 
@@ -147,8 +154,8 @@
 		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 8,
 		'permlevel': 0,
+		'read': 1,
 		'role': 'Maintenance User',
 		'submit': 1,
 		'write': 1
@@ -157,8 +164,8 @@
 	# DocPerm
 	{
 		'doctype': 'DocPerm',
-		'idx': 9,
 		'permlevel': 1,
+		'read': 1,
 		'role': 'Maintenance User'
 	},
 
@@ -167,7 +174,6 @@
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 1,
 		'label': 'Basic Info',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0,
@@ -178,7 +184,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 2,
 		'permlevel': 0,
 		'width': '50%'
 	},
@@ -190,7 +195,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'naming_series',
 		'fieldtype': 'Select',
-		'idx': 3,
 		'label': 'Series',
 		'no_copy': 1,
 		'oldfieldname': 'naming_series',
@@ -207,7 +211,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'quotation_to',
 		'fieldtype': 'Select',
-		'idx': 4,
 		'in_filter': 1,
 		'label': 'Quotation To',
 		'oldfieldname': 'quotation_to',
@@ -227,7 +230,6 @@
 		'fieldname': 'customer',
 		'fieldtype': 'Link',
 		'hidden': 0,
-		'idx': 5,
 		'in_filter': 1,
 		'label': 'Customer',
 		'oldfieldname': 'customer',
@@ -246,7 +248,6 @@
 		'fieldname': 'customer_address',
 		'fieldtype': 'Link',
 		'hidden': 0,
-		'idx': 6,
 		'in_filter': 1,
 		'label': 'Customer Address',
 		'options': 'Address',
@@ -262,7 +263,6 @@
 		'fieldname': 'contact_person',
 		'fieldtype': 'Link',
 		'hidden': 0,
-		'idx': 7,
 		'in_filter': 1,
 		'label': 'Contact Person',
 		'oldfieldname': 'contact_person',
@@ -279,7 +279,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'customer_name',
 		'fieldtype': 'Data',
-		'idx': 8,
 		'label': 'Name',
 		'permlevel': 1
 	},
@@ -291,7 +290,6 @@
 		'fieldname': 'lead',
 		'fieldtype': 'Link',
 		'hidden': 0,
-		'idx': 9,
 		'in_filter': 1,
 		'label': 'Lead',
 		'oldfieldname': 'lead',
@@ -308,7 +306,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'lead_name',
 		'fieldtype': 'Text',
-		'idx': 10,
 		'label': 'Name',
 		'permlevel': 1
 	},
@@ -320,7 +317,6 @@
 		'fieldname': 'address_display',
 		'fieldtype': 'Small Text',
 		'hidden': 0,
-		'idx': 11,
 		'in_filter': 0,
 		'label': 'Address',
 		'oldfieldname': 'customer_address',
@@ -337,7 +333,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'contact_display',
 		'fieldtype': 'Small Text',
-		'idx': 12,
 		'in_filter': 0,
 		'label': 'Contact',
 		'permlevel': 1,
@@ -351,7 +346,6 @@
 		'fieldname': 'contact_mobile',
 		'fieldtype': 'Text',
 		'hidden': 0,
-		'idx': 13,
 		'label': 'Mobile No',
 		'permlevel': 1,
 		'print_hide': 0
@@ -363,7 +357,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'contact_email',
 		'fieldtype': 'Text',
-		'idx': 14,
 		'label': 'Contact Email',
 		'permlevel': 1,
 		'print_hide': 1
@@ -374,7 +367,6 @@
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 15,
 		'oldfieldtype': 'Column Break',
 		'permlevel': 0,
 		'width': '50%'
@@ -387,7 +379,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'transaction_date',
 		'fieldtype': 'Date',
-		'idx': 16,
 		'in_filter': 1,
 		'label': 'Quotation Date',
 		'no_copy': 1,
@@ -405,7 +396,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'order_type',
 		'fieldtype': 'Select',
-		'idx': 17,
 		'in_filter': 1,
 		'label': 'Order Type',
 		'oldfieldname': 'order_type',
@@ -425,7 +415,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'status',
 		'fieldtype': 'Select',
-		'idx': 18,
 		'in_filter': 1,
 		'label': 'Status',
 		'no_copy': 1,
@@ -443,7 +432,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'amended_from',
 		'fieldtype': 'Data',
-		'idx': 19,
 		'label': 'Amended From',
 		'no_copy': 1,
 		'oldfieldname': 'amended_from',
@@ -459,7 +447,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'amendment_date',
 		'fieldtype': 'Date',
-		'idx': 20,
 		'label': 'Amendment Date',
 		'no_copy': 1,
 		'oldfieldname': 'amendment_date',
@@ -477,7 +464,6 @@
 		'fieldname': 'enq_no',
 		'fieldtype': 'Link',
 		'hidden': 0,
-		'idx': 21,
 		'in_filter': 1,
 		'label': 'Enquiry No',
 		'no_copy': 0,
@@ -495,7 +481,6 @@
 		'doctype': 'DocField',
 		'fieldtype': 'Button',
 		'hidden': 0,
-		'idx': 22,
 		'label': 'Pull Enquiry Detail',
 		'no_copy': 0,
 		'oldfieldtype': 'Button',
@@ -513,7 +498,6 @@
 		'fieldname': 'territory',
 		'fieldtype': 'Link',
 		'hidden': 0,
-		'idx': 23,
 		'in_filter': 1,
 		'label': 'Territory',
 		'options': 'Territory',
@@ -530,7 +514,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'customer_group',
 		'fieldtype': 'Link',
-		'idx': 24,
 		'in_filter': 1,
 		'label': 'Customer Group',
 		'oldfieldname': 'customer_group',
@@ -548,7 +531,6 @@
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 25,
 		'label': 'Items',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0,
@@ -558,24 +540,11 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 26,
-		'label': 'Clear Table',
-		'oldfieldtype': 'Button',
-		'options': 'clear_quotation_details',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
 		'colour': 'White:FFF',
 		'description': 'Select the price list as entered in "Price List" master. This will pull the reference rates of items against this price list as specified in "Item" master.',
 		'doctype': 'DocField',
 		'fieldname': 'price_list_name',
 		'fieldtype': 'Select',
-		'idx': 27,
 		'in_filter': 1,
 		'label': 'Price List',
 		'oldfieldname': 'price_list_name',
@@ -591,9 +560,33 @@
 
 	# DocField
 	{
+		'colour': 'White:FFF',
+		'description': 'Select the currency in which price list is maintained',
+		'doctype': 'DocField',
+		'fieldname': 'price_list_currency',
+		'fieldtype': 'Select',
+		'label': 'Price List Currency',
+		'options': 'link:Currency',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'description': 'Rate at which Price list currency is converted to your currency',
+		'doctype': 'DocField',
+		'fieldname': 'plc_conversion_rate',
+		'fieldtype': 'Currency',
+		'label': 'Price List Currency Conversion Rate',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 28,
 		'permlevel': 0,
 		'width': '50%'
 	},
@@ -605,7 +598,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'currency',
 		'fieldtype': 'Select',
-		'idx': 29,
 		'in_filter': 1,
 		'label': 'Currency',
 		'oldfieldname': 'currency',
@@ -627,7 +619,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'conversion_rate',
 		'fieldtype': 'Currency',
-		'idx': 30,
 		'label': 'Currency Conversion Rate',
 		'oldfieldname': 'conversion_rate',
 		'oldfieldtype': 'Currency',
@@ -641,8 +632,18 @@
 	# DocField
 	{
 		'doctype': 'DocField',
+		'fieldtype': 'Button',
+		'label': 'Clear Table',
+		'oldfieldtype': 'Button',
+		'options': 'clear_quotation_details',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 31,
 		'options': 'Simple',
 		'permlevel': 0
 	},
@@ -655,7 +656,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'quotation_details',
 		'fieldtype': 'Table',
-		'idx': 32,
 		'label': 'Quotation Details',
 		'oldfieldname': 'quotation_details',
 		'oldfieldtype': 'Table',
@@ -669,7 +669,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'net_total',
 		'fieldtype': 'Currency',
-		'idx': 33,
 		'label': 'Net Total*',
 		'no_copy': 0,
 		'oldfieldname': 'net_total',
@@ -684,7 +683,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Button',
-		'idx': 34,
 		'label': 'Re-Calculate Values',
 		'oldfieldtype': 'Button',
 		'permlevel': 0,
@@ -697,7 +695,6 @@
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldtype': 'HTML',
-		'idx': 35,
 		'label': 'Note HTML',
 		'oldfieldtype': 'HTML',
 		'options': '<div style="margin-top:16px"><b>Note :</b> * In Base Currency\n</div>',
@@ -710,7 +707,6 @@
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 36,
 		'label': 'Taxes',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0
@@ -722,7 +718,6 @@
 		'fieldname': 'charge',
 		'fieldtype': 'Link',
 		'hidden': 0,
-		'idx': 37,
 		'label': 'Select Charges Master',
 		'oldfieldname': 'charge',
 		'oldfieldtype': 'Link',
@@ -737,7 +732,6 @@
 		'doctype': 'DocField',
 		'fieldtype': 'Button',
 		'hidden': 0,
-		'idx': 38,
 		'label': 'Get Charges',
 		'oldfieldtype': 'Button',
 		'permlevel': 0,
@@ -750,7 +744,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'other_charges',
 		'fieldtype': 'Table',
-		'idx': 39,
 		'label': 'Other Charges',
 		'oldfieldname': 'other_charges',
 		'oldfieldtype': 'Table',
@@ -763,7 +756,6 @@
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldtype': 'Button',
-		'idx': 40,
 		'label': 'Calculate Charges',
 		'oldfieldtype': 'Button',
 		'permlevel': 0,
@@ -776,7 +768,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'other_charges_total',
 		'fieldtype': 'Currency',
-		'idx': 41,
 		'label': 'Charges Total*',
 		'oldfieldname': 'other_charges_total',
 		'oldfieldtype': 'Currency',
@@ -789,7 +780,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'grand_total',
 		'fieldtype': 'Currency',
-		'idx': 42,
 		'label': 'Grand Total*',
 		'no_copy': 0,
 		'oldfieldname': 'grand_total',
@@ -804,7 +794,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'HTML',
-		'idx': 43,
 		'label': 'Other Charges Calculation',
 		'oldfieldtype': 'HTML',
 		'permlevel': 0,
@@ -815,7 +804,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'HTML',
-		'idx': 44,
 		'label': 'OT Notes',
 		'oldfieldtype': 'HTML',
 		'options': '<div style="margin-top:16px"><b>Note :</b> * In Base Currency\n</div>',
@@ -828,7 +816,6 @@
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 45,
 		'label': 'Totals',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0,
@@ -840,7 +827,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'rounded_total',
 		'fieldtype': 'Currency',
-		'idx': 46,
 		'label': 'Rounded Total',
 		'no_copy': 0,
 		'oldfieldname': 'rounded_total',
@@ -858,7 +844,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'in_words',
 		'fieldtype': 'Data',
-		'idx': 47,
 		'label': 'In Words',
 		'no_copy': 0,
 		'oldfieldname': 'in_words',
@@ -872,7 +857,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 48,
 		'oldfieldtype': 'Column Break',
 		'permlevel': 0,
 		'print_hide': 1,
@@ -884,7 +868,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'grand_total_export',
 		'fieldtype': 'Currency',
-		'idx': 49,
 		'label': 'Grand Total (Export)',
 		'no_copy': 0,
 		'oldfieldname': 'grand_total_export',
@@ -900,7 +883,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'rounded_total_export',
 		'fieldtype': 'Currency',
-		'idx': 50,
 		'label': 'Rounded Total (Export)',
 		'no_copy': 0,
 		'oldfieldname': 'rounded_total_export',
@@ -918,7 +900,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'in_words_export',
 		'fieldtype': 'Data',
-		'idx': 51,
 		'label': 'In Words (Export)',
 		'no_copy': 0,
 		'oldfieldname': 'in_words_export',
@@ -934,7 +915,6 @@
 		'description': 'Add Terms and Conditions for the Quotation like Payment Terms, Validity of Offer etc. You can also prepare a master Term Sheet and use the Template',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 52,
 		'label': 'Terms',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0,
@@ -947,7 +927,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'letter_head',
 		'fieldtype': 'Select',
-		'idx': 53,
 		'label': 'Letter Head',
 		'oldfieldname': 'letter_head',
 		'oldfieldtype': 'Select',
@@ -961,7 +940,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'tc_name',
 		'fieldtype': 'Link',
-		'idx': 54,
 		'label': 'Select Terms',
 		'oldfieldname': 'tc_name',
 		'oldfieldtype': 'Link',
@@ -975,7 +953,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Button',
-		'idx': 55,
 		'label': 'Get Terms',
 		'oldfieldtype': 'Button',
 		'options': 'get_tc_details',
@@ -986,7 +963,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'HTML',
-		'idx': 56,
 		'label': 'Terms HTML',
 		'oldfieldtype': 'HTML',
 		'options': 'You can add Terms and Notes that will be printed in the Transaction',
@@ -999,7 +975,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'terms',
 		'fieldtype': 'Text Editor',
-		'idx': 57,
 		'label': 'Term Details',
 		'oldfieldname': 'terms',
 		'oldfieldtype': 'Text Editor',
@@ -1012,7 +987,6 @@
 		'description': 'Filling in additional information about the Quotation will help you analyze your data better.',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 58,
 		'label': 'More Info',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0,
@@ -1026,7 +1000,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'company',
 		'fieldtype': 'Link',
-		'idx': 59,
 		'in_filter': 1,
 		'label': 'Company',
 		'oldfieldname': 'company',
@@ -1046,7 +1019,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'fiscal_year',
 		'fieldtype': 'Select',
-		'idx': 60,
 		'in_filter': 1,
 		'label': 'Fiscal Year',
 		'oldfieldname': 'fiscal_year',
@@ -1065,7 +1037,6 @@
 		'fieldname': 'enq_det',
 		'fieldtype': 'Text',
 		'hidden': 1,
-		'idx': 61,
 		'label': 'Enquiry Detail',
 		'no_copy': 0,
 		'oldfieldname': 'enq_det',
@@ -1082,7 +1053,6 @@
 		'fieldname': 'source',
 		'fieldtype': 'Select',
 		'hidden': 0,
-		'idx': 62,
 		'label': 'Source',
 		'no_copy': 0,
 		'oldfieldname': 'source',
@@ -1100,7 +1070,6 @@
 		'fieldname': 'campaign',
 		'fieldtype': 'Link',
 		'hidden': 0,
-		'idx': 63,
 		'label': 'Campaign',
 		'no_copy': 0,
 		'oldfieldname': 'campaign',
@@ -1117,7 +1086,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'select_print_heading',
 		'fieldtype': 'Link',
-		'idx': 64,
 		'label': 'Select Print Heading',
 		'no_copy': 1,
 		'oldfieldname': 'select_print_heading',
@@ -1134,7 +1102,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'cancel_reason',
 		'fieldtype': 'Data',
-		'idx': 65,
 		'label': 'Cancel Reason',
 		'no_copy': 1,
 		'oldfieldname': 'cancel_reason',
@@ -1150,7 +1117,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'order_lost_reason',
 		'fieldtype': 'Small Text',
-		'idx': 66,
 		'label': 'Order Lost Reason',
 		'no_copy': 1,
 		'oldfieldname': 'order_lost_reason',
@@ -1163,7 +1129,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 67,
 		'oldfieldtype': 'Column Break',
 		'permlevel': 0,
 		'print_hide': 1,
@@ -1176,7 +1141,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'contact_by',
 		'fieldtype': 'Link',
-		'idx': 68,
 		'label': 'Next Contact By',
 		'oldfieldname': 'contact_by',
 		'oldfieldtype': 'Link',
@@ -1191,7 +1155,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'contact_date',
 		'fieldtype': 'Date',
-		'idx': 69,
 		'label': 'Next Contact Date',
 		'oldfieldname': 'contact_date',
 		'oldfieldtype': 'Date',
@@ -1206,7 +1169,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'last_contact_date',
 		'fieldtype': 'Date',
-		'idx': 70,
 		'label': 'Last Contact Date',
 		'no_copy': 1,
 		'oldfieldname': 'last_contact_date',
@@ -1220,7 +1182,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'to_discuss',
 		'fieldtype': 'Small Text',
-		'idx': 71,
 		'label': 'To Discuss',
 		'oldfieldname': 'to_discuss',
 		'oldfieldtype': 'Small Text',
@@ -1234,7 +1195,6 @@
 		'description': 'Keep a track on communications regarding this Quotation. This will help you remember earlier communications in case the Customer comes back again',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 72,
 		'label': 'Communication History',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0,
@@ -1248,7 +1208,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'follow_up',
 		'fieldtype': 'Table',
-		'idx': 73,
 		'label': 'Follow up',
 		'oldfieldname': 'follow_up',
 		'oldfieldtype': 'Table',
@@ -1265,7 +1224,6 @@
 		'fieldname': 'file_list',
 		'fieldtype': 'Small Text',
 		'hidden': 1,
-		'idx': 74,
 		'label': 'File List',
 		'no_copy': 1,
 		'permlevel': 0,
diff --git a/erpnext/selling/doctype/sales_common/sales_common.js b/erpnext/selling/doctype/sales_common/sales_common.js
index f4b3f02..23e0420 100644
--- a/erpnext/selling/doctype/sales_common/sales_common.js
+++ b/erpnext/selling/doctype/sales_common/sales_common.js
@@ -19,9 +19,10 @@
 // -----------------
 // Shipping Address
 // -----------------
-//cur_frm.add_fetch('ship_det_no', 'shipping_address', 'shipping_address');
-//cur_frm.add_fetch('ship_det_no', 'ship_to', 'ship_to');
+
 cur_frm.add_fetch('company', 'default_currency', 'currency');
+cur_frm.add_fetch('company', 'default_currency', 'price_list_currency');
+
 
 
 // ============== Customer and its primary contact Details ============================
@@ -59,15 +60,6 @@
 	loadpage('Sales Browser',call_back);
 }
 
-/*
-// ============= Customer's Contact Person Details =====================================
-cur_frm.cscript.contact_person = function(doc, cdt, cdn) {
-  var callback = function(){
-    refresh_many(['contact_no','email_id','customer_mobile_no','customer_address']);
-  }
-  get_server_fields('get_contact_details','','',doc, cdt, cdn, 1, callback);
-}
-*/
 
 // TRIGGERS FOR CALCULATIONS
 // =====================================================================================================
@@ -77,10 +69,17 @@
 	cur_frm.cscript.price_list_name(doc, cdt, cdn);
 }
 
+cur_frm.cscript.price_list_currency = cur_frm.cscript.currency;
+cur_frm.cscript.conversion_rate = cur_frm.cscript.currency;
+cur_frm.cscript.plc_conversion_rate = cur_frm.cscript.currency;
+
+
+
 // ******************** PRICE LIST ******************************
 cur_frm.cscript.price_list_name = function(doc, cdt, cdn) {
   var fname = cur_frm.cscript.fname;
-  if(doc.price_list_name && doc.currency) {
+  var cl = getchildren(cur_frm.cscript.tname, doc.name, cur_frm.cscript.fname);
+  if(doc.price_list_name && doc.currency && doc.price_list_currency && doc.conversion_rate && doc.plc_conversion_rate && cl.length) {
     $c_obj(make_doclist(doc.doctype, doc.name), 'get_adj_percent', '',
       function(r, rt) {
         refresh_field(fname);
@@ -92,8 +91,6 @@
 }
 
 
-// ******************* CONVERSION RATE ***************************
-cur_frm.cscript.conversion_rate = function(doc, cdt, cdn) { cur_frm.cscript.recalc(doc, 3);/*cur_frm.cscript.price_list_name(doc, cdt, cdn);*/ }
 
 // ******************** ITEM CODE ******************************** 
 cur_frm.fields_dict[cur_frm.cscript.fname].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
@@ -104,7 +101,6 @@
 }
 
 
-
 cur_frm.cscript.item_code = function(doc, cdt, cdn) {
   var fname = cur_frm.cscript.fname;
   var d = locals[cdt][cdn];
@@ -125,6 +121,7 @@
   }
 }
 
+
 // *********************** QUANTITY ***************************
 cur_frm.cscript.qty = function(doc, cdt, cdn) { cur_frm.cscript.recalc(doc, 1); }
   
@@ -154,6 +151,8 @@
 // ************************ EXPORT RATE *************************
 cur_frm.cscript.export_rate = function(doc,cdt,cdn) { cur_frm.cscript.recalc(doc, 3);}
 
+
+
 // ************* GET OTHER CHARGES BASED ON COMPANY *************
 cur_frm.fields_dict.charge.get_query = function(doc) {
   return 'SELECT DISTINCT `tabOther Charges`.name FROM `tabOther Charges` WHERE `tabOther Charges`.company = "'+doc.company+'" AND `tabOther Charges`.company is not NULL AND `tabOther Charges`.docstatus != 2 AND `tabOther Charges`.%(key)s LIKE "%s" ORDER BY `tabOther Charges`.name LIMIT 50';
@@ -176,6 +175,7 @@
   var other_fname  = cur_frm.cscript.other_fname;
   
   if(!flt(doc.conversion_rate)) { doc.conversion_rate = 1; refresh_field('conversion_rate'); }
+  if(!flt(doc.plc_conversion_rate)) { doc.plc_conversion_rate = 1; refresh_field('plc_conversion_rate'); }
 
   if(n > 0) cur_frm.cscript.update_fname_table(doc , tname , fname , n); // updates all values in table (i.e. amount, export amount, net total etc.)
   
@@ -367,7 +367,7 @@
       set_multiple(tname, cl[i].name, {'basic_rate': flt(flt(cl[i].export_rate) * flt(doc.conversion_rate))}, fname);
       set_multiple(tname, cl[i].name, {'amount' : flt(flt(cl[i].basic_rate) * flt(cl[i].qty)), 'export_amount': flt(flt(cl[i].export_rate) * flt(cl[i].qty))}, fname);
       if(cl[i].ref_rate > 0)
-        set_multiple(tname, cl[i].name, {'adj_rate': 100 - flt(flt(cl[i].export_rate) * 100 / flt(cl[i].ref_rate)), 'base_ref_rate': flt(flt(cl[i].ref_rate) * flt(doc.conversion_rate)) }, fname);
+		set_multiple(tname, cl[i].name, {'adj_rate': 100 - flt(flt(cl[i].export_rate) * 100 / flt(cl[i].ref_rate)), 'base_ref_rate': flt(flt(cl[i].ref_rate) * flt(doc.conversion_rate)) }, fname);
     }
     net_total += flt(flt(cl[i].qty) * flt(cl[i].basic_rate));
   }
diff --git a/erpnext/selling/doctype/sales_common/sales_common.py b/erpnext/selling/doctype/sales_common/sales_common.py
index 78454ee..ea9ffe9 100644
--- a/erpnext/selling/doctype/sales_common/sales_common.py
+++ b/erpnext/selling/doctype/sales_common/sales_common.py
@@ -135,32 +135,31 @@
 			'batch_no'				: ''
 		}
 		if(obj.doc.price_list_name and item):	#this is done to fetch the changed BASIC RATE and REF RATE based on PRICE LIST
-			ref_rate =	self.get_ref_rate(item_code, obj.doc.price_list_name, obj.doc.currency)
-			ret['ref_rate'] = flt(ref_rate)
-			ret['export_rate'] = flt(ref_rate)
-			ret['base_ref_rate'] = flt(ref_rate) * flt(obj.doc.conversion_rate)
-			ret['basic_rate'] = flt(ref_rate) * flt(obj.doc.conversion_rate)
-			
-		if obj.doc.doctype == 'Receivable Voucher':
-			return ret
-			
+			base_ref_rate =	self.get_ref_rate(item_code, obj.doc.price_list_name, obj.doc.price_list_currency, obj.doc.plc_conversion_rate)
+			ret['ref_rate'] = flt(base_ref_rate)/flt(obj.doc.conversion_rate)
+			ret['export_rate'] = flt(base_ref_rate)/flt(obj.doc.conversion_rate)
+			ret['base_ref_rate'] = flt(base_ref_rate)
+			ret['basic_rate'] = flt(base_ref_rate)
+
 		return ret
 	
 	# ***************** Get Ref rate as entered in Item Master ********************
-	def get_ref_rate(self, item_code, price_list_name, currency):
-		ref_rate = sql("select ref_rate from `tabRef Rate Detail` where parent = %s and price_list_name = %s and ref_currency = %s", (item_code, price_list_name, currency))
-		return ref_rate and ref_rate[0][0] or 0
+	def get_ref_rate(self, item_code, price_list_name, price_list_currency, plc_conv_rate):
+		ref_rate = sql("select ref_rate from `tabRef Rate Detail` where parent = %s and price_list_name = %s and ref_currency = %s", (item_code, price_list_name, price_list_currency))
+		base_ref_rate = ref_rate and flt(ref_rate[0][0]) * flt(plc_conv_rate) or 0
+		return base_ref_rate
 
 		
-	# ****** Re-calculates Basic Rate & amount based on Price List Selected ******
+	# ****** Re-cancellculates Basic Rate & amount based on Price List Selected ******
 	def get_adj_percent(self, obj): 
 		for d in getlist(obj.doclist, obj.fname):
-			ref_rate = self.get_ref_rate(d.item_code,obj.doc.price_list_name,obj.doc.currency)
+			base_ref_rate = self.get_ref_rate(d.item_code, obj.doc.price_list_name, obj.doc.price_list_currency, obj.doc.plc_conversion_rate)
 			d.adj_rate = 0
-			d.ref_rate = flt(ref_rate)
-			d.basic_rate = flt(ref_rate) * flt(obj.doc.conversion_rate)
-			d.base_ref_rate = flt(ref_rate) * flt(obj.doc.conversion_rate)
-			d.export_rate = flt(ref_rate)
+			d.ref_rate = flt(base_ref_rate)/flt(obj.doc.conversion_rate)
+			d.basic_rate = flt(base_ref_rate)
+			d.base_ref_rate = flt(base_ref_rate)
+			d.export_rate = flt(base_ref_rate)/flt(obj.doc.conversion_rate)
+
 
 	# Load Default Taxes
 	# ====================
@@ -268,9 +267,12 @@
 			msgprint('Message: Please enter default currency in Company Master')
 			raise Exception		
 		if (obj.doc.currency == default_currency and flt(obj.doc.conversion_rate) != 1.00) or not obj.doc.conversion_rate or (obj.doc.currency != default_currency and flt(obj.doc.conversion_rate) == 1.00):
-			msgprint("Please Enter Appropriate Conversion Rate.")
-			raise Exception
+			msgprint("Please Enter Appropriate Conversion Rate for Customer's Currency to Base Currency (%s --> %s)" % (obj.doc.currency, default_currency), raise_exception = 1)
 	
+		if (obj.doc.price_list_currency == default_currency and flt(obj.doc.plc_conversion_rate) != 1.00) or not obj.doc.plc_conversion_rate or (obj.doc.price_list_currency != default_currency and flt(obj.doc.plc_conversion_rate) == 1.00):
+			msgprint("Please Enter Appropriate Conversion Rate for Price List Currency to Base Currency ( (%s --> %s)" % (obj.doc.price_list_currency, default_currency), raise_exception = 1)
+	
+
 
 	# Get Tax rate if account type is TAX
 	# =========================================================================
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index e684bed..949abcd 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -16,6 +16,7 @@
 cur_frm.cscript.onload = function(doc, cdt, cdn) {
   if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
   if(!doc.transaction_date) set_multiple(cdt,cdn,{transaction_date:get_today()});
+  if(!doc.price_list_currency) set_multiple(cdt, cdn, {price_list_currency: doc.currency, plc_conversion_rate: 1});
   // load default charges
   
   if(doc.__islocal){
diff --git a/erpnext/selling/doctype/sales_order/sales_order.txt b/erpnext/selling/doctype/sales_order/sales_order.txt
index 98833d1..d59f236 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.txt
+++ b/erpnext/selling/doctype/sales_order/sales_order.txt
@@ -5,15 +5,17 @@
 	{
 		'creation': '2010-08-08 17:09:21',
 		'docstatus': 0,
-		'modified': '2011-08-09 17:06:09',
+		'modified': '2011-12-20 12:55:02',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1311621379',
+		'_last_update': '1324295218',
+		'allow_attach': 0,
 		'colour': 'White:FFF',
+		'default_print_format': 'Standard',
 		'doctype': 'DocType',
 		'document_type': 'Transaction',
 		'is_transaction_doc': 1,
@@ -27,7 +29,7 @@
 		'show_in_menu': 0,
 		'subject': 'From %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s | %(per_delivered)s% delivered | %(per_billed)s% billed',
 		'tag_fields': 'delivery_status,billing_status',
-		'version': 597
+		'version': 608
 	},
 
 	# These values are common for all DocField
@@ -58,7 +60,6 @@
 	# DocPerm
 	{
 		'doctype': 'DocPerm',
-		'idx': 1,
 		'permlevel': 0,
 		'role': 'Production Manager'
 	},
@@ -69,7 +70,6 @@
 		'cancel': 0,
 		'create': 0,
 		'doctype': 'DocPerm',
-		'idx': 2,
 		'permlevel': 1,
 		'role': 'Sales Manager',
 		'submit': 0,
@@ -82,7 +82,6 @@
 		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 3,
 		'permlevel': 0,
 		'role': 'Sales Manager',
 		'submit': 1,
@@ -95,7 +94,6 @@
 		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 4,
 		'permlevel': 0,
 		'role': 'Sales User',
 		'submit': 1,
@@ -108,7 +106,6 @@
 		'cancel': 0,
 		'create': 0,
 		'doctype': 'DocPerm',
-		'idx': 5,
 		'permlevel': 1,
 		'role': 'Sales User',
 		'submit': 0,
@@ -118,7 +115,6 @@
 	# DocPerm
 	{
 		'doctype': 'DocPerm',
-		'idx': 6,
 		'match': 'customer_name',
 		'permlevel': 0,
 		'role': 'Customer'
@@ -127,7 +123,6 @@
 	# DocPerm
 	{
 		'doctype': 'DocPerm',
-		'idx': 7,
 		'permlevel': 2,
 		'role': 'Accounts User',
 		'write': 1
@@ -139,7 +134,6 @@
 		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 8,
 		'permlevel': 0,
 		'role': 'Maintenance Manager',
 		'submit': 1,
@@ -149,7 +143,6 @@
 	# DocPerm
 	{
 		'doctype': 'DocPerm',
-		'idx': 9,
 		'permlevel': 1,
 		'role': 'Maintenance Manager'
 	},
@@ -160,7 +153,6 @@
 		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 10,
 		'permlevel': 0,
 		'role': 'Maintenance User',
 		'submit': 1,
@@ -170,7 +162,6 @@
 	# DocPerm
 	{
 		'doctype': 'DocPerm',
-		'idx': 11,
 		'permlevel': 1,
 		'role': 'Maintenance User'
 	},
@@ -180,7 +171,6 @@
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 1,
 		'label': 'Basic Info',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0,
@@ -191,7 +181,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 2,
 		'in_filter': 0,
 		'oldfieldtype': 'Column Break',
 		'permlevel': 0,
@@ -206,7 +195,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'naming_series',
 		'fieldtype': 'Select',
-		'idx': 3,
 		'label': 'Series',
 		'no_copy': 1,
 		'oldfieldname': 'naming_series',
@@ -224,7 +212,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'customer',
 		'fieldtype': 'Link',
-		'idx': 4,
 		'in_filter': 1,
 		'label': 'Customer',
 		'oldfieldname': 'customer',
@@ -243,7 +230,6 @@
 		'fieldname': 'customer_address',
 		'fieldtype': 'Link',
 		'hidden': 0,
-		'idx': 5,
 		'in_filter': 1,
 		'label': 'Customer Address',
 		'options': 'Address',
@@ -256,7 +242,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'contact_person',
 		'fieldtype': 'Link',
-		'idx': 6,
 		'in_filter': 1,
 		'label': 'Contact Person',
 		'options': 'Contact',
@@ -269,7 +254,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'customer_name',
 		'fieldtype': 'Data',
-		'idx': 7,
 		'label': 'Name',
 		'permlevel': 1
 	},
@@ -279,7 +263,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'address_display',
 		'fieldtype': 'Small Text',
-		'idx': 8,
 		'label': 'Address',
 		'permlevel': 1
 	},
@@ -289,7 +272,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'contact_display',
 		'fieldtype': 'Small Text',
-		'idx': 9,
 		'label': 'Contact',
 		'permlevel': 1
 	},
@@ -299,7 +281,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'contact_mobile',
 		'fieldtype': 'Text',
-		'idx': 10,
 		'label': 'Mobile No',
 		'permlevel': 1
 	},
@@ -309,7 +290,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'contact_email',
 		'fieldtype': 'Text',
-		'idx': 11,
 		'label': 'Contact Email',
 		'permlevel': 1,
 		'print_hide': 1
@@ -320,7 +300,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'territory',
 		'fieldtype': 'Link',
-		'idx': 12,
 		'in_filter': 1,
 		'label': 'Territory',
 		'options': 'Territory',
@@ -336,7 +315,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'customer_group',
 		'fieldtype': 'Link',
-		'idx': 13,
 		'in_filter': 1,
 		'label': 'Customer Group',
 		'options': 'Customer Group',
@@ -354,7 +332,6 @@
 		'fieldname': 'po_no',
 		'fieldtype': 'Data',
 		'hidden': 0,
-		'idx': 14,
 		'label': 'P.O. No',
 		'oldfieldname': 'po_no',
 		'oldfieldtype': 'Data',
@@ -370,7 +347,6 @@
 		'fieldname': 'po_date',
 		'fieldtype': 'Date',
 		'hidden': 0,
-		'idx': 15,
 		'label': 'P.O. Date',
 		'oldfieldname': 'po_date',
 		'oldfieldtype': 'Date',
@@ -384,7 +360,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 16,
 		'oldfieldtype': 'Column Break',
 		'permlevel': 0,
 		'width': '50%'
@@ -397,7 +372,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'transaction_date',
 		'fieldtype': 'Date',
-		'idx': 17,
 		'in_filter': 1,
 		'label': 'Sales Order Date',
 		'no_copy': 1,
@@ -416,7 +390,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'order_type',
 		'fieldtype': 'Select',
-		'idx': 18,
 		'label': 'Order Type',
 		'oldfieldname': 'order_type',
 		'oldfieldtype': 'Select',
@@ -431,7 +404,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'status',
 		'fieldtype': 'Select',
-		'idx': 19,
 		'in_filter': 1,
 		'label': 'Status',
 		'no_copy': 1,
@@ -452,7 +424,6 @@
 		'fieldname': 'delivery_date',
 		'fieldtype': 'Date',
 		'hidden': 0,
-		'idx': 20,
 		'in_filter': 1,
 		'label': 'Expected Delivery Date',
 		'oldfieldname': 'delivery_date',
@@ -471,7 +442,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'project_name',
 		'fieldtype': 'Link',
-		'idx': 21,
 		'in_filter': 1,
 		'label': 'Project Name',
 		'oldfieldname': 'project_name',
@@ -490,7 +460,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'per_delivered',
 		'fieldtype': 'Currency',
-		'idx': 22,
 		'in_filter': 1,
 		'label': '%  Delivered',
 		'no_copy': 1,
@@ -509,7 +478,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'per_billed',
 		'fieldtype': 'Currency',
-		'idx': 23,
 		'in_filter': 1,
 		'label': '% Amount Billed',
 		'no_copy': 1,
@@ -526,7 +494,6 @@
 		'fieldname': 'amended_from',
 		'fieldtype': 'Data',
 		'hidden': 1,
-		'idx': 24,
 		'label': 'Amended From',
 		'no_copy': 1,
 		'oldfieldname': 'amended_from',
@@ -544,7 +511,6 @@
 		'fieldname': 'amendment_date',
 		'fieldtype': 'Date',
 		'hidden': 1,
-		'idx': 25,
 		'label': 'Amendment Date',
 		'no_copy': 1,
 		'oldfieldname': 'amendment_date',
@@ -560,7 +526,6 @@
 		'fieldname': 'shipping_address_name',
 		'fieldtype': 'Data',
 		'hidden': 1,
-		'idx': 26,
 		'in_filter': 1,
 		'label': 'Shipping Address Name',
 		'options': 'Address',
@@ -573,7 +538,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'shipping_address',
 		'fieldtype': 'Small Text',
-		'idx': 27,
 		'in_filter': 0,
 		'label': 'Shipping Address',
 		'permlevel': 1,
@@ -585,7 +549,6 @@
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 28,
 		'label': 'Items',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0
@@ -594,72 +557,10 @@
 	# DocField
 	{
 		'colour': 'White:FFF',
-		'description': 'Quotation no against which this Sales Order is made ',
-		'doctype': 'DocField',
-		'fieldname': 'quotation_no',
-		'fieldtype': 'Link',
-		'idx': 29,
-		'in_filter': 1,
-		'label': 'Quotation No',
-		'no_copy': 0,
-		'oldfieldname': 'quotation_no',
-		'oldfieldtype': 'Link',
-		'options': 'Quotation',
-		'permlevel': 0,
-		'print_hide': 1,
-		'search_index': 1,
-		'trigger': 'Client',
-		'width': '150px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'vehicle_detail',
-		'fieldtype': 'Small Text',
-		'idx': 30,
-		'label': 'Vehicle Detail',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'quotation_date',
-		'fieldtype': 'Date',
-		'hidden': 1,
-		'idx': 31,
-		'label': 'Quotation Date',
-		'no_copy': 0,
-		'oldfieldname': 'quotation_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 1,
-		'print_hide': 1,
-		'reqd': 0,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 32,
-		'label': 'Pull Quotation Details',
-		'oldfieldtype': 'Button',
-		'options': 'pull_quotation_details',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
 		'description': 'Select the price list as entered in "Price List" master. This will pull the reference rates of items against this price list as specified in "Item" master.',
 		'doctype': 'DocField',
 		'fieldname': 'price_list_name',
 		'fieldtype': 'Select',
-		'idx': 33,
 		'label': 'Price List',
 		'oldfieldname': 'price_list_name',
 		'oldfieldtype': 'Select',
@@ -673,9 +574,32 @@
 
 	# DocField
 	{
+		'description': 'Select the currency in which price list is maintained',
+		'doctype': 'DocField',
+		'fieldname': 'price_list_currency',
+		'fieldtype': 'Select',
+		'label': 'Price List Currency',
+		'options': 'link:Currency',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'description': 'Rate at which Price list currency is converted to your currency',
+		'doctype': 'DocField',
+		'fieldname': 'plc_conversion_rate',
+		'fieldtype': 'Currency',
+		'label': 'Price List Currency Conversion Rate',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 34,
 		'permlevel': 0,
 		'width': '50%'
 	},
@@ -687,8 +611,7 @@
 		'doctype': 'DocField',
 		'fieldname': 'currency',
 		'fieldtype': 'Select',
-		'idx': 35,
-		'label': 'Currency',
+		'label': "Customer's Currency",
 		'oldfieldname': 'currency',
 		'oldfieldtype': 'Select',
 		'options': 'link:Currency',
@@ -706,7 +629,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'conversion_rate',
 		'fieldtype': 'Currency',
-		'idx': 36,
 		'label': 'Conversion Rate',
 		'oldfieldname': 'conversion_rate',
 		'oldfieldtype': 'Currency',
@@ -719,9 +641,56 @@
 
 	# DocField
 	{
+		'colour': 'White:FFF',
+		'description': 'Quotation no against which this Sales Order is made ',
+		'doctype': 'DocField',
+		'fieldname': 'quotation_no',
+		'fieldtype': 'Link',
+		'in_filter': 1,
+		'label': 'Quotation No',
+		'no_copy': 0,
+		'oldfieldname': 'quotation_no',
+		'oldfieldtype': 'Link',
+		'options': 'Quotation',
+		'permlevel': 0,
+		'print_hide': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': '150px'
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'doctype': 'DocField',
+		'fieldname': 'quotation_date',
+		'fieldtype': 'Date',
+		'hidden': 1,
+		'label': 'Quotation Date',
+		'no_copy': 0,
+		'oldfieldname': 'quotation_date',
+		'oldfieldtype': 'Date',
+		'permlevel': 1,
+		'print_hide': 1,
+		'reqd': 0,
+		'width': '100px'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldtype': 'Button',
+		'label': 'Pull Quotation Details',
+		'oldfieldtype': 'Button',
+		'options': 'pull_quotation_details',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 37,
 		'permlevel': 0
 	},
 
@@ -732,7 +701,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'sales_order_details',
 		'fieldtype': 'Table',
-		'idx': 38,
 		'label': 'Sales Order Details',
 		'oldfieldname': 'sales_order_details',
 		'oldfieldtype': 'Table',
@@ -746,7 +714,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Button',
-		'idx': 39,
 		'label': 'Clear Table',
 		'oldfieldtype': 'Button',
 		'options': 'clear_sales_order_details',
@@ -758,7 +725,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Button',
-		'idx': 40,
 		'label': 'Re-Calculate Values',
 		'oldfieldtype': 'Button',
 		'permlevel': 0,
@@ -772,7 +738,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'net_total',
 		'fieldtype': 'Currency',
-		'idx': 41,
 		'label': 'Net Total*',
 		'oldfieldname': 'net_total',
 		'oldfieldtype': 'Currency',
@@ -787,7 +752,6 @@
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldtype': 'HTML',
-		'idx': 42,
 		'label': 'Note1',
 		'oldfieldtype': 'HTML',
 		'options': '<b>NOTE :</b> * In Base Currency',
@@ -800,7 +764,6 @@
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 43,
 		'label': 'Taxes',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0,
@@ -812,7 +775,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'charge',
 		'fieldtype': 'Link',
-		'idx': 44,
 		'label': 'Select Charges Master',
 		'oldfieldname': 'charge',
 		'oldfieldtype': 'Link',
@@ -825,7 +787,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Button',
-		'idx': 45,
 		'label': 'Get Charges',
 		'oldfieldtype': 'Button',
 		'permlevel': 0,
@@ -837,7 +798,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'other_charges',
 		'fieldtype': 'Table',
-		'idx': 46,
 		'label': 'Other Charges',
 		'oldfieldname': 'other_charges',
 		'oldfieldtype': 'Table',
@@ -849,7 +809,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Button',
-		'idx': 47,
 		'label': 'Calculate Charges',
 		'oldfieldtype': 'Button',
 		'permlevel': 0,
@@ -862,7 +821,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'other_charges_total',
 		'fieldtype': 'Currency',
-		'idx': 48,
 		'label': 'Charges Total*',
 		'oldfieldname': 'other_charges_total',
 		'oldfieldtype': 'Currency',
@@ -876,7 +834,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'grand_total',
 		'fieldtype': 'Currency',
-		'idx': 49,
 		'label': 'Grand Total*',
 		'oldfieldname': 'grand_total',
 		'oldfieldtype': 'Currency',
@@ -890,7 +847,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'HTML',
-		'idx': 50,
 		'label': 'OT Notes',
 		'oldfieldtype': 'HTML',
 		'options': '<b>NOTE :</b> * In Base Currency',
@@ -902,7 +858,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'HTML',
-		'idx': 51,
 		'label': 'Other Charges Calculation',
 		'oldfieldtype': 'HTML',
 		'permlevel': 0,
@@ -914,7 +869,6 @@
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 52,
 		'label': 'Totals',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0,
@@ -926,7 +880,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'rounded_total',
 		'fieldtype': 'Currency',
-		'idx': 53,
 		'label': 'Rounded Total',
 		'oldfieldname': 'rounded_total',
 		'oldfieldtype': 'Currency',
@@ -942,7 +895,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'in_words',
 		'fieldtype': 'Data',
-		'idx': 54,
 		'label': 'In Words',
 		'oldfieldname': 'in_words',
 		'oldfieldtype': 'Data',
@@ -955,7 +907,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 55,
 		'oldfieldtype': 'Column Break',
 		'permlevel': 0,
 		'print_hide': 1,
@@ -967,7 +918,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'grand_total_export',
 		'fieldtype': 'Currency',
-		'idx': 56,
 		'label': 'Grand Total (Export)',
 		'oldfieldname': 'grand_total_export',
 		'oldfieldtype': 'Currency',
@@ -982,7 +932,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'rounded_total_export',
 		'fieldtype': 'Currency',
-		'idx': 57,
 		'label': 'Rounded Total (Export)',
 		'oldfieldname': 'rounded_total_export',
 		'oldfieldtype': 'Currency',
@@ -998,7 +947,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'in_words_export',
 		'fieldtype': 'Data',
-		'idx': 58,
 		'label': 'In Words (Export)',
 		'oldfieldname': 'in_words_export',
 		'oldfieldtype': 'Data',
@@ -1012,7 +960,6 @@
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 59,
 		'label': 'Terms',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0,
@@ -1024,7 +971,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'tc_name',
 		'fieldtype': 'Link',
-		'idx': 60,
 		'label': 'Select Terms',
 		'oldfieldname': 'tc_name',
 		'oldfieldtype': 'Link',
@@ -1038,7 +984,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Button',
-		'idx': 61,
 		'label': 'Get Terms',
 		'oldfieldtype': 'Button',
 		'options': 'get_tc_details',
@@ -1050,7 +995,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'HTML',
-		'idx': 62,
 		'label': 'Terms HTML',
 		'oldfieldtype': 'HTML',
 		'options': 'You can add Terms and Notes that will be printed in the Transaction',
@@ -1063,7 +1007,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'terms',
 		'fieldtype': 'Text Editor',
-		'idx': 63,
 		'label': 'Term Details',
 		'oldfieldname': 'terms',
 		'oldfieldtype': 'Text Editor',
@@ -1077,7 +1020,6 @@
 		'description': 'Filling in additional information about the Sales Order will help you analyze your data better.',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 64,
 		'label': 'More Info',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0,
@@ -1088,7 +1030,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 65,
 		'oldfieldtype': 'Column Break',
 		'permlevel': 0,
 		'print_hide': 1,
@@ -1101,7 +1042,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'letter_head',
 		'fieldtype': 'Select',
-		'idx': 66,
 		'label': 'Letter Head',
 		'oldfieldname': 'letter_head',
 		'oldfieldtype': 'Select',
@@ -1117,7 +1057,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'company',
 		'fieldtype': 'Link',
-		'idx': 67,
 		'in_filter': 1,
 		'label': 'Company',
 		'oldfieldname': 'company',
@@ -1136,7 +1075,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'fiscal_year',
 		'fieldtype': 'Select',
-		'idx': 68,
 		'in_filter': 1,
 		'label': 'Fiscal Year',
 		'oldfieldname': 'fiscal_year',
@@ -1156,7 +1094,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'select_print_heading',
 		'fieldtype': 'Link',
-		'idx': 69,
 		'label': 'Select Print Heading',
 		'no_copy': 1,
 		'oldfieldname': 'select_print_heading',
@@ -1171,7 +1108,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 70,
 		'oldfieldtype': 'Column Break',
 		'permlevel': 0,
 		'print_hide': 1,
@@ -1184,7 +1120,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'source',
 		'fieldtype': 'Select',
-		'idx': 71,
 		'label': 'Source',
 		'oldfieldname': 'source',
 		'oldfieldtype': 'Select',
@@ -1200,7 +1135,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'campaign',
 		'fieldtype': 'Link',
-		'idx': 72,
 		'label': 'Campaign',
 		'oldfieldname': 'campaign',
 		'oldfieldtype': 'Link',
@@ -1215,7 +1149,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'note',
 		'fieldtype': 'Text',
-		'idx': 73,
 		'label': 'Note',
 		'oldfieldname': 'note',
 		'oldfieldtype': 'Text',
@@ -1230,7 +1163,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'cancel_reason',
 		'fieldtype': 'Data',
-		'idx': 74,
 		'label': 'Cancel Reason',
 		'no_column': 0,
 		'no_copy': 1,
@@ -1246,7 +1178,6 @@
 		'fieldname': 'delivery_status',
 		'fieldtype': 'Select',
 		'hidden': 1,
-		'idx': 75,
 		'label': 'Delivery Status',
 		'no_column': 0,
 		'no_copy': 1,
@@ -1261,7 +1192,6 @@
 		'fieldname': 'billing_status',
 		'fieldtype': 'Select',
 		'hidden': 1,
-		'idx': 76,
 		'label': 'Billing Status',
 		'no_column': 0,
 		'no_copy': 1,
@@ -1277,7 +1207,6 @@
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
 		'hidden': 0,
-		'idx': 77,
 		'label': 'Packing List',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0,
@@ -1290,7 +1219,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'packing_details',
 		'fieldtype': 'Table',
-		'idx': 78,
 		'label': 'Packing Details',
 		'oldfieldname': 'packing_details',
 		'oldfieldtype': 'Table',
@@ -1303,7 +1231,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 79,
 		'label': 'Sales Team',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0,
@@ -1317,7 +1244,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'sales_partner',
 		'fieldtype': 'Link',
-		'idx': 80,
 		'in_filter': 1,
 		'label': 'Sales Partner',
 		'oldfieldname': 'sales_partner',
@@ -1335,7 +1261,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'commission_rate',
 		'fieldtype': 'Currency',
-		'idx': 81,
 		'label': 'Commission Rate',
 		'oldfieldname': 'commission_rate',
 		'oldfieldtype': 'Currency',
@@ -1350,7 +1275,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'total_commission',
 		'fieldtype': 'Currency',
-		'idx': 82,
 		'label': 'Total Commission',
 		'oldfieldname': 'total_commission',
 		'oldfieldtype': 'Currency',
@@ -1364,7 +1288,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'sales_team',
 		'fieldtype': 'Table',
-		'idx': 83,
 		'label': 'Sales Team1',
 		'oldfieldname': 'sales_team',
 		'oldfieldtype': 'Table',
@@ -1378,7 +1301,6 @@
 		'allow_on_submit': 1,
 		'doctype': 'DocField',
 		'fieldtype': 'Button',
-		'idx': 84,
 		'label': 'Repair Sales Order',
 		'oldfieldtype': 'Button',
 		'options': 'repair_sales_order',
diff --git a/erpnext/setup/doctype/manage_account/manage_account.py b/erpnext/setup/doctype/manage_account/manage_account.py
index 651794f..5dd2d06 100644
--- a/erpnext/setup/doctype/manage_account/manage_account.py
+++ b/erpnext/setup/doctype/manage_account/manage_account.py
@@ -43,6 +43,7 @@
                 ['company',self.doc.default_company],
                 ['currency',self.doc.default_currency],
                 ['price_list_name',self.doc.default_price_list],
+				['price_list_currency', self.doc.default_price_list_currency],
                 ['item_group',self.doc.default_item_group],
                 ['customer_group',self.doc.default_customer_group],
                 ['cust_master_name',self.doc.cust_master_name], 
diff --git a/erpnext/setup/doctype/manage_account/manage_account.txt b/erpnext/setup/doctype/manage_account/manage_account.txt
index 21306cf..c5bdc56 100644
--- a/erpnext/setup/doctype/manage_account/manage_account.txt
+++ b/erpnext/setup/doctype/manage_account/manage_account.txt
@@ -5,18 +5,19 @@
 	{
 		'creation': '2010-08-08 17:09:09',
 		'docstatus': 0,
-		'modified': '2011-12-14 15:08:22',
+		'modified': '2011-12-20 12:27:30',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1323855454',
+		'_last_update': '1323943888',
 		'allow_copy': 1,
 		'allow_email': 1,
 		'allow_print': 1,
 		'colour': 'White:FFF',
+		'default_print_format': 'Standard',
 		'doctype': 'DocType',
 		'hide_toolbar': 0,
 		'in_create': 1,
@@ -27,7 +28,7 @@
 		'section_style': 'Tabbed',
 		'server_code_error': ' ',
 		'show_in_menu': 1,
-		'version': 516
+		'version': 515
 	},
 
 	# These values are common for all DocField
@@ -315,20 +316,6 @@
 	# DocField
 	{
 		'doctype': 'DocField',
-		'fieldtype': 'Column Break'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'label': 'Acccount Info',
-		'options': '<div class="help-box">For more accounting defaults, Open <a href="#!List/Company">Company</a></div>'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
 		'label': 'Selling'
 	},
@@ -381,6 +368,13 @@
 	# DocField
 	{
 		'doctype': 'DocField',
+		'fieldtype': 'Column Break',
+		'width': '50%'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
 		'fieldname': 'default_price_list',
 		'fieldtype': 'Link',
 		'label': 'Default Price List',
@@ -390,8 +384,10 @@
 	# DocField
 	{
 		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'width': '50%'
+		'fieldname': 'default_price_list_currency',
+		'fieldtype': 'Link',
+		'label': 'Default Price List Currency',
+		'options': 'Currency'
 	},
 
 	# DocField
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index 823eca4..8f9fa6d 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -15,6 +15,7 @@
   if(!doc.transaction_date) set_multiple(dt,dn,{transaction_date:get_today()});
   if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
   if(doc.__islocal && doc.customer) cur_frm.cscript.pull_item_details_onload(doc,dt,dn);
+  if(!doc.price_list_currency) set_multiple(cdt, cdn, {price_list_currency: doc.currency, plc_conversion_rate: 1});
 
   if(!doc.posting_time) doc.posting_time = wn.datetime.get_cur_time()
     
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.txt b/erpnext/stock/doctype/delivery_note/delivery_note.txt
index 8109af5..dc905f5 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.txt
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.txt
@@ -5,7 +5,7 @@
 	{
 		'creation': '2011-04-18 15:58:20',
 		'docstatus': 0,
-		'modified': '2011-10-18 13:57:23',
+		'modified': '2011-12-20 13:23:33',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
@@ -21,7 +21,7 @@
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1318321312',
+		'_last_update': '1324367019',
 		'colour': 'White:FFF',
 		'default_print_format': 'Standard',
 		'doctype': 'DocType',
@@ -37,7 +37,7 @@
 		'show_in_menu': 0,
 		'subject': 'To %(customer_name)s on %(transaction_date)s | %(per_billed)s% billed',
 		'tag_fields': 'billing_status',
-		'version': 454
+		'version': 459
 	},
 
 	# These values are common for all DocFormat
@@ -130,7 +130,8 @@
 	{
 		'doctype': 'DocPerm',
 		'permlevel': 1,
-		'role': 'All'
+		'role': 'All',
+		'write': 0
 	},
 
 	# DocPerm
@@ -542,34 +543,6 @@
 	# DocField
 	{
 		'colour': 'White:FFF',
-		'description': 'You can make a delivery note from multiple sales orders. Select sales orders one by one and click on the button below.',
-		'doctype': 'DocField',
-		'fieldname': 'sales_order_no',
-		'fieldtype': 'Link',
-		'label': 'Sales Order No',
-		'no_copy': 0,
-		'oldfieldname': 'sales_order_no',
-		'oldfieldtype': 'Link',
-		'options': 'Sales Order',
-		'permlevel': 0,
-		'print_hide': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'hidden': 0,
-		'label': 'Get Items',
-		'oldfieldtype': 'Button',
-		'options': 'pull_sales_order_details',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
 		'description': 'Select the price list as entered in "Price List" master. This will pull the reference rates of items against this price list as specified in "Item" master.',
 		'doctype': 'DocField',
 		'fieldname': 'price_list_name',
@@ -586,6 +559,31 @@
 
 	# DocField
 	{
+		'colour': 'White:FFF',
+		'description': 'Select the currency in which price list is maintained',
+		'doctype': 'DocField',
+		'fieldname': 'price_list_currency',
+		'fieldtype': 'Select',
+		'label': 'Price List Currency',
+		'options': 'link:Currency',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'description': 'Rate at which Price list currency is converted to your currency',
+		'doctype': 'DocField',
+		'fieldname': 'plc_conversion_rate',
+		'fieldtype': 'Currency',
+		'label': 'Price List Currency Conversion Rate',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
 		'permlevel': 0,
@@ -627,6 +625,34 @@
 
 	# DocField
 	{
+		'colour': 'White:FFF',
+		'description': 'You can make a delivery note from multiple sales orders. Select sales orders one by one and click on the button below.',
+		'doctype': 'DocField',
+		'fieldname': 'sales_order_no',
+		'fieldtype': 'Link',
+		'label': 'Sales Order No',
+		'no_copy': 0,
+		'oldfieldname': 'sales_order_no',
+		'oldfieldtype': 'Link',
+		'options': 'Sales Order',
+		'permlevel': 0,
+		'print_hide': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldtype': 'Button',
+		'hidden': 0,
+		'label': 'Get Items',
+		'oldfieldtype': 'Button',
+		'options': 'pull_sales_order_details',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
 		'permlevel': 0
diff --git a/erpnext/utilities/doctype/contact/contact.txt b/erpnext/utilities/doctype/contact/contact.txt
index 43fa4d7..e5a6757 100644
--- a/erpnext/utilities/doctype/contact/contact.txt
+++ b/erpnext/utilities/doctype/contact/contact.txt
@@ -5,16 +5,17 @@
 	{
 		'creation': '2010-08-08 17:08:55',
 		'docstatus': 0,
-		'modified': '2011-05-26 11:00:36',
+		'modified': '2011-12-19 14:11:08',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1306307671',
+		'_last_update': '1316075905',
 		'allow_trash': 1,
 		'colour': 'White:FFF',
+		'default_print_format': 'Standard',
 		'doctype': 'DocType',
 		'document_type': 'Master',
 		'in_create': 0,
@@ -25,7 +26,7 @@
 		'server_code_error': ' ',
 		'show_in_menu': 0,
 		'subject': '%(first_name)s %(last_name)s - Email: %(email_id)s | Contact: %(phone)s | Mobile: %(mobile_no)s',
-		'version': 242
+		'version': 243
 	},
 
 	# These values are common for all DocField
@@ -56,7 +57,6 @@
 	# DocPerm
 	{
 		'doctype': 'DocPerm',
-		'idx': 1,
 		'permlevel': 0,
 		'role': 'Sales User'
 	},
@@ -64,7 +64,6 @@
 	# DocPerm
 	{
 		'doctype': 'DocPerm',
-		'idx': 2,
 		'permlevel': 0,
 		'role': 'Purchase User'
 	},
@@ -75,7 +74,6 @@
 		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 3,
 		'permlevel': 0,
 		'role': 'Sales Master Manager',
 		'submit': 0,
@@ -85,7 +83,6 @@
 	# DocPerm
 	{
 		'doctype': 'DocPerm',
-		'idx': 4,
 		'permlevel': 1,
 		'role': 'All',
 		'write': 1
@@ -94,7 +91,6 @@
 	# DocPerm
 	{
 		'doctype': 'DocPerm',
-		'idx': 5,
 		'permlevel': 2,
 		'role': 'All'
 	},
@@ -104,7 +100,6 @@
 		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 6,
 		'permlevel': 0,
 		'role': 'Purchase Master Manager',
 		'write': 1
@@ -115,7 +110,6 @@
 		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 7,
 		'permlevel': 0,
 		'role': 'System Manager',
 		'write': 1
@@ -126,7 +120,6 @@
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 1,
 		'label': 'Contact Details',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0
@@ -136,7 +129,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 2,
 		'oldfieldtype': 'Column Break',
 		'permlevel': 0,
 		'width': '50%'
@@ -147,7 +139,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'first_name',
 		'fieldtype': 'Data',
-		'idx': 3,
 		'label': 'First Name',
 		'oldfieldname': 'first_name',
 		'oldfieldtype': 'Data',
@@ -160,7 +151,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'last_name',
 		'fieldtype': 'Data',
-		'idx': 4,
 		'label': 'Last Name',
 		'oldfieldname': 'last_name',
 		'oldfieldtype': 'Data',
@@ -174,7 +164,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'customer',
 		'fieldtype': 'Link',
-		'idx': 5,
 		'label': 'Customer',
 		'oldfieldname': 'customer',
 		'oldfieldtype': 'Link',
@@ -191,7 +180,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'customer_name',
 		'fieldtype': 'Data',
-		'idx': 6,
 		'label': 'Customer Name',
 		'permlevel': 1
 	},
@@ -203,7 +191,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'supplier',
 		'fieldtype': 'Link',
-		'idx': 7,
 		'label': 'Supplier',
 		'options': 'Supplier',
 		'permlevel': 0,
@@ -218,7 +205,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'supplier_name',
 		'fieldtype': 'Data',
-		'idx': 8,
 		'label': 'Supplier Name',
 		'permlevel': 1
 	},
@@ -230,7 +216,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'sales_partner',
 		'fieldtype': 'Link',
-		'idx': 9,
 		'label': 'Sales Partner',
 		'options': 'Sales Partner',
 		'permlevel': 0
@@ -244,7 +229,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'is_primary_contact',
 		'fieldtype': 'Check',
-		'idx': 10,
 		'label': 'Is Primary Contact',
 		'oldfieldname': 'is_primary_contact',
 		'oldfieldtype': 'Select',
@@ -255,7 +239,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 11,
 		'oldfieldtype': 'Column Break',
 		'permlevel': 0,
 		'width': '50%'
@@ -266,7 +249,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'email_id',
 		'fieldtype': 'Data',
-		'idx': 12,
 		'label': 'Email Id',
 		'oldfieldname': 'email_id',
 		'oldfieldtype': 'Data',
@@ -279,7 +261,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'phone',
 		'fieldtype': 'Data',
-		'idx': 13,
 		'label': 'Phone',
 		'oldfieldname': 'contact_no',
 		'oldfieldtype': 'Data',
@@ -292,7 +273,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'mobile_no',
 		'fieldtype': 'Data',
-		'idx': 14,
 		'label': 'Mobile No',
 		'oldfieldname': 'mobile_no',
 		'oldfieldtype': 'Data',
@@ -306,7 +286,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'department',
 		'fieldtype': 'Data',
-		'idx': 15,
 		'label': 'Department',
 		'options': 'Suggest',
 		'permlevel': 0
@@ -319,7 +298,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'designation',
 		'fieldtype': 'Data',
-		'idx': 16,
 		'label': 'Designation',
 		'options': 'Suggest',
 		'permlevel': 0
@@ -330,7 +308,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'trash_reason',
 		'fieldtype': 'Small Text',
-		'idx': 17,
 		'label': 'Trash Reason',
 		'oldfieldname': 'trash_reason',
 		'oldfieldtype': 'Small Text',