mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
MIG hr_payroll_attendance to 12.0
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
'name': 'Attendance on Payslips',
|
'name': 'Attendance on Payslips',
|
||||||
'description': 'Get Attendence numbers onto Employee Payslips.',
|
'description': 'Get Attendence numbers onto Employee Payslips.',
|
||||||
'version': '11.0.1.0.0',
|
'version': '12.0.1.0.0',
|
||||||
'website': 'https://hibou.io/',
|
'website': 'https://hibou.io/',
|
||||||
'author': 'Hibou Corp. <hello@hibou.io>',
|
'author': 'Hibou Corp. <hello@hibou.io>',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
from datetime import datetime
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from odoo import api, models
|
from odoo import api, models
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
|
|
||||||
|
|
||||||
|
|
||||||
class HrPayslip(models.Model):
|
class HrPayslip(models.Model):
|
||||||
@@ -41,8 +39,7 @@ class HrPayslip(models.Model):
|
|||||||
raise ValidationError('This pay period must not have any open attendances.')
|
raise ValidationError('This pay period must not have any open attendances.')
|
||||||
if attn.worked_hours:
|
if attn.worked_hours:
|
||||||
# Avoid in/outs
|
# Avoid in/outs
|
||||||
attn_start_time = datetime.strptime(attn.check_in, DEFAULT_SERVER_DATETIME_FORMAT)
|
attn_iso = attn.check_in.isocalendar()
|
||||||
attn_iso = attn_start_time.isocalendar()
|
|
||||||
if not attn_iso in days:
|
if not attn_iso in days:
|
||||||
worked_attn['number_of_days'] += 1
|
worked_attn['number_of_days'] += 1
|
||||||
days.add(attn_iso)
|
days.add(attn_iso)
|
||||||
@@ -73,8 +70,7 @@ class HrPayslip(models.Model):
|
|||||||
raise ValidationError('This pay period must not have any open attendances.')
|
raise ValidationError('This pay period must not have any open attendances.')
|
||||||
if attn.worked_hours:
|
if attn.worked_hours:
|
||||||
# Avoid in/outs
|
# Avoid in/outs
|
||||||
attn_start_time = datetime.strptime(attn.check_in, DEFAULT_SERVER_DATETIME_FORMAT)
|
attn_iso = attn.check_in.isocalendar()
|
||||||
attn_iso = attn_start_time.isocalendar()
|
|
||||||
day_values[attn_iso] += attn.worked_hours
|
day_values[attn_iso] += attn.worked_hours
|
||||||
return day_values
|
return day_values
|
||||||
elif hasattr(super(HrPayslip, self), 'hour_break_down'):
|
elif hasattr(super(HrPayslip, self), 'hour_break_down'):
|
||||||
|
|||||||
Reference in New Issue
Block a user