diff --git a/addons/website_rating_project/controllers/main.py b/addons/website_rating_project/controllers/main.py
index 5031388108c..4d6b3ecb65e 100644
--- a/addons/website_rating_project/controllers/main.py
+++ b/addons/website_rating_project/controllers/main.py
@@ -13,7 +13,7 @@ class WebsiteRatingProject(http.Controller):
@http.route(['/project/rating/'], type='http', auth="public", website=True)
def index(self, **kw):
- projects = request.env['project.project'].sudo().search([('rating_status', '!=', 'no'), ('website_published', '=', True)])
+ projects = request.env['project.project'].sudo().search([('rating_status', '!=', 'no'), ('portal_show_rating', '=', True)])
values = {'projects': projects}
return request.render('website_rating_project.index', values)
@@ -23,7 +23,7 @@ class WebsiteRatingProject(http.Controller):
project = request.env['project.project'].sudo().browse(project_id)
# to avoid giving any access rights on projects to the public user, let's use sudo
# and check if the user should be able to view the project (project managers only if it's unpublished or has no rating)
- if not ((project.rating_status!='no') and project.website_published) and not user.sudo(user).has_group('project.group_project_manager'):
+ if not ((project.rating_status!='no') and project.portal_show_rating) and not user.sudo(user).has_group('project.group_project_manager'):
raise NotFound()
values = {
'project': project,
diff --git a/addons/website_rating_project/models/project.py b/addons/website_rating_project/models/project.py
index ca0df1796b7..da46693fea4 100644
--- a/addons/website_rating_project/models/project.py
+++ b/addons/website_rating_project/models/project.py
@@ -1,27 +1,25 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from odoo import api, models
+from odoo import api, fields, models
class Project(models.Model):
_name = "project.project"
- _inherit = ['project.project', 'website.published.mixin']
+ _inherit = ['project.project']
+
+ portal_show_rating = fields.Boolean('Rating visible in Website', copy=False, oldname='website_published')
@api.multi
def action_view_all_rating(self):
""" Override this method without calling parent to redirect to rating website project page """
self.ensure_one()
- return {
- 'type': 'ir.actions.act_url',
- 'name': "Redirect to the Website Projcet Rating Page",
- 'target': 'self',
- 'url': "/project/rating/%s" % (self.id,)
- }
-
- @api.multi
- def _compute_website_url(self):
- super(Project, self)._compute_website_url()
- for project in self:
- project.website_url = "/project/rating/%s" % project.id
+ if self.portal_show_rating:
+ return {
+ 'type': 'ir.actions.act_url',
+ 'name': "Redirect to the Website Projcet Rating Page",
+ 'target': 'self',
+ 'url': "/project/rating/%s" % (self.id,)
+ }
+ return super(Project, self).action_view_all_rating()
diff --git a/addons/website_rating_project/views/project_project_view.xml b/addons/website_rating_project/views/project_project_view.xml
index 2596109d93c..8c1e21ef147 100644
--- a/addons/website_rating_project/views/project_project_view.xml
+++ b/addons/website_rating_project/views/project_project_view.xml
@@ -1,17 +1,15 @@
+