mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
In stock Odoo, summing anything in payroll rules (but most importantly rule amounts and category amounts by code), the considered payslips are referenced from their `date_from` field. However in the USA, it is in fact the `date_to` that is more important (or accounting date). A Payslip made for 2019-12-20 to 2020-01-04 should in fact be considered a '2020' payslip, and thus the summation on other '2020' payslips must find it by considering payslips `date_to`.
25 lines
1.2 KiB
Python
25 lines
1.2 KiB
Python
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
|
|
|
from odoo import fields, models
|
|
|
|
|
|
class ResConfigSettings(models.TransientModel):
|
|
_inherit = 'res.config.settings'
|
|
|
|
payslip_sum_type = fields.Selection([
|
|
('date_from', 'Date From'),
|
|
('date_to', 'Date To'),
|
|
('date', 'Accounting Date'),
|
|
], 'Payslip Sum Behavior', help="Behavior for what payslips are considered "
|
|
"during rule execution. Stock Odoo behavior "
|
|
"would not consider a payslip starting on 2019-12-30 "
|
|
"ending on 2020-01-07 when summing a 2020 payslip category.\n\n"
|
|
"Accounting Date requires Payroll Accounting and will "
|
|
"fall back to date_to as the 'closest behavior'.",
|
|
config_parameter='hr_payroll.payslip.sum_behavior')
|
|
|
|
def set_values(self):
|
|
super(ResConfigSettings, self).set_values()
|
|
self.env['ir.config_parameter'].set_param('hr_payroll.payslip.sum_behavior',
|
|
self.payslip_sum_type or 'date_from')
|