diff --git a/hr_holidays_usability/hr_employee_view.xml b/hr_holidays_usability/hr_employee_view.xml index c0dd981..7bef418 100644 --- a/hr_holidays_usability/hr_employee_view.xml +++ b/hr_holidays_usability/hr_employee_view.xml @@ -12,9 +12,16 @@ hr.employee + 1 + + + + + diff --git a/hr_holidays_usability/hr_holidays.py b/hr_holidays_usability/hr_holidays.py index 6318401..af84f09 100644 --- a/hr_holidays_usability/hr_holidays.py +++ b/hr_holidays_usability/hr_holidays.py @@ -41,6 +41,13 @@ class HrHolidaysStatus(models.Model): default='worked') +class HrEmployee(models.Model): + _inherit = 'hr.employee' + + holiday_exclude_mass_allocation = fields.Boolean( + string='Exclude from Mass Holiday Attribution') + + class HrHolidays(models.Model): _inherit = 'hr.holidays' _order = 'type desc, date_from desc' diff --git a/hr_holidays_usability/wizard/hr_holidays_mass_allocation.py b/hr_holidays_usability/wizard/hr_holidays_mass_allocation.py index e631618..497e181 100644 --- a/hr_holidays_usability/wizard/hr_holidays_mass_allocation.py +++ b/hr_holidays_usability/wizard/hr_holidays_mass_allocation.py @@ -29,8 +29,9 @@ class HrHolidaysMassAllocation(models.TransientModel): _description = 'Wizard for mass allocation of holidays' @api.model - def _get_all_employees(self): - return self.env['hr.employee'].search([]) + def _default_employees(self): + return self.env['hr.employee'].search([ + ('holiday_exclude_mass_allocation', '=', False)]) @api.model def _get_default_holiday_status(self): @@ -44,7 +45,7 @@ class HrHolidaysMassAllocation(models.TransientModel): 'hr.holidays.status', string='Leave Type', required=True, default=_get_default_holiday_status) employee_ids = fields.Many2many( - 'hr.employee', string='Employees', default=_get_all_employees) + 'hr.employee', string='Employees', default=_default_employees) auto_approve = fields.Boolean( string='Automatic Approval', default=True) # size=64 because the name field of hr.holidays is size=64