diff --git a/erpnext/accounts/doctype/payment_terms_template/payment_terms_template.py b/erpnext/accounts/doctype/payment_terms_template/payment_terms_template.py index 7939d8d2253..7042df05942 100644 --- a/erpnext/accounts/doctype/payment_terms_template/payment_terms_template.py +++ b/erpnext/accounts/doctype/payment_terms_template/payment_terms_template.py @@ -6,7 +6,7 @@ from __future__ import unicode_literals import frappe from frappe.model.document import Document -from frappe.utils import flt +from frappe.utils import flt, cint from frappe import _ @@ -19,14 +19,14 @@ class PaymentTermsTemplate(Document): def validate_invoice_portion(self): total_portion = 0 for term in self.terms: - 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') def validate_credit_days(self): for term in self.terms: - if term.credit_days < 0: + if cint(term.credit_days) < 0: frappe.msgprint(_('Credit Days cannot be a negative number'), raise_exception=1, indicator='red') def check_duplicate_terms(self):