From c5c309d111611b09e0b8ec7c80b2e8498a4eeb15 Mon Sep 17 00:00:00 2001 From: ahenriquez Date: Tue, 10 Jan 2017 12:37:11 +0100 Subject: [PATCH] [IMP] search by email_from and reply_to Introduce search of html fields Create indexes Update Readme --- base_search_mail_content/README.rst | 45 ++++++++++--------- base_search_mail_content/__openerp__.py | 5 ++- .../data/trgm_index_data.xml | 12 +++++ .../models/mail_thread.py | 6 ++- .../views/trgm_index_view.xml | 17 +++++++ 5 files changed, 61 insertions(+), 24 deletions(-) create mode 100644 base_search_mail_content/views/trgm_index_view.xml diff --git a/base_search_mail_content/README.rst b/base_search_mail_content/README.rst index 5d7d37d5..dfa436c9 100644 --- a/base_search_mail_content/README.rst +++ b/base_search_mail_content/README.rst @@ -3,43 +3,45 @@ :alt: License: AGPL-3 ======================== -Mail message name search +Base Search Mail Content ======================== -This module adds the capability to search for mail messages by subject or -body of the message. This will be useful in models that make intense use of -messages, like project issues or helpdesk tickets. +This module adds the capability to find any object (e.g. project issues or +helpdesk ticket) based on the conversation threads associated to them. -This module will add dynamically the message_ids to the search view of -any model that inherits from the mail.thread and will incorporate the -capability to search for content in the mail messages. +This will be useful in models that make intense use of messages, +like project issues or helpdesk tickets. +A project issue or helpdesk ticket can contain tens of mails or notes +associated, based on the feedback that the person responsible for the ticket +maintains, including conversations with the person that raised the issue. + +A user may often want to find issues or tickets, based on the past +conversations that were recorded, as much as he/she needs to search +in their mail for past conversations. + +This module will add dynamically a field 'message_content' to the search view of +any model that inherits from the mail.thread. + +The current search capabilities include searching into the subject, body, +email from, reply to and record name. Installation ============ 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 https://github.com/OCA/server-tools/blob/9.0/base_search_fuzzy/README.rst +instructions: +https://github.com/OCA/server-tools/blob/9.0/base_search_fuzzy/README.rst This module installs by default the indexes that are required to perform the searches on mail messages. - -Configuration -============= - -No configuration is needed. - Usage ===== -A project issue or helpdesk ticket can contain tens of mails associated, -based on the conversations that the person responsible for the ticket -maintains with the person that raised the issue. One need to search -in mail messages, as much as he/she needs to search in their mail for -past conversations. So this module will be useful for the user to search -messages by subject or body. +Go to any model that contains a chatter (e.g. Partners, Leads, ...). Search +for content in field 'Message Content'. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot @@ -66,6 +68,9 @@ Contributors * Jordi Ballester Alomar * Serpent Consulting Services Pvt. Ltd. +* Lois Rilo Antelo +* Aaron Henriquez + Maintainer ---------- diff --git a/base_search_mail_content/__openerp__.py b/base_search_mail_content/__openerp__.py index 279cccaa..4da3ff28 100644 --- a/base_search_mail_content/__openerp__.py +++ b/base_search_mail_content/__openerp__.py @@ -5,14 +5,15 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { - "name": "Mail message name search", + "name": "Base Mail Search Content", "version": "9.0.1.0.0", "author": "Eficent," "SerpentCS," "Odoo Community Association (OCA)", "website": "http://www.eficent.com", "category": "Social", - "data": ["data/trgm_index_data.xml"], + "data": ["data/trgm_index_data.xml", + "views/trgm_index_view.xml"], "depends": ["mail", "base_search_fuzzy"], "license": "AGPL-3", diff --git a/base_search_mail_content/data/trgm_index_data.xml b/base_search_mail_content/data/trgm_index_data.xml index b60b0666..0a84c926 100644 --- a/base_search_mail_content/data/trgm_index_data.xml +++ b/base_search_mail_content/data/trgm_index_data.xml @@ -20,5 +20,17 @@ search="[('model','=','mail.message'),('name','=','record_name')]"/> + + gin + + + + + gin + + + diff --git a/base_search_mail_content/models/mail_thread.py b/base_search_mail_content/models/mail_thread.py index 0c8ca94b..90e8efe1 100644 --- a/base_search_mail_content/models/mail_thread.py +++ b/base_search_mail_content/models/mail_thread.py @@ -15,9 +15,11 @@ class MailThread(models.AbstractModel): _inherit = 'mail.thread' def _search_message_content(self, operator, value): - domain = [('model', '=', self._name), '|', '|', + domain = [('model', '=', self._name), '|', '|', '|', '|', ('record_name', operator, value), - ('subject', operator, value), ('body', operator, value)] + ('subject', operator, value), ('body', operator, value), + ('email_from', operator, value), + ('reply_to', operator, value)] if operator in expression.NEGATIVE_TERM_OPERATORS: domain = domain[2:] diff --git a/base_search_mail_content/views/trgm_index_view.xml b/base_search_mail_content/views/trgm_index_view.xml new file mode 100644 index 00000000..2534f649 --- /dev/null +++ b/base_search_mail_content/views/trgm_index_view.xml @@ -0,0 +1,17 @@ + + + + + + trgm.index.view.form + trgm.index + + + + [('ttype', 'in', ['char', 'text', 'html'])] + + + + + +