Fixes in Tax Rule
diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.py b/erpnext/accounts/doctype/tax_rule/tax_rule.py
index 635bdc1..705a26e 100644
--- a/erpnext/accounts/doctype/tax_rule/tax_rule.py
+++ b/erpnext/accounts/doctype/tax_rule/tax_rule.py
@@ -85,13 +85,22 @@
 				frappe.throw(_("Tax Rule Conflicts with {0}".format(tax_rule[0].name)), ConflictingTaxRule)
 
 @frappe.whitelist()
-def get_party_details(party, party_type):
+def get_party_details(party, party_type, args=None):
 	out = {}
-	billing_address = frappe.get_list("Address", fields=["city", "country"], filters={party_type: party, "is_primary_address": 1})
-	shipping_address = frappe.get_list("Address", fields=["city", "country"], filters={party_type:party, "is_shipping_address": 1})
+	if args:
+		billing_filters=	{"name": args.get("billing_address")}
+		shipping_filters=	{"name": args.get("shipping_address")}
+	else:
+		billing_filters=	{party_type: party, "is_primary_address": 1}
+		shipping_filters=	{party_type:party, "is_shipping_address": 1}
+		
+	billing_address=	frappe.get_all("Address", fields=["city", "country"], filters= billing_filters)
+	shipping_address=	frappe.get_all("Address", fields=["city", "country"], filters= shipping_filters)
+	
 	if billing_address:
 		out["billing_city"]= billing_address[0].city
 		out["billing_country"]= billing_address[0].country
+
 	if shipping_address:
 		out["shipping_city"]= shipping_address[0].city
 		out["shipping_country"]= shipping_address[0].country
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index 313544f..a6b5c78 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -43,7 +43,7 @@
 	set_contact_details(out, party, party_type)
 	set_other_values(out, party, party_type)
 	set_price_list(out, party, party_type, price_list)
-	out["taxes_and_charges"] = set_taxes(party.name, party_type, posting_date, company, out)
+	out["taxes_and_charges"] = set_taxes(party.name, party_type, posting_date, company, out.customer_group, out.supplier_type)
 
 	if not out.get("currency"):
 		out["currency"] = currency
@@ -277,19 +277,23 @@
 			else:
 				frappe.throw(_("Due / Reference Date cannot be after {0}").format(formatdate(default_due_date)))
 				
-def set_taxes(party, party_type, posting_date, company, out):
-	print "posting_date", posting_date
+@frappe.whitelist()
+def set_taxes(party, party_type, posting_date, company, customer_group=None, supplier_type=None, billing_address=None, shipping_address=None):
 	from erpnext.accounts.doctype.tax_rule.tax_rule import get_tax_template, get_party_details
 	args = {
 		party_type: 		party,
-		"customer_group":	out.customer_group,
-		"supplier_type":	out.supplier_type,
+		"customer_group":	customer_group,
+		"supplier_type":	supplier_type,
 		"company":			company
 	}
-	args.update(get_party_details(party, party_type))
+	
+	if billing_address or shipping_address:
+		args.update(get_party_details(party, party_type, {"billing_address": billing_address, "shipping_address": shipping_address }))
+	else:
+		args.update(get_party_details(party, party_type))
+	
 	if party_type=="Customer":
 		args.update({"tax_type": "Sales"})
 	else:
 		args.update({"tax_type": "Purchase"})
-		
 	return get_tax_template(posting_date, args)
\ No newline at end of file
diff --git a/erpnext/public/js/utils/party.js b/erpnext/public/js/utils/party.js
index 59992eb..1a86b2b 100644
--- a/erpnext/public/js/utils/party.js
+++ b/erpnext/public/js/utils/party.js
@@ -43,6 +43,7 @@
 
 erpnext.utils.get_address_display = function(frm, address_field, display_field) {
 	if(frm.updating_party_details) return;
+	
 	if(!address_field) {
 		if(frm.doc.customer) {
 			address_field = "customer_address";
@@ -50,14 +51,32 @@
 			address_field = "supplier_address";
 		} else return;
 	}
+ 
 	if(!display_field) display_field = "address_display";
 	if(frm.doc[address_field]) {
 		frappe.call({
 			method: "erpnext.utilities.doctype.address.address.get_address_display",
 			args: {"address_dict": frm.doc[address_field] },
 			callback: function(r) {
-				if(r.message)
+				if(r.message){
 					frm.set_value(display_field, r.message)
+				}
+				frappe.call({
+					method: "erpnext.accounts.party.set_taxes",
+					args: {
+						"party": frm.doc.customer || frm.doc.supplier,
+						"party_type": (frm.doc.customer ? "Customer" : "Supplier"),
+						"posting_date": frm.doc.posting_date || frm.doc.transaction_date,
+						"company": frm.doc.company,
+						"billing_address": ((frm.doc.customer) ? (frm.doc.customer_address) : (frm.doc.supplier_address)),
+						"shipping_address": frm.doc.shipping_address_name
+					},
+					callback: function(r) {
+						if(r.message){
+							frm.set_value("taxes_and_charges", r.message)
+						}
+					}
+				});
 			}
 		})
 	}