Add option on employees to exclude from mass allocation
This commit is contained in:
@@ -12,9 +12,16 @@
|
||||
<field name="model">hr.employee</field>
|
||||
<field name="inherit_id" ref="hr_holidays.view_employee_form_leave_inherit"/>
|
||||
<field name="arch" type="xml">
|
||||
<!-- too difficult to hide the inside of the Leave group
|
||||
so I hide the whole group and re-create one -->
|
||||
<group string="Leaves" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</group>
|
||||
<group string="Leaves" position="after">
|
||||
<group name="holidays" string="Holidays">
|
||||
<field name="holiday_exclude_mass_allocation"/>
|
||||
</group>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user