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

Co-authored-by: Rucha Mahabal <ruchamahabal2@gmail.com>
This commit is contained in:
mergify[bot] 2022-07-01 10:35:59 +05:30 committed by GitHub
parent 7a02dfe09a
commit 7b093e5803
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -624,7 +624,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):
@ -854,6 +854,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):