fix: salary slip attribute error (#24455)

Co-authored-by: Rucha Mahabal <ruchamahabal2@gmail.com>
This commit is contained in:
Jannat Patel 2021-02-18 15:52:29 +05:30 committed by GitHub
parent d826bee13a
commit ef5c714de2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1103,10 +1103,10 @@ class SalarySlip(TransactionBase):
self.calculate_total_for_salary_slip_based_on_timesheet()
else:
self.total_deduction = 0.0
if self.earnings:
if hasattr(self, "earnings"):
for earning in self.earnings:
self.gross_pay += flt(earning.amount, earning.precision("amount"))
if self.deductions:
if hasattr(self, "deductions"):
for deduction in self.deductions:
self.total_deduction += flt(deduction.amount, deduction.precision("amount"))
self.net_pay = flt(self.gross_pay) - flt(self.total_deduction) - flt(self.total_loan_repayment)