From ae687dadc072a88f6cdd66fb84a6dd971c97a957 Mon Sep 17 00:00:00 2001 From: sofiagvaladze Date: Fri, 18 Feb 2022 16:13:04 +0000 Subject: [PATCH] [FIX] hr_expense: to give report manager rights and make expense_line_ids editable 1) Now report manager (user_id) (with Team Approver rights) can't see the report. Here we grant him the same rights as the manager (on employee app) of the employee will have. Moreover, he can approve the report as well. 2) Purpose: accountant, manager, should be able to edit expense_line_ids for expense report not only in draft, but also for submitted and approved states. On the other hand, employee can only edit his expense report only in draft state. task - 2768700 closes odoo/odoo#84978 Related: odoo/upgrade#3274 Related: odoo/enterprise#24579 Signed-off-by: Kevin Baptiste --- addons/hr_expense/models/hr_expense.py | 29 ++++++++++++++++---- addons/hr_expense/security/ir_rule.xml | 21 ++++++++++---- addons/hr_expense/views/hr_expense_views.xml | 19 +++++++------ 3 files changed, 49 insertions(+), 20 deletions(-) diff --git a/addons/hr_expense/models/hr_expense.py b/addons/hr_expense/models/hr_expense.py index aeceae67cfd..6f767bb80bd 100644 --- a/addons/hr_expense/models/hr_expense.py +++ b/addons/hr_expense/models/hr_expense.py @@ -577,7 +577,6 @@ Or send your receipts at Team Approver Expense - ['|', '|', '|', + ['|', '|', '|', '|', ('employee_id.user_id', '=', user.id), ('employee_id.department_id.manager_id.user_id', '=', user.id), ('employee_id.parent_id.user_id', '=', user.id), - ('employee_id.expense_manager_id', '=', user.id)] + ('employee_id.expense_manager_id', '=', user.id), + ('sheet_id.user_id', '=', user.id)] @@ -37,19 +38,29 @@ Approver Expense Sheet - ['|', '|', '|', + ['|', '|', '|', '|', ('employee_id.user_id', '=', user.id), ('employee_id.department_id.manager_id.user_id', '=', user.id), ('employee_id.parent_id.user_id', '=', user.id), - ('employee_id.expense_manager_id', '=', user.id)] + ('employee_id.expense_manager_id', '=', user.id), + ('user_id', '=', user.id)] Employee Expense Sheet - [('employee_id.user_id', '=', user.id)] + [('employee_id.user_id', '=', user.id), ('state', '=', 'draft')] + + Employee can't modify expense sheet that is not in draft state + + [('employee_id.user_id', '=', user.id), ('state', '!=', 'draft')] + + + + + Expense multi company rule diff --git a/addons/hr_expense/views/hr_expense_views.xml b/addons/hr_expense/views/hr_expense_views.xml index 8ae129ed136..80261f79f9e 100644 --- a/addons/hr_expense/views/hr_expense_views.xml +++ b/addons/hr_expense/views/hr_expense_views.xml @@ -67,7 +67,7 @@ - + @@ -731,7 +731,7 @@
@@ -745,17 +745,18 @@ - + - + + - - - + + + @@ -768,9 +769,9 @@ - + - +