[fix] check if supplier value exists (#13616)
diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.js b/erpnext/accounts/doctype/tax_rule/tax_rule.js
index 16041a8..84c42a3 100644
--- a/erpnext/accounts/doctype/tax_rule/tax_rule.js
+++ b/erpnext/accounts/doctype/tax_rule/tax_rule.js
@@ -39,18 +39,20 @@
});
frappe.ui.form.on("Tax Rule", "supplier", function(frm) {
- frappe.call({
- method:"erpnext.accounts.doctype.tax_rule.tax_rule.get_party_details",
- args: {
- "party": frm.doc.supplier,
- "party_type": "supplier"
- },
- callback: function(r) {
- if(!r.exc) {
- $.each(r.message, function(k, v) {
- frm.set_value(k, v);
- });
+ if(frm.doc.supplier) {
+ frappe.call({
+ method:"erpnext.accounts.doctype.tax_rule.tax_rule.get_party_details",
+ args: {
+ "party": frm.doc.supplier,
+ "party_type": "supplier"
+ },
+ callback: function(r) {
+ if(!r.exc) {
+ $.each(r.message, function(k, v) {
+ frm.set_value(k, v);
+ });
+ }
}
- }
- });
+ });
+ }
});