Skip to content

Commit 1f34284

Browse files
Laurent Stukkens (LTU)simongoffin
authored andcommitted
[FIX] sale_timesheet: fix filtered employees in project overview
This reverts commit 3cf66c4 Prior to this commit: - All employees who's user is an owner of a task of the project were shown in the project overview. After this commit: - Only employees that have a encoded timesheet in the project will be displayed in the project overview. Related PR: odoo#67726 closes odoo#71637 Closes: odoo#71588 X-original-commit: 171c9ec Signed-off-by: Simon Goffin (sig) <[email protected]> Signed-off-by: LTU-Odoo <[email protected]>
1 parent 2088883 commit 1f34284

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

addons/sale_timesheet/models/project_overview.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from dateutil.relativedelta import relativedelta
44
import itertools
55
import json
6-
from odoo.osv import expression
76

87
from odoo import fields, _, models
98
from odoo.osv import expression
@@ -22,24 +21,16 @@ class Project(models.Model):
2221

2322
def _qweb_prepare_qcontext(self, view_id, domain):
2423
values = super()._qweb_prepare_qcontext(view_id, domain)
25-
project_ids = self.env.context.get('active_ids')
26-
if project_ids:
27-
domain = expression.AND([[('id', 'in', project_ids)], domain])
24+
2825
projects = self.search(domain)
2926
values.update(projects._plan_prepare_values())
3027
values['actions'] = projects._plan_prepare_actions(values)
3128

3229
return values
3330

3431
def _plan_get_employee_ids(self):
35-
user_ids = self.env['project.task'].sudo().read_group([('project_id', 'in', self.ids), ('user_id', '!=', False)], ['user_id'], ['user_id'])
36-
user_ids = [user_id['user_id'][0] for user_id in user_ids]
37-
employee_ids = self.env['res.users'].sudo().search_read([('id', 'in', user_ids)], ['employee_ids'])
38-
# flatten the list of list
39-
employee_ids = list(itertools.chain.from_iterable([employee_id['employee_ids'] for employee_id in employee_ids]))
40-
4132
aal_employee_ids = self.env['account.analytic.line'].read_group([('project_id', 'in', self.ids), ('employee_id', '!=', False)], ['employee_id'], ['employee_id'])
42-
employee_ids.extend(list(map(lambda x: x['employee_id'][0], aal_employee_ids)))
33+
employee_ids = list(map(lambda x: x['employee_id'][0], aal_employee_ids))
4334
return employee_ids
4435

4536
def _plan_prepare_values(self):

0 commit comments

Comments
 (0)