Salary slip - default flexi component
diff --git a/erpnext/hr/doctype/salary_component/salary_component.py b/erpnext/hr/doctype/salary_component/salary_component.py
index 7a9e52e..9a43069 100644
--- a/erpnext/hr/doctype/salary_component/salary_component.py
+++ b/erpnext/hr/doctype/salary_component/salary_component.py
@@ -13,7 +13,7 @@
self.validate_abbr()
self.validate_flexi_default()
- def validate_flexi_defualt(self):
+ def validate_flexi_default(self):
if self.is_flexible_benefit and self.is_pro_rata_applicable and self.flexi_default:
salary_component = frappe.db.exists(
'Salary Component',
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py
index 043b693..85afc90 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.py
@@ -84,16 +84,20 @@
}
)
if default_flexi_compenent:
- salary_component = frappe.get_doc("Salary Component", default_flexi_compenent)
- flexi_struct_row = {}
- flexi_struct_row['depends_on_lwp'] = salary_component.depends_on_lwp
- flexi_struct_row['salary_component'] = salary_component.name
- flexi_struct_row['abbr'] = salary_component.salary_component_abbr
- flexi_struct_row['do_not_include_in_total'] = salary_component.do_not_include_in_total
+ flexi_struct_row = self.create_flexi_struct_row(default_flexi_compenent)
payroll_period_days = get_payroll_period_days(self.start_date, self.end_date, self.company)
amount = get_amount(payroll_period_days, self.start_date, self.end_date, max_benefits)
self.update_component_row(flexi_struct_row, amount, "earnings")
+ def create_flexi_struct_row(self, default_flexi_compenent):
+ salary_component = frappe.get_doc("Salary Component", default_flexi_compenent)
+ flexi_struct_row = {}
+ flexi_struct_row['depends_on_lwp'] = salary_component.depends_on_lwp
+ flexi_struct_row['salary_component'] = salary_component.name
+ flexi_struct_row['abbr'] = salary_component.salary_component_abbr
+ flexi_struct_row['do_not_include_in_total'] = salary_component.do_not_include_in_total
+ return frappe._dict(flexi_struct_row)
+
def update_component_row(self, struct_row, amount, key):
component_row = None
for d in self.get(key):