Skip to content

Commit

Permalink
fix(Salary Slip): Components not updated when amount evaluates to 0 d…
Browse files Browse the repository at this point in the history
…ue to payment days (backport #31425) (#31432)

Co-authored-by: Rucha Mahabal <ruchamahabal2@gmail.com>
  • Loading branch information
mergify[bot] and ruchamahabal authored Jul 1, 2022
1 parent 7a02dfe commit 7b093e5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion erpnext/payroll/doctype/salary_slip/salary_slip.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ def add_structure_components(self, component_type):
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):
Expand Down Expand Up @@ -854,6 +854,10 @@ def update_component_amount_based_on_payment_days(self, component_row):
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):
Expand Down

0 comments on commit 7b093e5

Please sign in to comment.