[IMP] hr_holidays: show all employee leaves in Off Today

In the timeoff overview, the "Off Today" filter was only showing leaves
that were occuring on the current day, hiding all the other leaves of
the employee occuring that same period.

Now it will display all the leaves for that period for the employees
that are currently off.

task-3098759

closes odoo/odoo#108290

Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
Kevin Baptiste
2023-01-11 15:38:56 +01:00
parent 0e7c7e4c78
commit b3bc6c08a0
2 changed files with 3 additions and 1 deletions
@@ -33,6 +33,8 @@ class LeaveReportCalendar(models.Model):
is_hatched = fields.Boolean('Hatched', readonly=True)
is_striked = fields.Boolean('Striked', readonly=True)
is_absent = fields.Boolean(related='employee_id.is_absent')
def init(self):
tools.drop_view_if_exists(self._cr, 'hr_leave_report_calendar')
self._cr.execute("""CREATE OR REPLACE VIEW hr_leave_report_calendar AS
@@ -50,7 +50,7 @@
domain="[('employee_id.member_of_department', '=', True)]"
help="My Department"/>
<separator/>
<filter string="Off Today" name="off_today" domain="[('start_datetime', '&lt;=', context_today().strftime('%Y-%m-%d')), ('stop_datetime', '&gt;=', context_today().strftime('%Y-%m-%d'))]" help="My Department"/>
<filter string="Off Today" name="off_today" domain="[('is_absent', '=', True)]" help="Employees Off Today"/>
<separator/>
<filter string="Approved" name="validate" domain="[('state', '=', 'validate')]" help="validate"/>
<filter string="Waiting for Approval" name="approve" domain="[('state','in',('confirm','validate1'))]"/>