mirror of
https://github.com/bringout/oca-ocb-hr.git
synced 2026-04-27 10:12:04 +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,27 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class HrDepartureWizard(models.TransientModel):
|
||||
_inherit = 'hr.departure.wizard'
|
||||
|
||||
cancel_leaves = fields.Boolean("Cancel Future Leaves", default=True,
|
||||
help="Cancel all time off after this date.")
|
||||
archive_allocation = fields.Boolean("Archive Employee Allocations", default=True,
|
||||
help="Remove employee from existing accrual plans.")
|
||||
|
||||
def action_register_departure(self):
|
||||
super(HrDepartureWizard, self).action_register_departure()
|
||||
if self.cancel_leaves:
|
||||
future_leaves = self.env['hr.leave'].search([('employee_id', '=', self.employee_id.id),
|
||||
('date_to', '>', self.departure_date),
|
||||
('state', '!=', 'refuse')])
|
||||
future_leaves.action_refuse()
|
||||
|
||||
if self.archive_allocation:
|
||||
employee_allocations = self.env['hr.leave.allocation'].search([('employee_id', '=', self.employee_id.id)])
|
||||
employee_allocations.action_archive()
|
||||
Loading…
Add table
Add a link
Reference in a new issue