From 145853c9c753e4047b64e2415ecf1602de44520a Mon Sep 17 00:00:00 2001 From: dbh Date: Wed, 22 Mar 2017 14:08:57 +0100 Subject: [PATCH] [IMP] rating,rating_project,livechat: primary views Rating is used on different objects that don't have the same business needs. We want rating module to provide the common needs (filter, views, basic actions, ...) and other module will extends these basic tools to complete their specific business needs. --- addons/im_livechat/__manifest__.py | 1 + addons/im_livechat/views/rating_views.xml | 30 ++++++++++ addons/rating_project/models/project.py | 2 +- addons/rating_project/views/project_view.xml | 58 +++++++++++++------ .../models/project_issue.py | 2 +- .../views/project_issue_view.xml | 3 +- 6 files changed, 76 insertions(+), 20 deletions(-) create mode 100644 addons/im_livechat/views/rating_views.xml diff --git a/addons/im_livechat/__manifest__.py b/addons/im_livechat/__manifest__.py index 9f1f28877de..b7b2517a956 100644 --- a/addons/im_livechat/__manifest__.py +++ b/addons/im_livechat/__manifest__.py @@ -21,6 +21,7 @@ Help your customers with this chat, and analyse their feedback. 'data': [ "security/im_livechat_channel_security.xml", "security/ir.model.access.csv", + "views/rating_views.xml", "views/mail_channel_views.xml", "views/im_livechat_channel_views.xml", "views/im_livechat_channel_templates.xml", diff --git a/addons/im_livechat/views/rating_views.xml b/addons/im_livechat/views/rating_views.xml new file mode 100644 index 00000000000..01d86015de5 --- /dev/null +++ b/addons/im_livechat/views/rating_views.xml @@ -0,0 +1,30 @@ + + + + + rating.rating.search.livechat + rating.rating + + primary + + + + + + + + + + Ratings for livechat channel + rating.rating + kanban,tree,graph,pivot,form + [('consumed','=',True)] + + +

+ There is no rating for this object at the moment. +

+
+
+ +
diff --git a/addons/rating_project/models/project.py b/addons/rating_project/models/project.py index fda4cc15220..b7a5a47210e 100644 --- a/addons/rating_project/models/project.py +++ b/addons/rating_project/models/project.py @@ -111,7 +111,7 @@ class Project(models.Model): @api.multi 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') + action = self.env['ir.actions.act_window'].for_xml_id('rating_project', 'rating_rating_action_view_project_rating') action_domain = safe_eval(action['domain']) if action['domain'] else [] domain = ['&', ('res_id', 'in', self.tasks.ids), ('res_model', '=', 'project.task')] if action_domain: diff --git a/addons/rating_project/views/project_view.xml b/addons/rating_project/views/project_view.xml index 4104f2d94d7..b0d4c9e5b10 100644 --- a/addons/rating_project/views/project_view.xml +++ b/addons/rating_project/views/project_view.xml @@ -2,27 +2,46 @@ - - Customer Ratings - rating.rating - kanban,tree,pivot,graph,form - [('res_model', '=', 'project.task'), ('res_id', '=', active_id), ('consumed', '=', True)] - -

- Customer ratings on tasks. If you have no rating, change your project Settings to activate it. -

-
-
- - - rating.rating.search.inherit + + rating.rating.search.project rating.rating - + + primary + + + + + + + + + Rating + rating.rating + kanban,tree,graph,pivot,form + [('consumed','=',True)] + + +

+ There is no rating for this object at the moment. +

+
+
+ + + Customer Ratings from task + rating.rating + kanban,tree,pivot,graph,form + [('res_model', '=', 'project.task'), ('res_id', '=', active_id), ('consumed', '=', True)] + + +

+ Customer ratings on tasks. If you have no rating, change your project Settings to activate it. +

@@ -149,18 +168,23 @@
- + Customer Ratings rating.rating kanban,tree,pivot,graph,form [('parent_res_model','=','project.project'), ('consumed', '=', True)] +

Customer ratings on tasks/issues. If you have no rating, change your project Settings to activate it.

- + +
diff --git a/addons/rating_project_issue/models/project_issue.py b/addons/rating_project_issue/models/project_issue.py index 00b5143b84b..d055d630dbf 100644 --- a/addons/rating_project_issue/models/project_issue.py +++ b/addons/rating_project_issue/models/project_issue.py @@ -82,7 +82,7 @@ class Project(models.Model): @api.multi def action_view_issue_rating(self): """ 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') + action = self.env['ir.actions.act_window'].for_xml_id('rating_project', 'rating_rating_action_view_project_rating') issues = self.env['project.issue'].search([('project_id', 'in', self.ids)]) action_domain = safe_eval(action['domain']) if action['domain'] else [] domain = ['&', ('res_id', 'in', issues.ids), ('res_model', '=', 'project.issue')] diff --git a/addons/rating_project_issue/views/project_issue_view.xml b/addons/rating_project_issue/views/project_issue_view.xml index 99e1231adfa..ea0db1b0cbc 100644 --- a/addons/rating_project_issue/views/project_issue_view.xml +++ b/addons/rating_project_issue/views/project_issue_view.xml @@ -7,6 +7,7 @@ rating.rating kanban,tree,pivot,graph,form [('res_model','=','project.issue'),('res_id','=',active_id), ('consumed', '=', True)] +

Customer ratings on issues. If you have no rating, change your project Settings to activate it. @@ -17,7 +18,7 @@ rating.rating.search.inherit rating.rating - +