From a806f96fa26728f85e169516af6808e9156bcff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Maes?= Date: Mon, 23 Jan 2017 10:02:07 +0100 Subject: [PATCH] [IMP] hr_timesheet: ease time tracking use of timesheets Purpose of timesheet module is to track user time. This commit applies various improvements and tweaking to better reflect this purpose. This commit provides some UI improvements * improve views : user_id field is not displayed on 'My Timesheet' action, since it will always be the same user; * simplify menus : 'My timesheet' only for current user's timesheets and 'All timesheet' for everyone's. The latter one allows creating timesheets for someone else, if you have the required access rights; * add calendar views for timesheets * some filters are added to ease time-based filtering of timesheets This commit also reorganizes user groups. Groups are now * new 'timesheet user' group (different from base.group_employee). Users can record their own timesheet. New access rights were added to perform the same operations as before. * 'timesheet manager' (hr_timesheet.group_manager). Users can record timesheets for other users, access to settings and reporting tools. --- .../hr_timesheet_config_settings_views.xml | 2 +- addons/hr_timesheet/hr_timesheet_view.xml | 181 +++++++++++++++--- .../report/hr_timesheet_report_view.xml | 11 +- .../security/hr_timesheet_security.xml | 61 +++++- .../hr_timesheet/security/ir.model.access.csv | 12 +- 5 files changed, 220 insertions(+), 47 deletions(-) diff --git a/addons/hr_timesheet/hr_timesheet_config_settings_views.xml b/addons/hr_timesheet/hr_timesheet_config_settings_views.xml index 98f88b484b3..0553cbfddca 100644 --- a/addons/hr_timesheet/hr_timesheet_config_settings_views.xml +++ b/addons/hr_timesheet/hr_timesheet_config_settings_views.xml @@ -1,7 +1,7 @@ + groups="group_timesheet_manager" sequence="100"/> hr.timesheet.config.settings.view.form diff --git a/addons/hr_timesheet/hr_timesheet_view.xml b/addons/hr_timesheet/hr_timesheet_view.xml index ba1b9c54e4e..95f3d8617d0 100644 --- a/addons/hr_timesheet/hr_timesheet_view.xml +++ b/addons/hr_timesheet/hr_timesheet_view.xml @@ -1,23 +1,47 @@ - - + + + + account.analytic.line.tree.hr_timesheet account.analytic.line - + - - + + + + account.analytic.line.view.tree.with.user + account.analytic.line + + primary + 10 + + + + + + + account.analytic.line.pivot account.analytic.line @@ -29,18 +53,58 @@ + - account.analytic.line.form.inherit.hr_timesheet + account.analytic.line.form account.analytic.line - - primary + 1 + - - - - +
+ + + + + + + + + + + + + + + + +
+ + + account.analytic.line.tree.with.user + account.analytic.line + + primary + 10 + + + + + + + + + account.analytic.line.calendar + account.analytic.line + + + + + + + + account.analytic.line.search account.analytic.line @@ -51,23 +115,39 @@ - + + + + - - - - - + + + + + - Activities + My Timesheets account.analytic.line - [('project_id', '!=', False)] - {"search_default_today":1} + tree,form + [('project_id', '!=', False), ('user_id', '=', uid)] + {"search_default_week":1}

@@ -80,22 +160,65 @@ - + tree - 1 - + + - + form - 2 - + + - + + + calendar + + + + + + + + All Timesheets + account.analytic.line + + [('project_id', '!=', False)] + {'search_default_week':1, 'search_default_groupby_user':1} + + + + + tree + + + + + + + form + + + + + + + calendar + + + + + diff --git a/addons/hr_timesheet/report/hr_timesheet_report_view.xml b/addons/hr_timesheet/report/hr_timesheet_report_view.xml index 1764a44cc8c..66e20b6bfcd 100644 --- a/addons/hr_timesheet/report/hr_timesheet_report_view.xml +++ b/addons/hr_timesheet/report/hr_timesheet_report_view.xml @@ -38,10 +38,15 @@ + - - diff --git a/addons/hr_timesheet/security/hr_timesheet_security.xml b/addons/hr_timesheet/security/hr_timesheet_security.xml index 1a95247cf0b..23d20ea4fd4 100644 --- a/addons/hr_timesheet/security/hr_timesheet_security.xml +++ b/addons/hr_timesheet/security/hr_timesheet_security.xml @@ -1,13 +1,56 @@ - - Officer - - - - - - - + + + + User + + + + + + + Manager + + + + + + + + + + + + + + + account.analytic.line.timesheet.user + + [('user_id', '=', user.id), ('project_id', '!=', False)] + + + + + + + + + + + + + account.analytic.line.timesheet.manager + + [('project_id', '!=', False)] + + + + + + + + + \ No newline at end of file diff --git a/addons/hr_timesheet/security/ir.model.access.csv b/addons/hr_timesheet/security/ir.model.access.csv index 61f85fb401e..e9f8ce09b30 100644 --- a/addons/hr_timesheet/security/ir.model.access.csv +++ b/addons/hr_timesheet/security/ir.model.access.csv @@ -1,6 +1,8 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_hr_account_analytic_line,analytic.account.analytic.line,analytic.model_account_analytic_line,hr_timesheet.group_hr_timesheet_user,1,1,1,1 -access_hr_account_analytic_line_employee,analytic.account.analytic.line employee,analytic.model_account_analytic_line,base.group_user,1,1,1,1 -access_product_product_user,product.product user,product.model_product_product,hr_timesheet.group_hr_timesheet_user,1,1,1,1 -access_product_template_hr_timesheet,product.template.hr.timesheet,product.model_product_template,hr_timesheet.group_hr_timesheet_user,1,1,1,1 -access_product_uom_hr_timesheet,product.uom.hr.timesheet,product.model_product_uom,hr_timesheet.group_hr_timesheet_user,1,1,1,1 +access_account_analytic_line_user,analytic.account.analytic.line.timesheet.user,analytic.model_account_analytic_line,hr_timesheet.group_hr_timesheet_user,1,1,1,1 +access_account_analytic_user,analytic.account.analytic.timesheet.user,analytic.model_account_analytic_account,hr_timesheet.group_hr_timesheet_user,1,1,0,0 +access_product_product_user,product.product.timesheet.user,product.model_product_product,hr_timesheet.group_hr_timesheet_user,1,1,1,0 +access_product_template_timesheet_user,product.template.timesheet.user,product.model_product_template,hr_timesheet.group_hr_timesheet_user,1,1,1,0 +access_product_uom_hr_timesheet,product.uom.timesheet.user,product.model_product_uom,hr_timesheet.group_hr_timesheet_user,1,0,0,0 +access_project_project,project.project.timesheet.user,model_project_project,hr_timesheet.group_hr_timesheet_user,1,0,0,0 +access_project_task,project.task.timesheet.user,model_project_task,hr_timesheet.group_hr_timesheet_user,1,1,0,0 \ No newline at end of file