[MIG]hide_portal_module_by_user:add ticket portal group
This commit is contained in:
@@ -5,7 +5,7 @@ from odoo.http import request
|
||||
from odoo.addons.portal.controllers.portal import CustomerPortal
|
||||
from werkzeug.exceptions import NotFound
|
||||
|
||||
WHITELISTED_ROUTES = ['/my/home', '/my', '/my/account', '/my/security', '/my/payment_method']
|
||||
WHITELISTED_ROUTES = ['/my/invoices','/my/home', '/my', '/my/account', '/my/security', '/my/payment_method']
|
||||
|
||||
|
||||
class CustomerPortalPolicy(CustomerPortal):
|
||||
|
||||
@@ -32,20 +32,25 @@ class IrUiView(models.Model):
|
||||
|
||||
view_xml = etree.fromstring(self.arch)
|
||||
groups_from_view = {}
|
||||
for option in view_xml.xpath("//t[@t-call='portal.portal_docs_entry']"):
|
||||
has_title = option.find("t[@t-set='title']")
|
||||
if has_title is not None:
|
||||
title = has_title.text
|
||||
else:
|
||||
title = self.name
|
||||
xpath_expressions = [
|
||||
"//t[@t-call='portal.portal_docs_entry']",
|
||||
"//t[@t-call='helpdesk_mgmt.portal_docs_entry']",
|
||||
]
|
||||
for xpath_expr in xpath_expressions:
|
||||
for option in view_xml.xpath(xpath_expr):
|
||||
has_title = option.find("t[@t-set='title']")
|
||||
if has_title is not None:
|
||||
title = has_title.text
|
||||
else:
|
||||
title = self.name
|
||||
|
||||
k = _generate_name(title)
|
||||
target_url = option.find("t[@t-set='url']")
|
||||
if target_url is not None:
|
||||
target_url = target_url.get('t-value').replace("'", '')
|
||||
else:
|
||||
raise ValueError(_("No target url found"))
|
||||
groups_from_view[k] = target_url
|
||||
k = _generate_name(title)
|
||||
target_url = option.find("t[@t-set='url']")
|
||||
if target_url is not None:
|
||||
target_url = target_url.get('t-value').replace("'", '')
|
||||
else:
|
||||
raise ValueError(_("No target url found"))
|
||||
groups_from_view[k] = target_url
|
||||
|
||||
search_groups = self.env['res.groups'].sudo().search([('portal_url', 'in', list(groups_from_view.values()))])
|
||||
category_portal_type = self.env.ref('base_portal_type.category_portal_type')
|
||||
|
||||
Reference in New Issue
Block a user