diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/hr_holidays/wizard/hr_departure_wizard.py | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/hr_holidays/wizard/hr_departure_wizard.py')
| -rw-r--r-- | addons/hr_holidays/wizard/hr_departure_wizard.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/addons/hr_holidays/wizard/hr_departure_wizard.py b/addons/hr_holidays/wizard/hr_departure_wizard.py new file mode 100644 index 00000000..784d4f3a --- /dev/null +++ b/addons/hr_holidays/wizard/hr_departure_wizard.py @@ -0,0 +1,20 @@ +# -*- 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) + + 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', 'not in', ['cancel', 'refuse'])]) + future_leaves.write({'state': 'cancel'}) |
