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.

1

Record Rule

By
Susi
on 6/23/16, 12:47 AM 307 views

Hi all

i have create record rule for object 'hr_timesheet_sheet.sheet' Form Timesheet

with domain [('user_id', '=', user.id)] 
create =1

write=1

update=1

delete = 1


its success with show only record by user_id the same. but when the user create in form Timesheet there is a warning like this


ValidateError
Field(s) `date_from, date_to` failed against a constraint: You cannot have 2 timesheets that overlap!
Please use the menu 'My Current Timesheet' to avoid this problem.
Error details:
AccessError
The requested operation cannot be completed due to security restrictions. Please contact your system administrator.
(Document type: hr_timesheet_sheet.sheet, Operation: read)

but when i non active record rule for that form its successfully saved. anyone can explain why it could happen ? or maybe there is something wrong with the record rule that I create ?

Thanks !

1

Ahmed M.Elmubarak

--Ahmed M.Elmubarak--
2988
| 5 3 5
Sudan
--Ahmed M.Elmubarak--


Ahmed M.Elmubarak
On 6/23/16, 3:16 AM

Hello,

Try to modify your rule to be as:

 ['|', ('user_id', '=', False),('user_id', '=', user.id)] 

Hope this could help ...

its work !! :) thanks a lot

Susi
on 6/23/16, 3:20 AM

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: 6/23/16, 12:47 AM
Seen: 307 times
Last updated: 6/23/16, 3:20 AM