make due date, invoice_portion mandatory
diff --git a/erpnext/accounts/doctype/payment_terms_template_detail/payment_terms_template_detail.json b/erpnext/accounts/doctype/payment_terms_template_detail/payment_terms_template_detail.json
index 88babd5..2d1f6a0 100644
--- a/erpnext/accounts/doctype/payment_terms_template_detail/payment_terms_template_detail.json
+++ b/erpnext/accounts/doctype/payment_terms_template_detail/payment_terms_template_detail.json
@@ -81,6 +81,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 2, 
+   "default": "0", 
    "fieldname": "invoice_portion", 
    "fieldtype": "Percent", 
    "hidden": 0, 
@@ -101,7 +102,7 @@
    "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 0, 
+   "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
@@ -132,7 +133,7 @@
    "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 0, 
+   "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
@@ -143,6 +144,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 2, 
+   "default": "0", 
    "depends_on": "eval:in_list(['Day(s) after invoice date', 'Day(s) after the end of the invoice month'], doc.due_date_based_on)", 
    "fieldname": "credit_days", 
    "fieldtype": "Int", 
@@ -175,6 +177,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "default": "0", 
    "depends_on": "eval:doc.due_date_based_on=='Month(s) after the end of the invoice month'", 
    "fieldname": "credit_months", 
    "fieldtype": "Int", 
@@ -211,7 +214,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2017-08-10 16:27:31.401380", 
+ "modified": "2017-09-22 11:15:02.585019", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Payment Terms Template Detail", 
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index cc624c8..16b22ce 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -666,7 +666,7 @@
 	def validate_invoice_portion(self):
 		total_portion = 0
 		for term in self.payment_schedule:
-			total_portion += term.invoice_portion
+			total_portion += flt(term.get('invoice_portion', 0))
 
 		if flt(total_portion, 2) != 100.00:
 			frappe.msgprint(_('Combined invoice portion must equal 100%'), raise_exception=1, indicator='red')