mirror of https://github.com/OCA/social.git
[FIX] base_search_mail_content: Don't fail on views with searchpanel
On views with a searchpanel, xpath `//field[last()]` may select an element inside the search panel, provoking the error "Only types ['many2one'] are supported for category (found type text)". This fix uses an stricter xpath for avoiding this situation. TT25796pull/623/head
parent
7d46924b29
commit
c0e0964880
|
@ -50,8 +50,7 @@ class MailThread(models.AbstractModel):
|
|||
res["fields"].update(
|
||||
{"message_content": {"type": "char", "string": _("Message Content")}}
|
||||
)
|
||||
|
||||
for node in doc.xpath("//field[last()]"):
|
||||
for node in doc.xpath("/search/field[last()]"):
|
||||
# Add message_content in search view
|
||||
elem = etree.Element("field", {"name": "message_content"})
|
||||
node.addnext(elem)
|
||||
|
|
Loading…
Reference in New Issue