summaryrefslogtreecommitdiff
path: root/addons/hr_timesheet/security
diff options
context:
space:
mode:
authorJérome Maes <jem@openerp.com>2017-01-23 10:02:07 +0100
committerThibault Delavallée <tde@odoo.com>2017-04-27 10:34:51 +0200
commita806f96fa26728f85e169516af6808e9156bcff4 (patch)
tree840e80da531b47b3feeba0ad528a81be71f40589 /addons/hr_timesheet/security
parentb6beff86b7e01cff1c63caea7a36bdfa67c50b7f (diff)
[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.
Diffstat (limited to 'addons/hr_timesheet/security')
-rw-r--r--addons/hr_timesheet/security/hr_timesheet_security.xml63
-rw-r--r--addons/hr_timesheet/security/ir.model.access.csv12
2 files changed, 60 insertions, 15 deletions
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 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
- <record id="group_hr_timesheet_user" model="res.groups">
- <field name="name">Officer</field>
- <field name="category_id" ref="base.module_category_hr_timesheet"/>
- <field name="implied_ids" eval="[(4, ref('hr.group_hr_user'))]"/>
- <field name="users" eval="[(4, ref('base.user_root'))]"/>
- </record>
-
- <record id="base.default_user" model="res.users">
- <field name="groups_id" eval="[(4,ref('hr_timesheet.group_hr_timesheet_user'))]"/>
- </record>
+
+ <data noupdate="1">
+
+ <record id="group_hr_timesheet_user" model="res.groups">
+ <field name="name">User</field>
+ <field name="category_id" ref="base.module_category_hr_timesheet"/>
+ <field name="implied_ids" eval="[(4, ref('hr.group_hr_user'))]"/>
+ <field name="users" eval="[(4, ref('base.user_root'))]"/>
+ </record>
+
+ <record id="group_timesheet_manager" model="res.groups">
+ <field name="name">Manager</field>
+ <field name="category_id" ref="base.module_category_hr_timesheet"/>
+ <field name="implied_ids" eval="[(4, ref('group_hr_timesheet_user'))]"/>
+ <field name="users" eval="[(4, ref('base.user_root'))]"/>
+ </record>
+
+ <record id="base.default_user" model="res.users">
+ <field name="groups_id" eval="[(4,ref('group_hr_timesheet_user'))]"/>
+ </record>
+
+ </data>
+
+ <data noupdate="0">
+ <!-- This rule is in noupdate mode because it can be modify by other advanced modules -->
+ <record id="timesheet_line_rule_user" model="ir.rule">
+ <field name="name">account.analytic.line.timesheet.user</field>
+ <field name="model_id" ref="analytic.model_account_analytic_line"/>
+ <field name="domain_force">[('user_id', '=', user.id), ('project_id', '!=', False)]</field>
+ <field name="groups" eval="[(4, ref('group_hr_timesheet_user'))]"/>
+ <field name="perm_create" eval="1"/>
+ <field name="perm_write" eval="1"/>
+ <field name="perm_unlink" eval="1"/>
+ <field name="perm_read" eval="0"/>
+ </record>
+
+ </data>
+
+ <data noupdate="1">
+
+ <record id="timesheet_line_rule_manager" model="ir.rule">
+ <field name="name">account.analytic.line.timesheet.manager</field>
+ <field name="model_id" ref="analytic.model_account_analytic_line"/>
+ <field name="domain_force">[('project_id', '!=', False)]</field>
+ <field name="groups" eval="[(4, ref('group_timesheet_manager'))]"/>
+ <field name="perm_create" eval="1"/>
+ <field name="perm_write" eval="1"/>
+ <field name="perm_unlink" eval="1"/>
+ <field name="perm_read" eval="1"/>
+ </record>
+
+ </data>
+
</odoo> \ 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