[FIX] rating_project,rating_project_issue: correct domain to see rating

domain from the action is required to avoid seeing empty rating
This commit is contained in:
Jérome Maes
2016-11-02 10:43:49 +01:00
parent 6200e1ac63
commit 95ab053856
2 changed files with 10 additions and 3 deletions
+5 -1
View File
@@ -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):
@@ -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):