[FIX] project: filter projects for Late Milestones filter
Before this commit, when the user uses the `Late Milestones` filter in the project views, all the projects in the views are used, but some projects could have the feature disabled and so those ones should be ignored in the filtered. This commit filters the projects to only apply the filter on those projects and not also the ones without the feature enabled. task-3033041 closes odoo/odoo#105709 X-original-commit: e8ee1e370ec3c6b4bc13d0d5da6b242af1e9b9c3 Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
@@ -500,11 +500,11 @@ class Project(models.Model):
|
||||
for project in self:
|
||||
project.milestone_count_reached = mapped_count.get(project.id, 0)
|
||||
|
||||
@api.depends('milestone_ids', 'milestone_ids.is_reached', 'milestone_ids.deadline')
|
||||
@api.depends('milestone_ids', 'milestone_ids.is_reached', 'milestone_ids.deadline', 'allow_milestones')
|
||||
def _compute_is_milestone_exceeded(self):
|
||||
today = fields.Date.context_today(self)
|
||||
read_group = self.env['project.milestone']._read_group([
|
||||
('project_id', 'in', self.ids),
|
||||
('project_id', 'in', self.filtered('allow_milestones').ids),
|
||||
('is_reached', '=', False),
|
||||
('deadline', '<', today)], ['project_id'], ['project_id'])
|
||||
mapped_count = {group['project_id'][0]: group['project_id_count'] for group in read_group}
|
||||
@@ -523,6 +523,7 @@ class Project(models.Model):
|
||||
FROM project_project P
|
||||
LEFT JOIN project_milestone M ON P.id = M.project_id
|
||||
WHERE M.is_reached IS false
|
||||
AND P.allow_milestones IS true
|
||||
AND M.deadline < CAST(now() AS date)
|
||||
"""
|
||||
if (operator == '=' and value is True) or (operator == '!=' and value is False):
|
||||
|
||||
Reference in New Issue
Block a user