Default Currency specification for Customer and Supplier
This will get fetched in sales and purchase transactions respectively.
Fix in sales order list view
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index c9b4720..c6f9e97 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -90,8 +90,15 @@
 		cur_frm.cscript.calc_amount(doc, 1);
 	}
 
-	if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1,callback);
-	if(doc.supplier) unhide_field(['supplier_address','contact_person']);
+	if (doc.supplier) {
+		get_server_fields('get_default_supplier_address',
+			JSON.stringify({ supplier: doc.supplier }),'', doc, dt, dn, 1, function(doc, dt, dn) {
+				cur_frm.refresh();
+				callback(doc, dt, dn);
+			});
+		unhide_field(['supplier_address','contact_person']);
+	}
+
 }
 
 cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
@@ -113,14 +120,19 @@
 
 cur_frm.cscript.credit_to = function(doc,dt,dn) {
 
-	var callback = function(r,rt) {
-			var doc = locals[cur_frm.doctype][cur_frm.docname];		
-			if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1);
-			if(doc.supplier) unhide_field(['supplier_address','contact_person']);
+	var callback = function(doc, dt, dn) {
+			var doc = locals[doc.doctype][doc.name];
+			if(doc.supplier) {
+				get_server_fields('get_default_supplier_address',
+					JSON.stringify({ supplier: doc.supplier }), '', doc, dt, dn, 1, function() {
+						cur_frm.refresh();
+					});
+				unhide_field(['supplier_address','contact_person']);
+			}
 			cur_frm.refresh();
 	}
 
-	get_server_fields('get_cust','','',doc,dt,dn,1,callback);	
+	get_server_fields('get_cust', '', '', doc, dt, dn, 1, callback);
 }
 
 
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js
index 0ca29d7..82a9953 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.js
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.js
@@ -65,9 +65,6 @@
 	}
 }
 
