diff --git a/addons/hr/views/hr_employee_views.xml b/addons/hr/views/hr_employee_views.xml index a3e977df1e6..f614a37a749 100644 --- a/addons/hr/views/hr_employee_views.xml +++ b/addons/hr/views/hr_employee_views.xml @@ -10,7 +10,6 @@ - diff --git a/addons/hr_expense/models/hr_expense.py b/addons/hr_expense/models/hr_expense.py index 3487c9c7b30..a39efa59ab9 100644 --- a/addons/hr_expense/models/hr_expense.py +++ b/addons/hr_expense/models/hr_expense.py @@ -941,7 +941,7 @@ class HrExpenseSheet(models.Model): for sheet in self: sheet.expense_number = result.get(sheet.id, 0) - @api.depends('employee_id') + @api.depends('employee_id', 'employee_id.department_id') def _compute_from_employee_id(self): for sheet in self: sheet.address_id = sheet.employee_id.sudo().address_home_id diff --git a/addons/hr_holidays/models/hr_department.py b/addons/hr_holidays/models/hr_department.py index d3499f6cc48..b08dbee9b40 100644 --- a/addons/hr_holidays/models/hr_department.py +++ b/addons/hr_holidays/models/hr_department.py @@ -46,3 +46,27 @@ class Department(models.Model): department.leave_to_approve_count = res_leave.get(department.id, 0) department.allocation_to_approve_count = res_allocation.get(department.id, 0) department.absence_of_today = res_absence.get(department.id, 0) + + def _get_action_context(self): + return { + 'search_default_approve': 1, + 'search_default_active_employee': 2, + 'search_default_department_id': self.id, + 'default_department_id': self.id, + } + + def action_open_leave_department(self): + action = self.env["ir.actions.actions"]._for_xml_id("hr_holidays.hr_leave_action_action_approve_department") + action['context'] = { + **self._get_action_context(), + 'search_default_active_time_off': 3, + 'hide_employee_name': 1, + 'holiday_status_name_get': False + } + return action + + def action_open_allocation_department(self): + action = self.env["ir.actions.actions"]._for_xml_id("hr_holidays.hr_leave_allocation_action_approve_department") + action['context'] = self._get_action_context() + action['context']['search_default_second_approval'] = 3 + return action diff --git a/addons/hr_holidays/views/hr_leave_allocation_views.xml b/addons/hr_holidays/views/hr_leave_allocation_views.xml index 1cfeb827dc3..7254e35e9bb 100644 --- a/addons/hr_holidays/views/hr_leave_allocation_views.xml +++ b/addons/hr_holidays/views/hr_leave_allocation_views.xml @@ -31,7 +31,6 @@ - - diff --git a/addons/hr_holidays/views/hr_views.xml b/addons/hr_holidays/views/hr_views.xml index a41d5673726..7f1066a6734 100644 --- a/addons/hr_holidays/views/hr_views.xml +++ b/addons/hr_holidays/views/hr_views.xml @@ -7,7 +7,7 @@ kanban,tree,form { 'search_default_is_absent': 1, - 'searchpanel_default_department_id': active_id, + 'search_default_department_id': active_id, 'default_department_id': active_id} @@ -33,14 +33,14 @@