Tax Declaration, Proof Submission, validation

This commit is contained in:
Ranjith
2018-05-10 15:06:49 +05:30
parent 85d2d571c5
commit 5a8e6427f4
5 changed files with 103 additions and 6 deletions

View File

@@ -49,3 +49,16 @@ def update_employee(employee, details, cancel=False):
new_data = get_datetime(new_data)
setattr(employee, item.fieldname, new_data)
return employee
def validate_tax_declaration(declarations):
subcategories = []
for declaration in declarations:
if declaration.exemption_sub_category in subcategories:
frappe.throw(_("More than one selection for {0} not \
allowed").format(declaration.exemption_sub_category), frappe.ValidationError)
subcategories.append(declaration.exemption_sub_category)
max_amount = frappe.db.get_value("Employee Tax Exemption Sub Category", \
declaration.exemption_sub_category, "max_amount")
if declaration.amount > max_amount:
frappe.throw(_("Max exemption amount for {0} is {1}").format(\
declaration.exemption_sub_category, max_amount), frappe.ValidationError)