Files
odoo_source/addons/website_rating_project/models/project.py
T
Jérome Maes f9d09411ab [IMP] website_rating_project: website published mixin usage
'project.project' should not use 'website.published.mixin',
since we don't want to publish a project on the website.
All we want is to display the rating of a project, nothing
more. So, a flag on project is enought to allow the publication.
2017-08-16 14:56:42 +02:00

26 lines
868 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class Project(models.Model):
_name = "project.project"
_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()
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()