fix due date disable bug
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index 8d4d2d4..36ca528 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -379,7 +379,8 @@
 	},
 
 	disable_due_date: function() {
-		const disable = !cur_frm.doc.payment_terms_template && cur_frm.doc.payment_schedule.length == 0;
+		const disable = cur_frm.doc.payment_terms_template || (
+							cur_frm.doc.payment_schedule && cur_frm.doc.payment_schedule.length == 0);
 		cur_frm.set_df_property("due_date", "read_only", disable ? 1 : 0);
 	},
 
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 2c11e17..5432b4c 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -571,7 +571,8 @@
 	},
 
 	disable_due_date: function() {
-		const disable = !cur_frm.doc.payment_terms_template && cur_frm.doc.payment_schedule.length == 0;
+		const disable = cur_frm.doc.payment_terms_template || (
+							cur_frm.doc.payment_schedule && cur_frm.doc.payment_schedule.length == 0);
 		cur_frm.set_df_property("due_date", "read_only", disable ? 1 : 0);
 	},