Browse Source

Commit for Contract_search_form

Changes to be committed:
	new file:   contact_search_form/README.rst
	new file:   contact_search_form/__init__.py
	new file:   contact_search_form/__manifest__.py
	new file:   contact_search_form/i18n/de.po
	new file:   contact_search_form/i18n/en_US.po
	new file:   contact_search_form/models/__init__.py
	new file:   contact_search_form/models/contact_search.py
	new file:   contact_search_form/readme/CONFIGURE.rst
	new file:   contact_search_form/readme/DESCRIPTION.rst
	new file:   contact_search_form/readme/USAGE.rst
	new file:   contact_search_form/security/gdpr_security.xml
	new file:   contact_search_form/security/ir.model.access.csv
	new file:   contact_search_form/static/description/icon.png
	new file:   contact_search_form/static/description/index.html
	new file:   contact_search_form/views/contact_search.xml
pull/36/head
Christopher Lorenz 5 years ago
parent
commit
f6b96f228f
  1. 72
      contact_search_form/README.rst
  2. 3
      contact_search_form/__init__.py
  3. 33
      contact_search_form/__manifest__.py
  4. 68
      contact_search_form/i18n/de.po
  5. 68
      contact_search_form/i18n/en_US.po
  6. 3
      contact_search_form/models/__init__.py
  7. 84
      contact_search_form/models/contact_search.py
  8. 3
      contact_search_form/readme/CONFIGURE.rst
  9. 2
      contact_search_form/readme/DESCRIPTION.rst
  10. 9
      contact_search_form/readme/USAGE.rst
  11. 8
      contact_search_form/security/gdpr_security.xml
  12. 3
      contact_search_form/security/ir.model.access.csv
  13. BIN
      contact_search_form/static/description/icon.png
  14. 177
      contact_search_form/static/description/index.html
  15. 79
      contact_search_form/views/contact_search.xml

72
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 <https://github.com/OCA/web/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 <dipaks@itis.de>
* Sven Hartmann <svenh@itis.de>
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.

3
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

33
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': '12.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',
],
}

68
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"

68
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"

3
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

84
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[record.model_id.model].browse([
record.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)

3
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.

2
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.

9
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'.

8
contact_search_form/security/gdpr_security.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="group_dpo" model="res.groups">
<field name="name">Data Protection Officer</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>
</odoo>

3
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

BIN
contact_search_form/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

177
contact_search_form/static/description/index.html
File diff suppressed because it is too large
View File

79
contact_search_form/views/contact_search.xml

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_dpo_form_view_itis" model="ir.ui.view">
<field name="name">view.dpo.form.view.itis</field>
<field name="model">dpo.view</field>
<field name="arch" type="xml">
<form string="Customer Info">
<div class="oe_title">
<h1>
<field name="name" default_focus="1" placeholder="Search Terms" required="1"/>
</h1>
</div>
<group>
<field name="model_ids" widget="many2many_tags"/>
</group>
<br/>
<br/>
<center>
<button name="search_string" type="object" string="SEARCH" class="btn-primary"/>
</center>
<br/>
<field name="search_lines"/>
</form>
</field>
</record>
<record id="dpo_view_tree" model="ir.ui.view">
<field name="name">DPO Tree view</field>
<field name="model">dpo.view</field>
<field name="priority">1</field>
<field name="arch" type="xml">
<tree string="Search Contact">
<field name='name'/>
<field name="model_ids"/>
<field name="search_lines"/>
</tree>
</field>
</record>
<record id="action_dpo_view_itis" model="ir.actions.act_window">
<field name="name">Customer Info</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">dpo.view</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="dpo_view_tree"/>
<field name="view_type">form</field>
</record>
<menuitem id="menu_customer_info_base"
name="Contact Search"
parent="contacts.menu_contacts"
sequence="20"
groups="contact_search_form.group_dpo"/>
<menuitem id="menu_customer_info"
name="Contact Search"
action="action_dpo_view_itis"
parent="menu_customer_info_base"
sequence="21"
groups="contact_search_form.group_dpo"/>
<record id="search_line_tree_view_itis" model="ir.ui.view">
<field name="name">search.line.tree.view.itis</field>
<field name="model">search.line</field>
<field name="arch" type="xml">
<tree string="Search Results" create="false" delete="false" edit="false">
<field name="model_id"/>
<field name="record_id"/>
<field name="record_name"/>
<field name="field_list"/>
<button name="open_record" type="object" string="VIEW RECORD" class="btn-primary"/>
</tree>
</field>
</record>
</odoo>
Loading…
Cancel
Save