This commit is contained in:
gsinghpal
2026-04-07 20:49:21 -04:00
parent 3cc93b8783
commit 4fde4c7bd1
25 changed files with 1253 additions and 900 deletions

View File

@@ -60,9 +60,9 @@ class PayrollReportTotalPay(models.AbstractModel):
if line.category_id.code == 'BASIC':
emp_data[emp_key]['regular_pay'] += line.total or 0
if hasattr(line, 'code') and line.code:
if line.code == 'STAT_HOLIDAY':
if line.code == 'STAT_PAY':
emp_data[emp_key]['stat_holiday'] += line.total or 0
elif line.code == 'VACATION':
elif line.code == 'VAC_PAY':
emp_data[emp_key]['vacation_pay'] += line.total or 0
emp_data[emp_key]['total'] += getattr(slip, 'gross_wage', 0) or 0
@@ -295,9 +295,9 @@ class PayrollReportDeductions(models.AbstractModel):
deduction_data = defaultdict(lambda: {'employee': 0, 'company': 0})
deduction_codes = {
'CPP': {'name': 'Canada Pension Plan', 'type': 'Tax', 'employer_code': 'CPP_ER'},
'CPP2': {'name': 'Second Canada Pension Plan', 'type': 'Tax', 'employer_code': 'CPP2_ER'},
'EI': {'name': 'Employment Insurance', 'type': 'Tax', 'employer_code': 'EI_ER'},
'CPP_EE': {'name': 'Canada Pension Plan', 'type': 'Tax', 'employer_code': 'CPP_ER'},
'CPP2_EE': {'name': 'Second Canada Pension Plan', 'type': 'Tax', 'employer_code': 'CPP2_ER'},
'EI_EE': {'name': 'Employment Insurance', 'type': 'Tax', 'employer_code': 'EI_ER'},
}
for slip in payslips:
@@ -309,9 +309,9 @@ class PayrollReportDeductions(models.AbstractModel):
if line.code in deduction_codes:
deduction_data[line.code]['employee'] += abs(line.total or 0)
elif line.code.endswith('_ER'):
base_code = line.code[:-3]
if base_code in deduction_codes:
deduction_data[base_code]['company'] += abs(line.total or 0)
ee_code = line.code.replace('_ER', '_EE')
if ee_code in deduction_codes:
deduction_data[ee_code]['company'] += abs(line.total or 0)
lines = []
for code, info in deduction_codes.items():
@@ -378,8 +378,8 @@ class PayrollReportWorkersComp(models.AbstractModel):
continue
province = 'ON' # Default, would get from employee address
if hasattr(slip.employee_id, 'province_of_employment'):
province = getattr(slip.employee_id, 'province_of_employment', None) or 'ON'
if hasattr(slip.employee_id, 'home_province'):
province = getattr(slip.employee_id, 'home_province', None) or 'ON'
province_data[province]['wages'] += getattr(slip, 'gross_wage', 0) or 0