From 8daa91853aca665f12514b406f63c3c1dd8f5d3b Mon Sep 17 00:00:00 2001 From: cubells Date: Tue, 12 Jun 2018 11:29:26 +0200 Subject: [PATCH] Update help inheritance, remove views and edit README --- base_search_mail_content/__manifest__.py | 5 ++-- base_search_mail_content/models/__init__.py | 1 + base_search_mail_content/models/trgm_index.py | 18 +++++++++++++ base_search_mail_content/readme/INSTALL.rst | 2 +- .../views/trgm_index_view.xml | 27 ------------------- 5 files changed, 23 insertions(+), 30 deletions(-) create mode 100644 base_search_mail_content/models/trgm_index.py delete mode 100644 base_search_mail_content/views/trgm_index_view.xml diff --git a/base_search_mail_content/__manifest__.py b/base_search_mail_content/__manifest__.py index 3b0be4ad4f..5765b59799 100644 --- a/base_search_mail_content/__manifest__.py +++ b/base_search_mail_content/__manifest__.py @@ -12,8 +12,9 @@ "Odoo Community Association (OCA)", "website": "https://github.com/OCA/social", "category": "Social", - "data": ["data/trgm_index_data.xml", - "views/trgm_index_view.xml"], + "data": [ + "data/trgm_index_data.xml", + ], "depends": ["mail", "base_search_fuzzy"], "license": "AGPL-3", 'installable': True, diff --git a/base_search_mail_content/models/__init__.py b/base_search_mail_content/models/__init__.py index 0db467b89c..c965376aff 100644 --- a/base_search_mail_content/models/__init__.py +++ b/base_search_mail_content/models/__init__.py @@ -5,3 +5,4 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from . import mail_thread +from . import trgm_index diff --git a/base_search_mail_content/models/trgm_index.py b/base_search_mail_content/models/trgm_index.py new file mode 100644 index 0000000000..80aae0f5a6 --- /dev/null +++ b/base_search_mail_content/models/trgm_index.py @@ -0,0 +1,18 @@ +# Copyright 2016 Eficent Business and IT Consulting Services S.L. +# Copyright 2016 Serpent Consulting Services Pvt. Ltd. +# Copyright 2017 LasLabs Inc. +# Copyright 2018 Tecnativa - Vicent Cubells +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +import logging + +from odoo import fields, models + + +class TrgmIndex(models.Model): + _inherit = 'trgm.index' + + # We take advantage of field inheritance to redefine help instead of do + # inheritance in views that throws an error + field_id = fields.Many2one( + help="You can either select a field of type 'text', 'char' or 'html'." + ) diff --git a/base_search_mail_content/readme/INSTALL.rst b/base_search_mail_content/readme/INSTALL.rst index 5a8405a48b..bf2ba9257d 100644 --- a/base_search_mail_content/readme/INSTALL.rst +++ b/base_search_mail_content/readme/INSTALL.rst @@ -1,6 +1,6 @@ This module depends on the module 'base_search_fuzzy' to ensure that searches on emails are based on indexes. Please read carefully the -`install instructions `_. +`install instructions `_. This module installs by default the indexes that are required to perform the searches on mail messages. diff --git a/base_search_mail_content/views/trgm_index_view.xml b/base_search_mail_content/views/trgm_index_view.xml deleted file mode 100644 index a4adf18027..0000000000 --- a/base_search_mail_content/views/trgm_index_view.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - trgm.index.view.form - trgm.index - - - - [('ttype', 'in', ['char', 'text', 'html'])] - "You can either select a field of type 'text', 'char' or 'html'." - - - - - - -