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="model">hr.employee</field>
|
||||||
<field name="inherit_id" ref="hr_holidays.view_employee_form_leave_inherit"/>
|
<field name="inherit_id" ref="hr_holidays.view_employee_form_leave_inherit"/>
|
||||||
<field name="arch" type="xml">
|
<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">
|
<group string="Leaves" position="attributes">
|
||||||
<attribute name="invisible">1</attribute>
|
<attribute name="invisible">1</attribute>
|
||||||
</group>
|
</group>
|
||||||
|
<group string="Leaves" position="after">
|
||||||
|
<group name="holidays" string="Holidays">
|
||||||
|
<field name="holiday_exclude_mass_allocation"/>
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,13 @@ class HrHolidaysStatus(models.Model):
|
|||||||
default='worked')
|
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):
|
class HrHolidays(models.Model):
|
||||||
_inherit = 'hr.holidays'
|
_inherit = 'hr.holidays'
|
||||||
_order = 'type desc, date_from desc'
|
_order = 'type desc, date_from desc'
|
||||||
|
|||||||
@@ -29,8 +29,9 @@ class HrHolidaysMassAllocation(models.TransientModel):
|
|||||||
_description = 'Wizard for mass allocation of holidays'
|
_description = 'Wizard for mass allocation of holidays'
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_all_employees(self):
|
def _default_employees(self):
|
||||||
return self.env['hr.employee'].search([])
|
return self.env['hr.employee'].search([
|
||||||
|
('holiday_exclude_mass_allocation', '=', False)])
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_default_holiday_status(self):
|
def _get_default_holiday_status(self):
|
||||||
@@ -44,7 +45,7 @@ class HrHolidaysMassAllocation(models.TransientModel):
|
|||||||
'hr.holidays.status', string='Leave Type', required=True,
|
'hr.holidays.status', string='Leave Type', required=True,
|
||||||
default=_get_default_holiday_status)
|
default=_get_default_holiday_status)
|
||||||
employee_ids = fields.Many2many(
|
employee_ids = fields.Many2many(
|
||||||
'hr.employee', string='Employees', default=_get_all_employees)
|
'hr.employee', string='Employees', default=_default_employees)
|
||||||
auto_approve = fields.Boolean(
|
auto_approve = fields.Boolean(
|
||||||
string='Automatic Approval', default=True)
|
string='Automatic Approval', default=True)
|
||||||
# size=64 because the name field of hr.holidays is size=64
|
# size=64 because the name field of hr.holidays is size=64
|
||||||
|
|||||||
Reference in New Issue
Block a user