Fix benefits (#14735)
* Employee Benefit Application - fix typo
* Employee Benefits - fix field renamed
diff --git a/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.js b/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.js
index 9af3ee9..412a08a 100644
--- a/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.js
+++ b/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.js
@@ -83,7 +83,7 @@
}
}
doc.total_amount = total_amount;
- doc.remainig_benefits = doc.max_benefits - total_amount;
+ doc.remaining_benefit = doc.max_benefits - total_amount;
doc.pro_rata_dispensed_amount = pro_rata_dispensed_amount;
- refresh_many(['pro_rata_dispensed_amount', 'total_amount','remainig_benefits']);
+ refresh_many(['pro_rata_dispensed_amount', 'total_amount','remaining_benefit']);
};
diff --git a/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.json b/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.json
index 7a8803a..57698f6 100644
--- a/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.json
+++ b/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.json
@@ -119,7 +119,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "remainig_benefits",
+ "fieldname": "remaining_benefit",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
@@ -445,7 +445,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2018-05-25 12:01:01.490375",
+ "modified": "2018-06-28 18:25:01.490375",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee Benefit Application",
diff --git a/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.py b/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.py
index 97ab07c..6ce421f 100644
--- a/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.py
+++ b/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.py
@@ -18,7 +18,7 @@
frappe.throw(_("Employee {0} has no maximum benefit amount").format(self.employee))
self.validate_max_benefit_for_component()
self.validate_prev_benefit_claim()
- if self.remainig_benefits > 0:
+ if self.remaining_benefit > 0:
self.validate_remaining_benefit_amount()
def validate_prev_benefit_claim(self):
@@ -35,7 +35,7 @@
def validate_remaining_benefit_amount(self):
# check salary structure earnings have flexi component (sum of max_benefit_amount)
- # without pro-rata which satisfy the remainig_benefits
+ # without pro-rata which satisfy the remaining_benefit
# else pro-rata component for the amount
# again comes the same validation and satisfy or throw
benefit_components = []
@@ -57,13 +57,13 @@
non_pro_rata_amount += max_benefit_amount
if pro_rata_amount == 0 and non_pro_rata_amount == 0:
- frappe.throw(_("Please add the remainig benefits {0} to any of the existing component").format(self.remainig_benefits))
- elif non_pro_rata_amount > 0 and non_pro_rata_amount < rounded(self.remainig_benefits):
+ frappe.throw(_("Please add the remainig benefits {0} to any of the existing component").format(self.remaining_benefit))
+ elif non_pro_rata_amount > 0 and non_pro_rata_amount < rounded(self.remaining_benefit):
frappe.throw(_("You can claim only an amount of {0}, the rest amount {1} should be in the application \
- as pro-rata component").format(non_pro_rata_amount, self.remainig_benefits - non_pro_rata_amount))
+ as pro-rata component").format(non_pro_rata_amount, self.remaining_benefit - non_pro_rata_amount))
elif non_pro_rata_amount == 0:
frappe.throw(_("Please add the remainig benefits {0} to the application as \
- pro-rata component").format(self.remainig_benefits))
+ pro-rata component").format(self.remaining_benefit))
def validate_max_benefit_for_component(self):
if self.employee_benefits:
diff --git a/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.py b/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.py
index 1d3c452..c487dbb 100644
--- a/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.py
+++ b/erpnext/hr/doctype/employee_benefit_claim/employee_benefit_claim.py
@@ -128,7 +128,7 @@
)
if application:
application_obj = frappe.get_doc("Employee Benefit Application", application)
- pro_rata_amount = application_obj.pro_rata_dispensed_amount + application_obj.max_benefits - application_obj.remainig_benefits
+ pro_rata_amount = application_obj.pro_rata_dispensed_amount + application_obj.max_benefits - application_obj.remaining_benefit
else:
pro_rata_amount = get_benefit_pro_rata_ratio_amount(employee, sal_slip_start_date, sal_struct)
@@ -140,23 +140,23 @@
max_benefits = get_max_benefits(employee, payroll_period.end_date)
if not max_benefits:
max_benefits = 0
- remainig_benefits = max_benefits - get_total_benefit_dispensed(employee, sal_struct, sal_slip_start_date, payroll_period)
- if remainig_benefits > 0:
+ remaining_benefit = max_benefits - get_total_benefit_dispensed(employee, sal_struct, sal_slip_start_date, payroll_period)
+ if remaining_benefit > 0:
have_remaining = True
# Set the remainig benefits to flexi non pro-rata component in the salary structure
salary_components_array = []
for d in sal_struct.get("earnings"):
if d.is_flexible_benefit == 1:
salary_component = frappe.get_doc("Salary Component", d.salary_component)
- if salary_component.is_pro_rata_applicable != 1:
+ if salary_component.pay_against_benefit_claim == 1:
claimed_amount = get_benefit_claim_amount(employee, payroll_period.start_date, sal_slip_end_date, d.salary_component)
amount_fit_to_component = salary_component.max_benefit_amount - claimed_amount
if amount_fit_to_component > 0:
- if remainig_benefits > amount_fit_to_component:
+ if remaining_benefit > amount_fit_to_component:
amount = amount_fit_to_component
- remainig_benefits -= amount_fit_to_component
+ remaining_benefit -= amount_fit_to_component
else:
- amount = remainig_benefits
+ amount = remaining_benefit
have_remaining = False
current_claimed_amount = get_benefit_claim_amount(employee, sal_slip_start_date, sal_slip_end_date, d.salary_component)
amount += current_claimed_amount