* portal, web_unsplash, website_* This commit renames the `website.group_website_publisher` into `website.group_website_restricted_editor`. While the change in itself might look unuseful, it will help the dev and tech community figuring which group is related to which feature. Even internally when we discuss specs, we always have to remind which group is the restricted editor: the publisher one or the designer one? While it is probably, after all those years, now anchored in some dev mind, there is no easy way to directly figure which of those 2 groups is the restricted editor one. Note that I myself always got confused about it. Now, the "Restricted Editor" right will be reflected in its technical name `group_website_restricted_editor`. Same as for the "Editor & Designer" which technical name is `group_website_designer`. As we would like to have a fully working and ready system in v17 for the community to be able to build themes easily, removing that dubious part is a nice to have. Part-of: odoo/odoo#98200
25 lines
1.0 KiB
Python
25 lines
1.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
from odoo import http
|
|
from odoo.addons.http_routing.models.ir_http import unslug
|
|
from odoo.http import request
|
|
|
|
|
|
class WebsitePartnerPage(http.Controller):
|
|
|
|
# Do not use semantic controller due to SUPERUSER_ID
|
|
@http.route(['/partners/<partner_id>'], type='http', auth="public", website=True)
|
|
def partners_detail(self, partner_id, **post):
|
|
_, partner_id = unslug(partner_id)
|
|
if partner_id:
|
|
partner_sudo = request.env['res.partner'].sudo().browse(partner_id)
|
|
is_website_restricted_editor = request.env['res.users'].has_group('website.group_website_restricted_editor')
|
|
if partner_sudo.exists() and (partner_sudo.website_published or is_website_restricted_editor):
|
|
values = {
|
|
'main_object': partner_sudo,
|
|
'partner': partner_sudo,
|
|
'edit_page': False
|
|
}
|
|
return request.render("website_partner.partner_page", values)
|
|
return request.not_found()
|