diff --git a/contact_search_form/README.rst b/contact_search_form/README.rst new file mode 100644 index 0000000..41ec172 --- /dev/null +++ b/contact_search_form/README.rst @@ -0,0 +1,72 @@ +=================== +Contact Search Form +=================== + + +Multiple models can be searched for specified string by DPO. +View containing a search function for Data Protection Officers (DPO) to look +up Customer Data. All available Odoo models can be included in the search +query looking for a specified string. + +**Table of contents** + +.. contents:: + :local: + + +Usage +===== +The new menu Contact Search is located in the Contacts App + +When accessing the Contact Search form a new query can be defined by +clicking on the Create button. + +To perform a search the search string is required and the Odoo models that +should be searched have to be selected in the dropdown 'Search in model'. + +The search results are stored and can be accessed at a later time from the +tree view of 'Contact Search'. + + +Known issues / Roadmap +====================== + + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* IT IS AG + +Contributors +~~~~~~~~~~~~ + +* Dipak Suthar +* Sven Hartmann + + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/contact_search_form/__init__.py b/contact_search_form/__init__.py new file mode 100644 index 0000000..83e553a --- /dev/null +++ b/contact_search_form/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/contact_search_form/__manifest__.py b/contact_search_form/__manifest__.py new file mode 100644 index 0000000..2eb1d38 --- /dev/null +++ b/contact_search_form/__manifest__.py @@ -0,0 +1,33 @@ +##################################################################### +# +# IT IS AG, software solutions: http://www.itis.de +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +# +##################################################################### + +{ + 'name': 'Contact Search Form', + + 'summary': "Multiple models can be searched for specified string by DPO", + + 'author': 'IT IS AG, Odoo Community Association (OCA)', + 'website': 'https://github.com/OCA/data-protection', + + # Categories can be used to filter modules in modules listing + # Check https://github.com/odoo/odoo/blob/master/ + # openerp/addons/base/module/module_data.xml + # for the full list + 'version': '11.0.1.0.0', + 'license': 'AGPL-3', + 'category': 'Contacts', + 'depends': ['base', + 'contacts', + ], + + 'data': [ + 'security/gdpr_security.xml', + 'security/ir.model.access.csv', + 'views/contact_search.xml', + ], + +} diff --git a/contact_search_form/i18n/de.po b/contact_search_form/i18n/de.po new file mode 100755 index 0000000..f60a20b --- /dev/null +++ b/contact_search_form/i18n/de.po @@ -0,0 +1,68 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * contact_search_form +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-07-02 12:16+0000\n" +"PO-Revision-Date: 2018-07-02 14:16+0100\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de_DE\n" +"X-Generator: Poedit 1.5.4\n" + +#. module: contact_search_form +#: model:ir.ui.menu,name:contact_search_form.menu_customer_info +msgid "Contact Search" +msgstr "Kontakt Suche" + +#. module: contact_search_form +#: model:ir.actions.act_window,name:contact_search_form.action_dpo_view_itis +#: model:ir.ui.view,arch_db:contact_search_form.view_dpo_form_view_itis +msgid "Customer Info" +msgstr "Kundeninformation" + +#. module: contact_search_form +#: model:res.groups,name:contact_search_form.group_dpo +msgid "Data Protection Officer" +msgstr "Data Protection Officer" + +#. module: contact_search_form +#: model:ir.ui.view,arch_db:contact_search_form.view_dpo_form_view_itis +msgid "SEARCH" +msgstr "Suche" + +#. module: contact_search_form +#: model:ir.ui.view,arch_db:contact_search_form.dpo_view_tree +msgid "Search Contact" +msgstr "Kontakt Suchen" + +#. module: contact_search_form +#: model:ir.ui.view,arch_db:contact_search_form.search_line_tree_view_itis +msgid "Search Results" +msgstr "Suchergebnisse" + +#. module: contact_search_form +#: model:ir.ui.view,arch_db:contact_search_form.view_dpo_form_view_itis +msgid "Search Terms" +msgstr "Suchbegriffe" + +#. module: contact_search_form +#: model:ir.ui.view,arch_db:contact_search_form.search_line_tree_view_itis +msgid "VIEW RECORD" +msgstr "VIEW RECORD" + +#. module: contact_search_form +#: model:ir.model,name:contact_search_form.model_dpo_view +msgid "dpo.view" +msgstr "dpo.view" + +#. module: contact_search_form +#: model:ir.model,name:contact_search_form.model_search_line +msgid "search.line" +msgstr "search.line" diff --git a/contact_search_form/i18n/en_US.po b/contact_search_form/i18n/en_US.po new file mode 100755 index 0000000..6d10846 --- /dev/null +++ b/contact_search_form/i18n/en_US.po @@ -0,0 +1,68 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * contact_search_form +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-07-02 12:15+0000\n" +"PO-Revision-Date: 2018-07-02 12:15+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: contact_search_form +#: model:ir.ui.menu,name:contact_search_form.menu_customer_info +msgid "Contact Search" +msgstr "Contact Search" + +#. module: contact_search_form +#: model:ir.actions.act_window,name:contact_search_form.action_dpo_view_itis +#: model:ir.ui.view,arch_db:contact_search_form.view_dpo_form_view_itis +msgid "Customer Info" +msgstr "Customer Info" + +#. module: contact_search_form +#: model:res.groups,name:contact_search_form.group_dpo +msgid "Data Protection Officer" +msgstr "Data Protection Officer" + +#. module: contact_search_form +#: model:ir.ui.view,arch_db:contact_search_form.view_dpo_form_view_itis +msgid "SEARCH" +msgstr "SEARCH" + +#. module: contact_search_form +#: model:ir.ui.view,arch_db:contact_search_form.dpo_view_tree +msgid "Search Contact" +msgstr "Search Contact" + +#. module: contact_search_form +#: model:ir.ui.view,arch_db:contact_search_form.search_line_tree_view_itis +msgid "Search Results" +msgstr "Search Results" + +#. module: contact_search_form +#: model:ir.ui.view,arch_db:contact_search_form.view_dpo_form_view_itis +msgid "Search Terms" +msgstr "Search Terms" + +#. module: contact_search_form +#: model:ir.ui.view,arch_db:contact_search_form.search_line_tree_view_itis +msgid "VIEW RECORD" +msgstr "VIEW RECORD" + +#. module: contact_search_form +#: model:ir.model,name:contact_search_form.model_dpo_view +msgid "dpo.view" +msgstr "dpo.view" + +#. module: contact_search_form +#: model:ir.model,name:contact_search_form.model_search_line +msgid "search.line" +msgstr "search.line" + diff --git a/contact_search_form/models/__init__.py b/contact_search_form/models/__init__.py new file mode 100644 index 0000000..38fb27a --- /dev/null +++ b/contact_search_form/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import contact_search diff --git a/contact_search_form/models/contact_search.py b/contact_search_form/models/contact_search.py new file mode 100644 index 0000000..bf9adc6 --- /dev/null +++ b/contact_search_form/models/contact_search.py @@ -0,0 +1,84 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models, _ + + +class SearchLine(models.Model): + _name = "search.line" + + name = fields.Char(string="Model Name") + field_list = fields.Char(string="Fields Name") + model_id = fields.Many2one('ir.model', string="Found in Model") + record_id = fields.Integer(string="Record ID") + search_id = fields.Many2one("dpo.view", string="Search Terms") + record_name = fields.Char(string="Record Name", + compute="_compute_record_name") + + @api.multi + def open_record(self): + return { + 'name': _('Found record'), + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': self.model_id.model, + 'type': 'ir.actions.act_window', + 'res_id': self.record_id, + 'target': 'new' + } + + def _compute_record_name(self): + for record in self: + record_object = self.env[self.model_id.model].browse([ + self.record_id + ]) + record.record_name = record_object.name_get()[0][1] + + +class DpoView(models.Model): + _name = "dpo.view" + + name = fields.Char(string="Search Term") + model_ids = fields.Many2many('ir.model', + 'dpo_view_ir_model_rel', + string='Search in Model') + search_lines = fields.One2many('search.line', + 'search_id', + string='Search Result') + + @api.multi + def search_string(self): + search_line_ids = self.env['search.line'].search([ + ('search_id', '=', self.id) + ]) + search_line_ids.unlink() + final_list = [] + for model_id in self.model_ids: + field_list = [] + found_match = {} + for field_id in model_id.field_id: + if field_id.ttype in ['char', 'html', 'text'] \ + and field_id.store: + field_list.append(field_id.name) + for field in field_list: + records = self.env[model_id.model].search([ + (field, 'ilike', self.name), + (field, '!=', '') + ]) + for rec in records: + temp_list = found_match.get(rec.id, False) + if temp_list: + temp_list.append(field) + found_match[rec.id] = temp_list + else: + found_match[rec.id] = [field] + for key, value in found_match.items(): + founded_json = {} + founded_json["field_list"] = str(list(set(value))) + founded_json["name"] = str(model_id.name) + founded_json["model_id"] = model_id.id + founded_json["search_id"] = self.id + founded_json["record_id"] = key + final_list.append(founded_json) + if final_list: + for vals in final_list: + self.env['search.line'].create(vals) diff --git a/contact_search_form/readme/CONFIGURE.rst b/contact_search_form/readme/CONFIGURE.rst new file mode 100755 index 0000000..f213c47 --- /dev/null +++ b/contact_search_form/readme/CONFIGURE.rst @@ -0,0 +1,3 @@ +To access contact search view in contacts view, the user has to activate the 'Data Protection Officer' checkbox +in User -> Technical Settings. +After that a new menu item 'Contact Search' will appear in the Contacts App. diff --git a/contact_search_form/readme/DESCRIPTION.rst b/contact_search_form/readme/DESCRIPTION.rst new file mode 100644 index 0000000..b73effd --- /dev/null +++ b/contact_search_form/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +View containing a search function for Data Protection Officers (DPO) to look up Customer Data. +All available Odoo models can be included in the search query looking for a specified string. diff --git a/contact_search_form/readme/USAGE.rst b/contact_search_form/readme/USAGE.rst new file mode 100644 index 0000000..79a5c6c --- /dev/null +++ b/contact_search_form/readme/USAGE.rst @@ -0,0 +1,9 @@ +The new menu Contact Search is located in the Contacts App + +When accessing the Contact Search form a new query can be defined by +clicking on the Create button. +To perform a search the search string is required and the Odoo models that +should be searched have to be selected in the dropdown 'Search in model'. + +The search results are stored and can be accessed at a later time from the +tree view of 'Contact Search'. diff --git a/contact_search_form/security/gdpr_security.xml b/contact_search_form/security/gdpr_security.xml new file mode 100755 index 0000000..e6464db --- /dev/null +++ b/contact_search_form/security/gdpr_security.xml @@ -0,0 +1,8 @@ + + + + + Data Protection Officer + + + diff --git a/contact_search_form/security/ir.model.access.csv b/contact_search_form/security/ir.model.access.csv new file mode 100755 index 0000000..773df98 --- /dev/null +++ b/contact_search_form/security/ir.model.access.csv @@ -0,0 +1,3 @@ +"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" +access_dpo_view,access_dpo_view,model_dpo_view,group_dpo,1,1,1,1 +access_search_line,access_search_line,model_search_line,group_dpo,1,1,1,1 diff --git a/contact_search_form/static/description/icon.png b/contact_search_form/static/description/icon.png new file mode 100644 index 0000000..3a0328b Binary files /dev/null and b/contact_search_form/static/description/icon.png differ diff --git a/contact_search_form/views/contact_search.xml b/contact_search_form/views/contact_search.xml new file mode 100755 index 0000000..85c32b3 --- /dev/null +++ b/contact_search_form/views/contact_search.xml @@ -0,0 +1,79 @@ + + + + + + view.dpo.form.view.itis + dpo.view + +
+
+

+ +

+ +
+ + + +
+
+
+
+
+ + +
+
+ + + DPO Tree view + dpo.view + 1 + + + + + + + + + + + Customer Info + ir.actions.act_window + dpo.view + tree,form + + form + + + + + + + + search.line.tree.view.itis + search.line + + + + + + +