[FIX] Allow messsage_content search only for internal users

pull/1205/head
Aungkokolin1997 2023-08-21 08:29:40 +06:30
parent db0e34a8cd
commit 6f71b6b585
1 changed files with 5 additions and 1 deletions

View File

@ -44,7 +44,11 @@ class MailThread(models.AbstractModel):
that inherits mail.thread
"""
res = super().get_view(view_id=view_id, view_type=view_type, options=options)
if view_type == "search" and self._fields.get("message_content"):
if (
view_type == "search"
and self._fields.get("message_content")
and self.env.user.has_group("base.group_user")
):
doc = etree.XML(res["arch"])
for node in doc.xpath("/search/field[last()]"):
# Add message_content in search view