[IMP] hr_holidays: Display leaves in calendar
Purpose ======= When a leave is created and approved, it can also create a meeting in the calendar. In the leave type configuration a particular meeting type can be chosen. The purpose is to simplify this. Specification ============= Remove the choice of meeting type. The choice should be: Display Leaves in calendar: Yes/No (checkox)
This commit is contained in:
committed by
Yannick Tivisse
parent
95564bcd2c
commit
22cd306b2c
@@ -603,7 +603,7 @@ class HolidaysRequest(models.Model):
|
||||
by creating a calendar event and a resource time off. """
|
||||
holidays = self.filtered(lambda request: request.holiday_type == 'employee')
|
||||
holidays._create_resource_leave()
|
||||
for holiday in holidays:
|
||||
for holiday in holidays.filtered(lambda l: l.holiday_status_id.create_calendar_meeting):
|
||||
meeting_values = holiday._prepare_holidays_meeting_values()
|
||||
meeting = self.env['calendar.event'].with_context(no_mail_to_attendees=True).create(meeting_values)
|
||||
holiday.write({'meeting_id': meeting.id})
|
||||
@@ -614,8 +614,6 @@ class HolidaysRequest(models.Model):
|
||||
calendar = self.employee_id.resource_calendar_id or self.env.company.resource_calendar_id
|
||||
meeting_values = {
|
||||
'name': self.display_name,
|
||||
'categ_ids': [(6, 0, [
|
||||
self.holiday_status_id.categ_id.id])] if self.holiday_status_id.categ_id else [],
|
||||
'duration': self.number_of_days * (calendar.hours_per_day or HOURS_PER_DAY),
|
||||
'description': self.notes,
|
||||
'user_id': self.user_id.id,
|
||||
|
||||
@@ -26,9 +26,7 @@ class HolidaysType(models.Model):
|
||||
code = fields.Char('Code')
|
||||
sequence = fields.Integer(default=100,
|
||||
help='The type with the smallest sequence is the default value in time off request')
|
||||
categ_id = fields.Many2one(
|
||||
'calendar.event.type', string='Meeting Type',
|
||||
help='Once a time off is validated, Odoo will create a corresponding meeting of this type in the calendar.')
|
||||
create_calendar_meeting = fields.Boolean(string="Display Time Off in Calendar", default=True)
|
||||
color_name = fields.Selection([
|
||||
('red', 'Red'),
|
||||
('blue', 'Blue'),
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<search string="Search Time Off Type">
|
||||
<field name="name" string="Time Off Types"/>
|
||||
<field name="code"/>
|
||||
<field name="categ_id"/>
|
||||
<field name="create_calendar_meeting"/>
|
||||
<separator/>
|
||||
<filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
|
||||
</search>
|
||||
@@ -70,7 +70,7 @@
|
||||
</group>
|
||||
</group>
|
||||
<group name="calendar" string="Calendar" groups="base.group_no_one">
|
||||
<field name="categ_id"/>
|
||||
<field name="create_calendar_meeting"/>
|
||||
<field name="color_name"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
</group>
|
||||
|
||||
Reference in New Issue
Block a user