mirror of
https://github.com/bringout/oca-ocb-hr.git
synced 2026-04-27 17:12:01 +02:00
Initial commit: Hr packages
This commit is contained in:
commit
62531cd146
2820 changed files with 1432848 additions and 0 deletions
|
|
@ -0,0 +1,33 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class HrAttendanceOvertime(models.Model):
|
||||
_name = "hr.attendance.overtime"
|
||||
_description = "Attendance Overtime"
|
||||
_rec_name = 'employee_id'
|
||||
_order = 'date desc'
|
||||
|
||||
def _default_employee(self):
|
||||
return self.env.user.employee_id
|
||||
|
||||
employee_id = fields.Many2one(
|
||||
'hr.employee', string="Employee", default=_default_employee,
|
||||
required=True, ondelete='cascade', index=True)
|
||||
company_id = fields.Many2one(related='employee_id.company_id')
|
||||
|
||||
date = fields.Date(string='Day')
|
||||
duration = fields.Float(string='Extra Hours', default=0.0, required=True)
|
||||
duration_real = fields.Float(
|
||||
string='Extra Hours (Real)', default=0.0,
|
||||
help="Extra-hours including the threshold duration")
|
||||
adjustment = fields.Boolean(default=False)
|
||||
|
||||
def init(self):
|
||||
# Allows only 1 overtime record per employee per day unless it's an adjustment
|
||||
self.env.cr.execute("""
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS hr_attendance_overtime_unique_employee_per_day
|
||||
ON %s (employee_id, date)
|
||||
WHERE adjustment is false""" % (self._table))
|
||||
Loading…
Add table
Add a link
Reference in a new issue