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/wizard/hr_departure_wizard.py | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/hr/wizard/hr_departure_wizard.py')
| -rw-r--r-- | addons/hr/wizard/hr_departure_wizard.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/addons/hr/wizard/hr_departure_wizard.py b/addons/hr/wizard/hr_departure_wizard.py new file mode 100644 index 00000000..af861927 --- /dev/null +++ b/addons/hr/wizard/hr_departure_wizard.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import api, fields, models + + +class HrDepartureWizard(models.TransientModel): + _name = 'hr.departure.wizard' + _description = 'Departure Wizard' + + departure_reason = fields.Selection([ + ('fired', 'Fired'), + ('resigned', 'Resigned'), + ('retired', 'Retired') + ], string="Departure Reason", default="fired") + departure_description = fields.Text(string="Additional Information") + departure_date = fields.Date(string="Departure Date", required=True, default=fields.Date.today) + employee_id = fields.Many2one( + 'hr.employee', string='Employee', required=True, + default=lambda self: self.env.context.get('active_id', None), + ) + archive_private_address = fields.Boolean('Archive Private Address', default=True) + + def action_register_departure(self): + employee = self.employee_id + employee.departure_reason = self.departure_reason + employee.departure_description = self.departure_description + employee.departure_date = self.departure_date + + if self.archive_private_address: + # ignore contact links to internal users + private_address = employee.address_home_id + if private_address and private_address.active and not self.env['res.users'].search([('partner_id', '=', private_address.id)]): + private_address.toggle_active() |
