You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
898 B
22 lines
898 B
# Copyright 2021 Tecnativa - David Vidal
|
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
|
from odoo.addons.portal.controllers.portal import CustomerPortal
|
|
from odoo.http import request, route
|
|
|
|
|
|
class PortalBlockEdit(CustomerPortal):
|
|
|
|
def _prepare_portal_layout_values(self):
|
|
"""So we can change the edit link text in the view"""
|
|
values = super()._prepare_portal_layout_values()
|
|
values["block_portal_data_edit"] = (
|
|
request.env.user.block_portal_data_edit)
|
|
return values
|
|
|
|
@route()
|
|
def account(self, redirect=None, **post):
|
|
"""Inject a context that we later we catch in the template `render`"""
|
|
if request.env.user.block_portal_data_edit:
|
|
context = dict(request.env.context, block_portal_data_edit=True)
|
|
request.env.context = context
|
|
return super().account(redirect, **post)
|