if no address, only then have address type as Office
diff --git a/buying/doctype/supplier/supplier.js b/buying/doctype/supplier/supplier.js
index 5b18683..3834bda 100644
--- a/buying/doctype/supplier/supplier.js
+++ b/buying/doctype/supplier/supplier.js
@@ -55,7 +55,11 @@
address.supplier = cur_frm.doc.name;
address.supplier_name = cur_frm.doc.supplier_name;
address.address_title = cur_frm.doc.supplier_name;
- address.address_type = "Office";
+
+ if(!(cur_frm.address_list.data && cur_frm.address_list.data.length)) {
+ address.address_type = "Office";
+ }
+
wn.set_route("Form", "Address", address.name);
},
get_query: function() {
diff --git a/selling/doctype/customer/customer.js b/selling/doctype/customer/customer.js
index 7b5397e..403b83f 100644
--- a/selling/doctype/customer/customer.js
+++ b/selling/doctype/customer/customer.js
@@ -65,7 +65,11 @@
address.customer = cur_frm.doc.name;
address.customer_name = cur_frm.doc.customer_name;
address.address_title = cur_frm.doc.customer_name;
- address.address_type = "Office";
+
+ if(!(cur_frm.address_list.data && cur_frm.address_list.data.length)) {
+ address.address_type = "Office";
+ }
+
wn.set_route("Form", "Address", address.name);
},
get_query: function() {