fixes Benefit Application, Additional Salary (#14971)
* fix - add Additional Salary if multiple in one slip
* fix - Benefit Appication, None comparison
diff --git a/erpnext/hr/doctype/additional_salary/additional_salary.py b/erpnext/hr/doctype/additional_salary/additional_salary.py
index 90f6c0b..e758227 100644
--- a/erpnext/hr/doctype/additional_salary/additional_salary.py
+++ b/erpnext/hr/doctype/additional_salary/additional_salary.py
@@ -55,11 +55,18 @@
if additional_components:
additional_components_array = []
for additional_component in additional_components:
- struct_row = {}
- additional_components_dict = {}
additional_component_obj = frappe.get_doc("Additional Salary", additional_component[0])
amount = additional_component_obj.get_amount(start_date, end_date)
salary_component = frappe.get_doc("Salary Component", additional_component_obj.salary_component)
+ added = False
+ for added_component in additional_components_array:
+ if added_component["struct_row"]["salary_component"] == salary_component.name:
+ added_component["amount"] += amount
+ added = True
+ if added:
+ continue
+ struct_row = {}
+ additional_components_dict = {}
struct_row['depends_on_lwp'] = salary_component.depends_on_lwp
struct_row['salary_component'] = salary_component.name
struct_row['abbr'] = salary_component.salary_component_abbr
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 a117997..9b6dba5 100644
--- a/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.py
+++ b/erpnext/hr/doctype/employee_benefit_application/employee_benefit_application.py
@@ -200,7 +200,7 @@
# TODO: Check if there is benefit claim for employee then pro-rata divide the rest of amount (Late Benefit Application)
else:
component_max = frappe.db.get_value("Salary Component", struct_row.salary_component, "max_benefit_amount")
- if component_max > 0:
+ if component_max:
benefit_amount = get_benefit_pro_rata_ratio_amount(sal_struct, component_max)
return get_amount(period_factor, benefit_amount, period_length)
return False