diff --git a/base_search_mail_content/__manifest__.py b/base_search_mail_content/__manifest__.py index 1eeeb8f05..730c21544 100644 --- a/base_search_mail_content/__manifest__.py +++ b/base_search_mail_content/__manifest__.py @@ -6,7 +6,7 @@ { "name": "Base Search Mail Content", - "version": "15.0.1.0.1", + "version": "16.0.1.0.1", "author": "ForgeFlow, SerpentCS, Tecnativa, Odoo Community Association (OCA)", "website": "https://github.com/OCA/social", "category": "Social", diff --git a/base_search_mail_content/models/mail_thread.py b/base_search_mail_content/models/mail_thread.py index f62e1c5dc..43a57df70 100644 --- a/base_search_mail_content/models/mail_thread.py +++ b/base_search_mail_content/models/mail_thread.py @@ -6,7 +6,7 @@ from lxml import etree -from odoo import _, api, fields, models +from odoo import api, fields, models from odoo.osv import expression @@ -38,21 +38,14 @@ class MailThread(models.AbstractModel): self.message_content = False @api.model - def fields_view_get( - self, view_id=None, view_type="form", toolbar=False, submenu=False - ): + def get_view(self, view_id=None, view_type="form", **options): """ Override to add message_content field in all the objects that inherits mail.thread """ - res = super(MailThread, self).fields_view_get( - view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu - ) + res = super().get_view(view_id=view_id, view_type=view_type, options=options) if view_type == "search" and self._fields.get("message_content"): doc = etree.XML(res["arch"]) - res["fields"].update( - {"message_content": {"type": "char", "string": _("Message Content")}} - ) for node in doc.xpath("/search/field[last()]"): # Add message_content in search view elem = etree.Element("field", {"name": "message_content"}) diff --git a/base_search_mail_content/tests/test_base_search_mail_content.py b/base_search_mail_content/tests/test_base_search_mail_content.py index 2cbd3bd34..b745fed98 100644 --- a/base_search_mail_content/tests/test_base_search_mail_content.py +++ b/base_search_mail_content/tests/test_base_search_mail_content.py @@ -14,12 +14,12 @@ class TestBaseSearchMailContent(TransactionCase): self.assertFalse(res, "You have a channel with xxxyyyzzz :O") def test_base_search_mail_content_2(self): - res = self.channel_obj.load_views( + res = self.channel_obj.get_views( [[False, "search"]], {"load_fields": False, "load_filters": True, "toolbar": True}, ) self.assertIn( "message_content", - res["fields_views"]["search"]["fields"], + res["models"]["mail.channel"], "message_content field was not detected", )