From 95ab053856defc8b66fbb657ceb4b3654c1b653b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Maes?= Date: Mon, 24 Oct 2016 17:24:47 +0200 Subject: [PATCH] [FIX] rating_project,rating_project_issue: correct domain to see rating domain from the action is required to avoid seeing empty rating --- addons/rating_project/models/project.py | 6 +++++- addons/rating_project_issue/models/project_issue.py | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/addons/rating_project/models/project.py b/addons/rating_project/models/project.py index 69fb394e93a..5f992ce0c73 100644 --- a/addons/rating_project/models/project.py +++ b/addons/rating_project/models/project.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- from datetime import timedelta + from openerp import api, fields, models, _ +from odoo.tools.safe_eval import safe_eval class ProjectTaskType(models.Model): @@ -101,7 +103,9 @@ class Project(models.Model): def action_view_task_rating(self): """ return the action to see all the rating about the tasks of the project """ action = self.env['ir.actions.act_window'].for_xml_id('rating', 'action_view_rating') - return dict(action, domain=[('res_id', 'in', self.tasks.ids), ('res_model', '=', 'project.task')]) + action_domain = safe_eval(action['domain']) if action['domain'] else [] + domain = action_domain + [('res_id', 'in', self.tasks.ids), ('res_model', '=', 'project.task')] + return dict(action, domain=domain) @api.multi def action_view_all_rating(self): diff --git a/addons/rating_project_issue/models/project_issue.py b/addons/rating_project_issue/models/project_issue.py index 26c23e1fb06..781234f4ffa 100644 --- a/addons/rating_project_issue/models/project_issue.py +++ b/addons/rating_project_issue/models/project_issue.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- from datetime import timedelta + from openerp import api, fields, models +from odoo.tools.safe_eval import safe_eval class ProjectIssue(models.Model): @@ -25,7 +27,6 @@ class ProjectIssue(models.Model): return super(ProjectIssue, self).rating_apply(rate, token=token, feedback=feedback, subtype="rating_project_issue.mt_issue_rating") - class Stage(models.Model): _inherit = ['project.task.type'] @@ -74,7 +75,9 @@ class Project(models.Model): """ return the action to see all the rating about the issues of the project """ action = self.env['ir.actions.act_window'].for_xml_id('rating', 'action_view_rating') issues = self.env['project.issue'].search([('project_id', 'in', self.ids)]) - return dict(action, domain=[('res_id', 'in', issues.ids), ('res_model', '=', 'project.issue')]) + action_domain = safe_eval(action['domain']) if action['domain'] else [] + domain = action_domain + [('res_id', 'in', issues.ids), ('res_model', '=', 'project.issue')] + return dict(action, domain=domain) @api.multi def action_view_all_rating(self):