fix: components in the same table don't get updated value of prev payment-days based component

This commit is contained in:
Rucha Mahabal
2022-07-04 23:14:26 +05:30
parent 31fd263825
commit 01beb6f391
2 changed files with 5 additions and 2 deletions

View File

@@ -626,7 +626,7 @@ class SalarySlip(TransactionBase):
for struct_row in self._salary_structure_doc.get(component_type):
amount = self.eval_condition_and_formula(struct_row, data)
if amount is not None and struct_row.statistical_component == 0:
self.update_component_row(struct_row, amount, component_type)
self.update_component_row(struct_row, amount, component_type, data=data)
def get_data_for_eval(self):
"""Returns data for evaluating formula"""
@@ -780,7 +780,7 @@ class SalarySlip(TransactionBase):
self.update_component_row(tax_row, tax_amount, "deductions")
def update_component_row(
self, component_data, amount, component_type, additional_salary=None, is_recurring=0
self, component_data, amount, component_type, additional_salary=None, is_recurring=0, data=None
):
component_row = None
for d in self.get(component_type):
@@ -850,6 +850,8 @@ class SalarySlip(TransactionBase):
component_row.amount = amount
self.update_component_amount_based_on_payment_days(component_row)
if data:
data[component_row.abbr] = component_row.amount
def update_component_amount_based_on_payment_days(self, component_row):
joining_date, relieving_date = self.get_joining_and_relieving_dates()

View File

@@ -1119,6 +1119,7 @@ def make_earning_salary_component(
"formula": "BS*.5",
"type": "Earning",
"amount_based_on_formula": 1,
"depends_on_payment_days": 0,
},
{"salary_component": "Leave Encashment", "abbr": "LE", "type": "Earning"},
]