[fix] call get_party_account only if party is set
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 58c68e8..6f36bdb 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -270,7 +270,7 @@
 				me.apply_pricing_rule();
 			}
 		}
-		
+
 		var set_party_account = function(set_pricing) {
 			if (in_list(["Sales Invoice", "Purchase Invoice"], me.frm.doc.doctype)) {
 				if(me.frm.doc.doctype=="Sales Invoice") {
@@ -280,25 +280,27 @@
 					var party_type = "Supplier";
 					var party_account_field = 'credit_to';
 				}
-				
-				return frappe.call({
-					method: "erpnext.accounts.party.get_party_account",
-					args: {
-						company: me.frm.doc.company,
-						party_type: party_type,
-						party: me.frm.doc[frappe.model.scrub(party_type)]
-					},
-					callback: function(r) {
-						if(!r.exc && r.message) {
-							me.frm.set_value(party_account_field, r.message);
-							set_pricing();
+
+				if(me.frm.doc[frappe.model.scrub(party_type)]) {
+					return frappe.call({
+						method: "erpnext.accounts.party.get_party_account",
+						args: {
+							company: me.frm.doc.company,
+							party_type: party_type,
+							party: me.frm.doc[frappe.model.scrub(party_type)]
+						},
+						callback: function(r) {
+							if(!r.exc && r.message) {
+								me.frm.set_value(party_account_field, r.message);
+								set_pricing();
+							}
 						}
-					}
-				});
+					});
+				}
 			} else {
 				set_pricing();
 			}
-			
+
 		}
 
 		if (this.frm.doc.posting_date) var date = this.frm.doc.posting_date;