Skip to content

Commit

Permalink
fix: allow setting opening tax balance in salary assignment for old e…
Browse files Browse the repository at this point in the history
…mployees too (backport #2618) (#2636)

Co-authored-by: Aysha <[email protected]>
  • Loading branch information
mergify[bot] and AyshaHakeem authored Jan 14, 2025
1 parent 5ee2cbf commit d99f5e3
Showing 1 changed file with 1 addition and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,29 +172,7 @@ def are_opening_entries_required(self) -> bool:
if not get_tax_component(self.salary_structure):
return False

if self.has_emp_joined_after_payroll_period_start() and not self.has_existing_salary_slips():
return True
else:
if not self.docstatus.is_draft() and (
self.taxable_earnings_till_date or self.tax_deducted_till_date
):
return True
return False

def has_existing_salary_slips(self) -> bool:
return bool(
frappe.db.exists(
"Salary Slip",
{"employee": self.employee, "docstatus": 1},
)
)

def has_emp_joined_after_payroll_period_start(self) -> bool:
date_of_joining = getdate(frappe.db.get_value("Employee", self.employee, "date_of_joining"))
payroll_period = get_payroll_period(self.from_date, self.from_date, self.company)
if not payroll_period or date_of_joining > getdate(payroll_period.start_date):
return True
return False
return True


def get_assigned_salary_structure(employee, on_date):
Expand Down

0 comments on commit d99f5e3

Please sign in to comment.