[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: #67726
closes odoo/odoo#71638
Closes: #71588
X-original-commit: 171c9ec7242bd12d7a304e61eb7908aaae18b531
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
This commit is contained in:
committed by
Goffin Simon
parent
de5be74db5
commit
0b2315c211
@@ -3,7 +3,6 @@ import babel.dates
|
||||
from dateutil.relativedelta import relativedelta
|
||||
import itertools
|
||||
import json
|
||||
from odoo.osv import expression
|
||||
|
||||
from odoo import fields, _, models
|
||||
from odoo.osv import expression
|
||||
@@ -22,9 +21,7 @@ class Project(models.Model):
|
||||
|
||||
def _qweb_prepare_qcontext(self, view_id, domain):
|
||||
values = super()._qweb_prepare_qcontext(view_id, domain)
|
||||
project_ids = self.env.context.get('active_ids')
|
||||
if project_ids:
|
||||
domain = expression.AND([[('id', 'in', project_ids)], domain])
|
||||
|
||||
projects = self.search(domain)
|
||||
values.update(projects._plan_prepare_values())
|
||||
values['actions'] = projects._plan_prepare_actions(values)
|
||||
@@ -32,14 +29,8 @@ class Project(models.Model):
|
||||
return values
|
||||
|
||||
def _plan_get_employee_ids(self):
|
||||
user_ids = self.env['project.task'].sudo().read_group([('project_id', 'in', self.ids), ('user_id', '!=', False)], ['user_id'], ['user_id'])
|
||||
user_ids = [user_id['user_id'][0] for user_id in user_ids]
|
||||
employee_ids = self.env['res.users'].sudo().search_read([('id', 'in', user_ids)], ['employee_ids'])
|
||||
# flatten the list of list
|
||||
employee_ids = list(itertools.chain.from_iterable([employee_id['employee_ids'] for employee_id in employee_ids]))
|
||||
|
||||
aal_employee_ids = self.env['account.analytic.line'].read_group([('project_id', 'in', self.ids), ('employee_id', '!=', False)], ['employee_id'], ['employee_id'])
|
||||
employee_ids.extend(list(map(lambda x: x['employee_id'][0], aal_employee_ids)))
|
||||
employee_ids = list(map(lambda x: x['employee_id'][0], aal_employee_ids))
|
||||
return employee_ids
|
||||
|
||||
def _plan_prepare_values(self):
|
||||
|
||||
Reference in New Issue
Block a user