Files
odoo_source/addons/website_project_issue/controllers/main.py
T
Jairo Llopis a2f0dda366 [FIX] website_portal: redirect to login for '/my' controller
Current issue without this patch:
On a bare database, install `website_portal` and go to `/my/home` logged out.
You get to an empty page where you can see Public User's details.

Expected behavior with this patch:
User should be redirected to the login page.

Additional notes:
- Other submodules (`website_portal_sale` and `website_project_issue`) were
  actually implementing this, so that is removed BTW and relies in base
  module's now sensible behavior.

This commit closes #12775
2016-10-13 16:30:03 +02:00

31 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import http
from openerp.addons.website_portal.controllers.main import website_account
from openerp.http import request
class WebsiteAccount(website_account):
@http.route()
def account(self):
response = super(WebsiteAccount, self).account()
user = request.env.user
# TDE FIXME: shouldn't that be mnaged by the access rule itself ?
# portal projects where you or someone from your company are a follower
project_issues = request.env['project.issue'].sudo().search([
'&',
('project_id.privacy_visibility', '=', 'portal'),
'|',
('message_partner_ids', 'child_of', [user.partner_id.commercial_partner_id.id]),
('message_partner_ids', 'child_of', [user.partner_id.id])
])
response.qcontext.update({'issues': project_issues})
return response
class WebsiteProjectIssue(http.Controller):
@http.route(['/my/issues/<int:issue_id>'], type='http', auth="user", website=True)
def issues_followup(self, issue_id=None):
issue = request.env['project.issue'].browse(issue_id)
return request.website.render("website_project_issue.issues_followup", {'issue': issue})