mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[IMP] l10n_us_hr_payroll: Hibou Professional hooks.
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
'depends': [
|
'depends': [
|
||||||
'hr_payroll',
|
'hr_payroll',
|
||||||
'hr_contract_reports',
|
'hr_contract_reports',
|
||||||
|
'hibou_professional',
|
||||||
],
|
],
|
||||||
'description': """
|
'description': """
|
||||||
United States of America - Payroll Rules.
|
United States of America - Payroll Rules.
|
||||||
|
|||||||
@@ -4,4 +4,5 @@ from . import browsable_object
|
|||||||
from . import hr_contract
|
from . import hr_contract
|
||||||
from . import hr_payslip
|
from . import hr_payslip
|
||||||
from . import res_config_settings
|
from . import res_config_settings
|
||||||
|
from . import update
|
||||||
from . import us_payroll_config
|
from . import us_payroll_config
|
||||||
|
|||||||
26
l10n_us_hr_payroll/models/update.py
Normal file
26
l10n_us_hr_payroll/models/update.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class PublisherWarrantyContract(models.AbstractModel):
|
||||||
|
_inherit = 'publisher_warranty.contract'
|
||||||
|
|
||||||
|
def _get_hibou_modules(self):
|
||||||
|
modules = super(PublisherWarrantyContract, self)._get_hibou_modules()
|
||||||
|
try:
|
||||||
|
today_date = fields.Date.today()
|
||||||
|
last_thirty_date = today_date - datetime.timedelta(days=30)
|
||||||
|
today = fields.Date.to_string(today_date + datetime.timedelta(days=1)) # Dates vs Datetimes, pad out a day
|
||||||
|
last_thirty = fields.Date.to_string(last_thirty_date)
|
||||||
|
self.env.cr.execute(
|
||||||
|
'SELECT COUNT(DISTINCT(employee_id)) FROM hr_payslip WHERE create_date BETWEEN %s AND %s',
|
||||||
|
(last_thirty, today))
|
||||||
|
employee_count = self.env.cr.fetchone()[0] or 0
|
||||||
|
modules.update({
|
||||||
|
'l10n_us_hr_payroll': employee_count,
|
||||||
|
})
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
return modules
|
||||||
Reference in New Issue
Block a user