fix bug: cast to flt
This commit is contained in:
parent
541d3f9567
commit
31ddbe36c0
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user