-
-
-
 var set_dynamic_label_par = function(doc, cdt, cdn, base_curr) {
 	//parent flds
 	par_cols_base = {'net_total': 'Net Total', 'total_tax': 'Total Tax', 'grand_total':	'Grand Total', /*'rounded_total': 'Rounded Total',*/
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index c3c3a38..9d50020 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -68,12 +68,15 @@
 	else $(cur_frm.fields_dict.contact_section.row.wrapper).toggle(false);
 }
 
-
-
 //Supplier
 cur_frm.cscript.supplier = function(doc,dt,dn) {
-	if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1);
-	if(doc.supplier) $(cur_frm.fields_dict.contact_section.row.wrapper).toggle(true);
+	if (doc.supplier) {
+		get_server_fields('get_default_supplier_address',
+			JSON.stringify({ supplier: doc.supplier }),'', doc, dt, dn, 1, function() {
+				cur_frm.refresh();
+			});
+		$(cur_frm.fields_dict.contact_section.row.wrapper).toggle(true);
+	}
 }
 
 cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {		
diff --git a/erpnext/buying/doctype/supplier/supplier.txt b/erpnext/buying/doctype/supplier/supplier.txt
index 938633a..62c1f5c 100644
--- a/erpnext/buying/doctype/supplier/supplier.txt
+++ b/erpnext/buying/doctype/supplier/supplier.txt
@@ -5,7 +5,7 @@
 	{
 		'creation': '2012-05-15 12:14:41',
 		'docstatus': 0,
-		'modified': '2012-05-31 13:18:29',
+		'modified': '2012-07-18 17:41:49',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -266,6 +266,19 @@
 	# DocField
 	{
 		'colour': u'White:FFF',
+		'description': u'This currency will get fetched in Purchase transactions of this supplier',
+		'doctype': u'DocField',
+		'fieldname': u'default_currency',
+		'fieldtype': u'Select',
+		'label': u'Default Currency',
+		'no_copy': 1,
+		'options': u'link:Currency',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
 		'description': u'Statutory info and other general information about your Supplier',
 		'doctype': u'DocField',
 		'fieldname': u'supplier_details',
diff --git a/erpnext/selling/doctype/customer/customer.txt b/erpnext/selling/doctype/customer/customer.txt
index e8f03d0..121fa32 100644
--- a/erpnext/selling/doctype/customer/customer.txt
+++ b/erpnext/selling/doctype/customer/customer.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-05-15 12:14:51',
+		'creation': '2012-07-18 16:07:05',
 		'docstatus': 0,
-		'modified': '2012-05-31 11:41:06',
+		'modified': '2012-07-18 17:11:25',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -371,6 +371,19 @@
 	# DocField
 	{
 		'colour': u'White:FFF',
+		'description': u'This currency will get fetched in Sales transactions of this customer',
+		'doctype': u'DocField',
+		'fieldname': u'default_currency',
+		'fieldtype': u'Select',
+		'label': u'Default Currency',
+		'no_copy': 1,
+		'options': u'link:Currency',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
 		'description': u"Your Customer's TAX registration numbers (if applicable) or any general information",
 		'doctype': u'DocField',
 		'fieldname': u'customer_details',
diff --git a/erpnext/selling/doctype/sales_order/listview.js b/erpnext/selling/doctype/sales_order/listview.js
index 3fa63a5..c15944b 100644
--- a/erpnext/selling/doctype/sales_order/listview.js
+++ b/erpnext/selling/doctype/sales_order/listview.js
@@ -34,7 +34,7 @@
 
 				if (order_type === 'sales') {
 					me.render_icon(parent, 'icon-tag', data.order_type);
-					me.render_bar_graph(parent, data, 'per_billed', 'Delivered');
+					me.render_bar_graph(parent, data, 'per_delivered', 'Delivered');
 				} else if (order_type === 'maintenance') {
 					me.render_icon(parent, 'icon-wrench', data.order_type);
 				}
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index 59c69f6..eb048ea 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -64,11 +64,15 @@
 	}
 }
 
-
 //Supplier
 cur_frm.cscript.supplier = function(doc,dt,dn) {
-	if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1);
-	if(doc.supplier) $(cur_frm.fields_dict.contact_section.row.wrapper).toggle(true);
+	if (doc.supplier) {
+		get_server_fields('get_default_supplier_address',
+			JSON.stringify({ supplier: doc.supplier }),'', doc, dt, dn, 1, function() {
+				cur_frm.refresh();
+			});
+		$(cur_frm.fields_dict.contact_section.row.wrapper).toggle(true);
+	}
 }
 
 cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {		
diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py
index 88ed823..3bc7821 100644
--- a/erpnext/utilities/transaction_base.py
+++ b/erpnext/utilities/transaction_base.py
@@ -116,22 +116,32 @@
 		contact_mobile = details and details[0]['mobile_no'] or ''
 		return contact_display, contact_name, contact_email, contact_mobile
 
-	# Get Customer Details
-	# -----------------------
-	def get_customer_details(self, name):		
-		customer_details = webnotes.conn.sql("select customer_name, customer_group, territory, default_sales_partner, default_commission_rate, default_price_list from tabCustomer where name = '%s' and docstatus != 2" %(name), as_dict = 1)
+	def get_customer_details(self, name):
+		"""
+			Get customer details like name, group, territory
+			and other such defaults
+		"""
+		customer_details = webnotes.conn.sql("""\
+			select
+				customer_name, customer_group, territory,
+				default_sales_partner, default_commission_rate, default_currency,
+				default_price_list
+			from `tabCustomer`
+			where name = %s and docstatus < 2""", name, as_dict=1)
 		if customer_details:
-			self.doc.customer_name = customer_details[0]['customer_name'] or ''
-			self.doc.customer_group = customer_details[0]['customer_group'] or ''
-			self.doc.territory = customer_details[0]['territory'] or ''
-			self.doc.sales_partner = customer_details[0]['default_sales_partner'] or ''
-			self.doc.commission_rate = customer_details[0]['default_commission_rate'] or ''
-			def_price_list = customer_details[0]['default_price_list'] or ''
-			if not def_price_list:
-				cg_price_list = webnotes.conn.sql("select default_price_list from `tabCustomer Group` where name = %s", customer_details[0]['customer_group'])
-				def_price_list = cg_price_list and cg_price_list[0][0] or ''
-			self.doc.price_list_name = def_price_list or self.doc.price_list_name
+			for f in ['customer_name', 'customer_group', 'territory']:
+				self.doc.fields[f] = customer_details[0][f] or self.doc.fields.get(f)
 			
+			# fields prepended with default in Customer doctype
+			for f in ['sales_partner', 'commission_rate', 'currency']:
+				self.doc.fields[f] = customer_details[0]["default_%s" % f] or self.doc.fields.get(f)
+			
+			# optionally fetch default price list from Customer Group
+			self.doc.price_list_name = (customer_details[0]['default_price_list']
+				or webnotes.conn.get_value('Customer Group', self.doc.customer_group,
+					'default_price_list')
+				or self.doc.fields.get('price_list_name'))
+
 	# Get Customer Shipping Address
 	# -----------------------
 	def get_shipping_address(self, name):
@@ -194,7 +204,7 @@
 		contact_text, contact_name, contact_email, contact_mobile = self.get_contact_text(contact_name=args['contact'])
 		ret = {
 			'supplier_address' : address_name,
-			'address_display' : address_text,			
+			'address_display' : address_text,
 			'contact_person' : contact_name,
 			'contact_display' : contact_text,
 			'contact_email' : contact_email,
@@ -204,12 +214,20 @@
 	
 	# Get Supplier Details
 	# -----------------------
-	def get_supplier_details(self, name):		
-		supplier_details = webnotes.conn.sql("select supplier_name from tabSupplier where name = '%s' and docstatus != 2" %(name), as_dict = 1)
-		ret = {
-			'supplier_name' : supplier_details and supplier_details[0]['supplier_name'] or ''
-		}
-		return ret
+	def get_supplier_details(self, name):
+		supplier_details = webnotes.conn.sql("""\
+			select supplier_name, default_currency
+			from `tabSupplier`
+			where name = %s and docstatus < 2""", name, as_dict=1)
+		if supplier_details:
+			return {
+				'supplier_name': (supplier_details[0]['supplier_name']
+					or self.doc.fields.get('supplier_name')),
+				'currency': (supplier_details[0]['default_currency']
+					or self.doc.fields.get('currency')),
+			}
+		else:
+			return {}
 		
 	# Get Sales Person Details of Customer
 	# ------------------------------------
diff --git a/public/js/all-app.js b/public/js/all-app.js
index 3f18585..6f96b3b 100644
--- a/public/js/all-app.js
+++ b/public/js/all-app.js
@@ -1711,7 +1711,7 @@
  */
 wn.provide('_f');_f.frms={};_f.Frm=function(doctype,parent,in_form){this.docname='';this.doctype=doctype;this.display=0;var me=this;this.is_editable={};this.opendocs={};this.sections=[];this.grids=[];this.cscript={};this.pformat={};this.fetch_dict={};this.parent=parent;this.tinymce_id_list=[];this.setup_meta(doctype);this.in_form=in_form?true:false;var me=this;$(document).bind('rename',function(event,dt,old_name,new_name){if(dt==me.doctype)
 me.rename_notify(dt,old_name,new_name)});}
-_f.Frm.prototype.check_doctype_conflict=function(docname){var me=this;if(this.doctype=='DocType'&&docname=='DocType'){msgprint('Allowing DocType, DocType. Be careful!')}else if(this.doctype=='DocType'){if(wn.views.formview[docname]){msgprint("Cannot open DocType when its instance is open")
+_f.Frm.prototype.check_doctype_conflict=function(docname){var me=this;if(this.doctype=='DocType'&&docname=='DocType'){msgprint('Allowing DocType, DocType. Be careful!')}else if(this.doctype=='DocType'){if(wn.views.formview[docname]||wn.pages['List/'+docname]){msgprint("Cannot open DocType when its instance is open")
 throw'doctype open conflict'}}else{if(wn.views.formview.DocType&&wn.views.formview.DocType.frm.opendocs[this.doctype]){msgprint("Cannot open instance when its DocType is open")
 throw'doctype open conflict'}}}
 _f.Frm.prototype.setup=function(){var me=this;this.fields=[];this.fields_dict={};this.wrapper=this.parent;this.setup_print_layout();this.saved_wrapper=$a(this.wrapper,'div');this.setup_std_layout();this.setup_client_script();this.setup_done=true;}
@@ -1772,7 +1772,8 @@
 return 1}
 _f.Frm.prototype.refresh=function(docname){if(docname){if(this.docname!=docname&&(!this.meta.in_dialog||this.in_form)&&!this.meta.istable)scroll(0,0);this.docname=docname;}
 if(!this.meta.istable){cur_frm=this;this.parent.cur_frm=this;}
-if(this.docname){if(!this.check_doc_perm())return;if(!this.setup_done)this.setup();this.runclientscript('set_perm',this.doctype,this.docname);this.doc=get_local(this.doctype,this.docname);cur_frm.cscript.is_onload=false;if(!this.opendocs[this.docname]){cur_frm.cscript.is_onload=true;this.setnewdoc(this.docname);}
+if(this.docname){if(!this.check_doc_perm())return;if(!this.opendocs[this.docname]){this.check_doctype_conflict(this.docname);}
+if(!this.setup_done)this.setup();this.runclientscript('set_perm',this.doctype,this.docname);this.doc=get_local(this.doctype,this.docname);cur_frm.cscript.is_onload=false;if(!this.opendocs[this.docname]){cur_frm.cscript.is_onload=true;this.setnewdoc(this.docname);}
 if(this.doc.__islocal)
 this.is_editable[this.docname]=1;this.editable=this.is_editable[this.docname];if(!this.doc.__archived&&(this.editable||(!this.editable&&this.meta.istable))){if(this.print_wrapper){$dh(this.print_wrapper);$ds(this.page_layout.wrapper);}
 if(!this.meta.istable){this.refresh_header();this.sidebar&&this.sidebar.refresh();}
@@ -1792,7 +1793,7 @@
 dep_dict[guardian]=[];dep_dict[guardian][dep_dict[guardian].length]=f;has_dep=true;}}
 if(!has_dep)return;for(var i=me.fields.length-1;i>=0;i--){var f=me.fields[i];f.guardian_has_value=true;if(f.df.depends_on){var v=doc[f.df.depends_on];if(f.df.depends_on.substr(0,5)=='eval:'){f.guardian_has_value=eval(f.df.depends_on.substr(5));}else if(f.df.depends_on.substr(0,3)=='fn:'){f.guardian_has_value=me.runclientscript(f.df.depends_on.substr(3),me.doctype,me.docname);}else{if(v||(v==0&&!v.substr)){}else{f.guardian_has_value=false;}}
 if(f.guardian_has_value){if(f.grid)f.grid.show();else $ds(f.wrapper);}else{if(f.grid)f.grid.hide();else $dh(f.wrapper);}}}}
-_f.Frm.prototype.setnewdoc=function(docname){this.check_doctype_conflict(docname);if(this.opendocs[docname]){this.docname=docname;return;}
+_f.Frm.prototype.setnewdoc=function(docname){if(this.opendocs[docname]){this.docname=docname;return;}
 Meta.make_local_dt(this.doctype,docname);this.docname=docname;var me=this;var viewname=docname;if(this.meta.issingle)viewname=this.doctype;this.runclientscript('onload',this.doctype,this.docname);this.is_editable[docname]=1;if(this.meta.read_only_onload)this.is_editable[docname]=0;this.opendocs[docname]=true;}
 _f.Frm.prototype.edit_doc=function(){this.is_editable[this.docname]=true;this.refresh();}
 _f.Frm.prototype.show_doc=function(dn){this.refresh(dn);}