From a83af8780c840a1291ddafba6c4f454dd998f95a Mon Sep 17 00:00:00 2001 From: William Braeckman Date: Wed, 30 Jun 2021 09:27:46 +0000 Subject: [PATCH] [IMP] hr,hr_presence: presence report ux improvements Previously all buttons would be displayed in a single row, this commit changes it to two rows. Also the bottom half of the button was unclickable due to an invisible div, fixed with css. Another button has been added to undo a manual presence state. Task ID: 2584198 closes odoo/odoo#72976 Signed-off-by: Kevin Baptiste --- addons/hr/static/src/scss/hr.scss | 8 +++++++ addons/hr/views/hr_employee_views.xml | 22 +++++++++---------- addons/hr_presence/models/hr_employee.py | 10 +++++++-- .../hr_presence/views/hr_employee_views.xml | 9 +++++--- 4 files changed, 33 insertions(+), 16 deletions(-) diff --git a/addons/hr/static/src/scss/hr.scss b/addons/hr/static/src/scss/hr.scss index 685edaa8713..9fd33d11023 100644 --- a/addons/hr/static/src/scss/hr.scss +++ b/addons/hr/static/src/scss/hr.scss @@ -28,6 +28,14 @@ margin-right: -3px; } + .o_hr_employee_kanban_bottom { + //Prevent bottom row from preventing to click on buttons + pointer-events: none; + .oe_kanban_bottom_right { + pointer-events: auto; + } + } + } .o_kanban_dashboard.o_hr_department_kanban { diff --git a/addons/hr/views/hr_employee_views.xml b/addons/hr/views/hr_employee_views.xml index 286e3e37469..ada86f70f9c 100644 --- a/addons/hr/views/hr_employee_views.xml +++ b/addons/hr/views/hr_employee_views.xml @@ -307,17 +307,17 @@
  • -
    -
    -
    -
    - -
    - -
    -
    -
    -
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    diff --git a/addons/hr_presence/models/hr_employee.py b/addons/hr_presence/models/hr_employee.py index 3da6c9f583c..256586e4ba6 100644 --- a/addons/hr_presence/models/hr_employee.py +++ b/addons/hr_presence/models/hr_employee.py @@ -114,10 +114,16 @@ class Employee(models.AbstractModel): 'searchpanel_default_hr_presence_state_display': 'to_define'}, } - def action_set_present(self): + def _action_set_manual_presence(self, state): if not self.env.user.has_group('hr.group_hr_manager'): raise UserError(_("You don't have the right to do this. Please contact an Administrator.")) - self.write({'manually_set_present': True}) + self.write({'manually_set_present': state}) + + def action_set_present(self): + self._action_set_manual_presence(True) + + def action_set_absent(self): + self._action_set_manual_presence(False) def write(self, vals): if vals.get('hr_presence_state_display') == 'present': diff --git a/addons/hr_presence/views/hr_employee_views.xml b/addons/hr_presence/views/hr_employee_views.xml index cdb7d514141..68b66536287 100644 --- a/addons/hr_presence/views/hr_employee_views.xml +++ b/addons/hr_presence/views/hr_employee_views.xml @@ -38,13 +38,16 @@ 0 -
    -
    +
    +
    + +
    +
    - +