summaryrefslogtreecommitdiff
path: root/addons/hr_timesheet/security
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/hr_timesheet/security
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/hr_timesheet/security')
-rw-r--r--addons/hr_timesheet/security/hr_timesheet_security.xml67
-rw-r--r--addons/hr_timesheet/security/ir.model.access.csv7
2 files changed, 74 insertions, 0 deletions
diff --git a/addons/hr_timesheet/security/hr_timesheet_security.xml b/addons/hr_timesheet/security/hr_timesheet_security.xml
new file mode 100644
index 00000000..bbc568f2
--- /dev/null
+++ b/addons/hr_timesheet/security/hr_timesheet_security.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<odoo>
+ <data noupdate="1">
+ <record model="ir.module.category" id="base.module_category_services_timesheets">
+ <field name="description">Helps you manage the timesheets.</field>
+ <field name="sequence">13</field>
+ </record>
+
+ <record id="group_hr_timesheet_user" model="res.groups">
+ <field name="name">See own timesheets</field>
+ <field name="category_id" ref="base.module_category_services_timesheets"/>
+ <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
+ <field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
+ </record>
+
+ <record id="group_hr_timesheet_approver" model="res.groups">
+ <field name="name">Approver</field>
+ <field name="category_id" ref="base.module_category_services_timesheets"/>
+ <field name="implied_ids" eval="[(4, ref('hr_timesheet.group_hr_timesheet_user'))]"/>
+ </record>
+
+ <record id="group_timesheet_manager" model="res.groups">
+ <field name="name">Administrator</field>
+ <field name="category_id" ref="base.module_category_services_timesheets"/>
+ <field name="implied_ids" eval="[(4, ref('hr_timesheet.group_hr_timesheet_approver')), (4, ref('hr.group_hr_user'))]"/>
+ <field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
+ </record>
+
+ <record id="base.default_user" model="res.users">
+ <field name="groups_id" eval="[(4,ref('group_timesheet_manager'))]"/>
+ </record>
+
+ <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),
+ '|', '|',
+ ('project_id.privacy_visibility', '!=', 'followers'),
+ ('project_id.allowed_internal_user_ids', 'in', user.ids),
+ ('task_id.allowed_user_ids', 'in', user.ids)
+ ]</field>
+ <field name="groups" eval="[(4, ref('group_hr_timesheet_user'))]"/>
+ </record>
+
+ <record id="timesheet_line_rule_approver" model="ir.rule">
+ <field name="name">account.analytic.line.timesheet.approver</field>
+ <field name="model_id" ref="analytic.model_account_analytic_line" />
+ <field name="domain_force">[
+ ('project_id', '!=', False),
+ '|',
+ ('project_id.privacy_visibility', '!=', 'followers'),
+ ('project_id.allowed_internal_user_ids', 'in', user.ids)
+ ]</field>
+ <field name="groups" eval="[(4, ref('hr_timesheet.group_hr_timesheet_approver'))]" />
+ </record>
+
+ <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'))]"/>
+ </record>
+
+ </data>
+</odoo>
diff --git a/addons/hr_timesheet/security/ir.model.access.csv b/addons/hr_timesheet/security/ir.model.access.csv
new file mode 100644
index 00000000..db5329a5
--- /dev/null
+++ b/addons/hr_timesheet/security/ir.model.access.csv
@@ -0,0 +1,7 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+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_uom_uom_hr_timesheet,uom.uom.timesheet.user,uom.model_uom_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
+access_project_task_create_timesheet,access.project.task.create.timesheet,model_project_task_create_timesheet,hr_timesheet.group_hr_timesheet_user,1,1,1,0