Merge branch 'develop' into place-of-supply-change-issue
diff --git a/erpnext/public/js/controllers/buying.js b/erpnext/public/js/controllers/buying.js
index 58ac38f..b0bb2c8 100644
--- a/erpnext/public/js/controllers/buying.js
+++ b/erpnext/public/js/controllers/buying.js
@@ -135,6 +135,7 @@
 	supplier_address: function() {
 		erpnext.utils.get_address_display(this.frm);
 		erpnext.utils.set_taxes_from_address(this.frm, "supplier_address", "supplier_address", "supplier_address");
+		erpnext.utils.set_place_of_supply(this.frm)
 	},
 
 	buying_price_list: function() {
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 891bbe5..88ff087 100755
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -116,6 +116,19 @@
 		}
 	},
 
+	set_place_of_supply: function(frm){
+		frappe.call({
+			method: "erpnext.regional.india.utils.get_place_of_supply",
+			args: {
+				"party_details": frm.doc,
+				"doctype": frm.doc.doctype
+			},
+			callback: function(r){
+					frm.set_value("place_of_supply", r.message)
+			}
+		})
+	},
+
 	add_indicator_for_multicompany: function(frm, info) {
 		frm.dashboard.stats_area.removeClass('hidden');
 		frm.dashboard.stats_area_row.addClass('flex');
diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py
index 6164e06..07f721b 100644
--- a/erpnext/regional/india/utils.py
+++ b/erpnext/regional/india/utils.py
@@ -135,8 +135,12 @@
 	'''test function'''
 	return 'overridden'
 
+@frappe.whitelist()
 def get_place_of_supply(party_details, doctype):
 	if not frappe.get_meta('Address').has_field('gst_state'): return
+	if isinstance(party_details, string_types):
+		party_details = json.loads(party_details)
+		party_details = frappe._dict(party_details)
 
 	if doctype in ("Sales Invoice", "Delivery Note", "Sales Order"):
 		address_name = party_details.customer_address or party_details.shipping_address_name
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index 002cfe4..77bdf29 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -117,6 +117,7 @@
 	customer_address: function() {
 		erpnext.utils.get_address_display(this.frm, "customer_address");
 		erpnext.utils.set_taxes_from_address(this.frm, "customer_address", "customer_address", "shipping_address_name");
+		erpnext.utils.set_place_of_supply(this.frm)
 	},
 
 	shipping_address_name: function() {