Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow setting opening tax balance in salary assignment for old employees too #2618

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these helper functions definitions if they are not being used anywhere else?

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
Loading