Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Timesheet Privacy

By
skhan971@GMAIL.COM
on 8/30/16, 6:42 AM 183 views

we are using Odoo version 9. In the timesheet a user can pick any user and submit timesheet as that user. This option should be only available to Administrators. Can somebody please help out with a solution.


Thanks

0
skhan971@GMAIL.COM
On 9/1/16, 4:20 AM

Will anybody be kind enough to post a reply. We are very much stuck.

0
Jerome Guerriat
On 9/1/16, 6:54 AM

You should change the record rule that allows "write" on a timesheet.

For example, the following rule will allow a user to create, view and update only his own timesheet.

<!-- basic users can only view their timesheets-->
<record model="ir.rule" id="timesheet_users">
<field name="name">Allow users to view only their own timesheets</field>
<field name="model_id" ref="hr_timesheet_sheet.model_hr_timesheet_sheet_sheet"/>
<field name="groups" eval="[(4, ref('base.group_user'))]"/>
<field name="domain_force">['|',('employee_id.user_id','=',user.id),('employee_id','=',False)]</field>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_unlink" eval="False"/>
<field name="perm_create" eval="True"/>
</record>


Since there is now a security rule defined for the timesheets, you should create another rule to give full access for, for example, hr managers:


<!-- HR manager can see all timesheets -->
<record model="ir.rule" id="timesheet_hr_manager">
<field name="name">Allow HR manager to see all timesheets</field>
<field name="model_id" ref="hr_timesheet_sheet.model_hr_timesheet_sheet_sheet"/>
<field name="groups" eval="[(4, ref('base.group_hr_manager'))]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="False"/>
<field name="perm_unlink" eval="False"/>
<field name="perm_create" eval="False"/>
</record>

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 8/30/16, 6:42 AM
Seen: 183 times
Last updated: 9/6/16, 3:27 AM