diff --git a/bemade_l10n_ca_payroll/__init__.py b/bemade_l10n_ca_payroll/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/bemade_l10n_ca_payroll/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/bemade_l10n_ca_payroll/__manifest__.py b/bemade_l10n_ca_payroll/__manifest__.py new file mode 100644 index 0000000..55af9e3 --- /dev/null +++ b/bemade_l10n_ca_payroll/__manifest__.py @@ -0,0 +1,37 @@ +# +# Bemade Inc. +# +# Copyright (C) 2023-June Bemade Inc. (). +# Author: Marc Durepos (Contact : marc@bemade.org) +# +# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the Software +# or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +{ + 'name': 'Quebec Payroll', + 'version': '17.0.1.0.0', + 'summary': 'Computations for Quebec Payslips', + 'category': 'Human Resources/Payroll', + 'author': 'Bemade Inc.', + 'website': 'http://www.bemade.org', + 'license': 'OPL-1', + 'depends': [ + 'hr_payroll', + 'l10n_ca', + ], + 'data': [ + 'data/hr_salary_rule_data.xml', + ], + 'assets': {}, + 'installable': True, + 'auto_install': False +} diff --git a/bemade_l10n_ca_payroll/data/hr_payslip_input_type_data.xml b/bemade_l10n_ca_payroll/data/hr_payslip_input_type_data.xml new file mode 100644 index 0000000..5939d09 --- /dev/null +++ b/bemade_l10n_ca_payroll/data/hr_payslip_input_type_data.xml @@ -0,0 +1,48 @@ + + + + + Bonus or other non-period payment + BONUS + + + + + Employee-requested deductions (Federal) + FED_F1 + + + + + Court-ordered deductions (Federal) + FED_F2 + + + + + Union or association dues for the period (Federal) + FED_U1 + + + + + Allowance for residents of specified regions (Federal) + FED_HD + + + + + Deduction for retirement plan contributions (Federal) + FED_F + + + + + Total Requested Amount on Federal form TD1 + FED_TC + + + + + + \ No newline at end of file diff --git a/bemade_l10n_ca_payroll/data/hr_salary_rule_data.xml b/bemade_l10n_ca_payroll/data/hr_salary_rule_data.xml new file mode 100644 index 0000000..e37d786 --- /dev/null +++ b/bemade_l10n_ca_payroll/data/hr_salary_rule_data.xml @@ -0,0 +1,146 @@ + + + + + A, R, K constants for Federak Tax Calculation + ARK + + + 2024-01-01 + + + [ + (0, 0.15, 0), + (55867, 0.2050, 3073), + (111733, 0.26, 9218), + (173205, 0.29, 14414), + (246752, 0.33, 24284), + ] + + + + Base amount for federal form TD1 + FED_TC + + + 2024-01-01 + + 15704 + + + + Income Tax - Federal + + + + + + + none + code + + """ + + + + \ No newline at end of file diff --git a/bemade_l10n_ca_payroll/models/__init__.py b/bemade_l10n_ca_payroll/models/__init__.py new file mode 100644 index 0000000..f888b25 --- /dev/null +++ b/bemade_l10n_ca_payroll/models/__init__.py @@ -0,0 +1 @@ +from . import hr_payroll_structure_type diff --git a/bemade_l10n_ca_payroll/models/hr_payroll_structure_type.py b/bemade_l10n_ca_payroll/models/hr_payroll_structure_type.py new file mode 100644 index 0000000..f799aa3 --- /dev/null +++ b/bemade_l10n_ca_payroll/models/hr_payroll_structure_type.py @@ -0,0 +1,26 @@ +from odoo import models, fields, api + + +class HrPayrollStructureType(models.Model): + _inherit = 'hr.payroll.structure.type' + + default_pay_periods_per_year = fields.Integer( + compute="_compute_pay_periods_per_year", + compute_sudo=True, + ) + + @api.depends("default_schedule_pay") + def _compute_pay_periods_per_year(self): + pay_periods_map = { + 'annually': 1, + 'semi-annually': 2, + 'quarterly': 4, + 'bi-monthly': 6, + 'monthly': 12, + 'semi-monthly': 24, + 'bi-weekly': 26, + 'weekly': 52, + 'daily': 365, + } + for rec in self: + rec.default_pay_periods_per_year = pay_periods_map.get(rec.default_schedule_pay, False) \ No newline at end of file diff --git a/bemade_l10n_ca_payroll/models/hr_payslip.py b/bemade_l10n_ca_payroll/models/hr_payslip.py new file mode 100644 index 0000000..3c79d14 --- /dev/null +++ b/bemade_l10n_ca_payroll/models/hr_payslip.py @@ -0,0 +1,29 @@ +from odoo import models, fields, api + + +class Payslip(models.Model): + _inherit = "hr.payslip" + + def _l18n_ca_compute_fed_tax_constants(self, taxable_income: float, coefficients): + """ + Take a table of input coefficients in the form + [ + (a, r, k), + ... + ] where a, r, and k are the threshold, tax rate and federal constants from government tables, + and return the r and k applicable for the given annual taxable income. + + :param taxable_income: annual taxable income + :param coefficients: coefficients table to use (get it from rule parameters data, usually) + :return: (r, k) values where r is the tax rate and k is the federal constant to use + """ + R = coefficients[0][1] + K = coefficients[0][2] + + # Get the rate and constant by income tier (stop once we reach a tier above the taxable income) + for a, r, k in coefficients: + if taxable_income < a: + return R, K + R = r + K = k + return R, K