Ensure timesheet_works return only employee's company works

It can not rely on the record rule to return the right list of works because
user from the admin group does not have the record rule.

issue6505
review40361002
This commit is contained in:
Cédric Krier committed 2017-05-22 18:01:10 +02:00
1 parent 3a98fb87f6
commit 6f26a5f7b2
1 file changed
+3 -1
+3 -1
View File
@@ -33,7 +33,9 @@ def timesheet_works(request, pool, employee):
employee = Employee(employee)
with Transaction().set_context(
company=employee.company.id, employee=employee.id):
works = Work.search([])
works = Work.search([
('company', '=', employee.company.id),
])
return [{
'id': w.id,
'name': w.rec_name,