fix(Salary Slip): Components not updated when amount evaluates to 0 due to payment days (#31425)

* fix(Salary Slip): Components not updated when amount evaluates to 0 due to payment days

* fix: remove 0 valued components that have been updated later
This commit is contained in:
Rucha Mahabal
2022-06-23 11:01:00 +05:30
committed by GitHub
parent 87f77813ea
commit abfe926a45

View File

@@ -625,7 +625,7 @@ class SalarySlip(TransactionBase):
data = self.get_data_for_eval()
for struct_row in self._salary_structure_doc.get(component_type):
amount = self.eval_condition_and_formula(struct_row, data)
if amount and struct_row.statistical_component == 0:
if amount is not None and struct_row.statistical_component == 0:
self.update_component_row(struct_row, amount, component_type)
def get_data_for_eval(self):
@@ -857,6 +857,10 @@ class SalarySlip(TransactionBase):
component_row, joining_date, relieving_date
)[0]
# remove 0 valued components that have been updated later
if component_row.amount == 0:
self.remove(component_row)
def set_precision_for_component_amounts(self):
for component_type in ("earnings", "deductions"):
for component_row in self.get(component_type):