diff --git a/contact_search_form/__manifest__.py b/contact_search_form/__manifest__.py index 4dd4b21..65b9976 100644 --- a/contact_search_form/__manifest__.py +++ b/contact_search_form/__manifest__.py @@ -1,24 +1,28 @@ -############################################################################## +##################################################################### # # 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': """ - View for Data Protection Officer (DPO) to look up Customer Data. Odoo models can be searched for specified string. - To access contact search in contacts view, user must activate 'Data Protection Officer' checkbox in Technical Settings. + View for Data Protection Officer (DPO) to look up Customer Data. + Odoo models can be searched for specified string. + To access contact search in contacts view, user must activate + 'Data Protection Officer' checkbox + in Technical Settings. """, '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 + # 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', diff --git a/contact_search_form/models/contact_search.py b/contact_search_form/models/contact_search.py index 17f636d..67662f3 100644 --- a/contact_search_form/models/contact_search.py +++ b/contact_search_form/models/contact_search.py @@ -9,7 +9,8 @@ class SearchLine(models.Model): 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") + record_name = fields.Char(string="Record Name", + compute="_compute_record_name") @api.multi def open_record(self): @@ -26,7 +27,8 @@ class SearchLine(models.Model): @api.one def _compute_record_name(self): for record in self: - record_object = self.env[self.model_id.model].search([('id', '=', int(self.record_id))]) + record_object = self.env[self.model_id.model].\ + search([('id', '=', int(self.record_id))]) try: record.record_name = record_object.name except: @@ -36,22 +38,34 @@ class ItisDpoView(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') + 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 = 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: + 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, '!=', '')]) + 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: diff --git a/website_contact_extend/__manifest__.py b/website_contact_extend/__manifest__.py index 90cdab6..3a0a33e 100644 --- a/website_contact_extend/__manifest__.py +++ b/website_contact_extend/__manifest__.py @@ -1,18 +1,20 @@ -############################################################################## +################################################################### # # IT IS AG, software solutions: http://www.itis.de # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html # -############################################################################## +################################################################### { 'name': "Website Contact Form Extend", 'summary': """ - Extended Website Contact View to give Customer the option on how to be contacted. + Extended Website Contact View to give Customer the option + on how to be contacted. - Customer can verifiy his email address with a verification link. Following that the mode of future contact can be chosen and + Customer can verifiy his email address with a verification link. + Following that the mode of future contact can be chosen and a GDPR information request can be submitted. """, @@ -21,7 +23,8 @@ '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 + # 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', diff --git a/website_contact_extend/controllers/myfilter.py b/website_contact_extend/controllers/myfilter.py index 5fd749c..bc0e1bf 100644 --- a/website_contact_extend/controllers/myfilter.py +++ b/website_contact_extend/controllers/myfilter.py @@ -8,10 +8,15 @@ import json class VerifyController(http.Controller): - @http.route('/verify_email', type='http', auth="public", methods=['GET'], website=True) + @http.route('/verify_email', + type='http', + auth="public", + methods=['GET'], + website=True) def verify_email(self, **kwargs): if kwargs: - link_data = base64.b64decode(kwargs.get("data")).decode("utf-8").split("####") + link_data = base64.b64decode(kwargs.get("data")).decode("utf-8")\ + .split("####") email = link_data[0] contact_name = link_data[1] email_name = link_data[2] @@ -25,9 +30,10 @@ class VerifyController(http.Controller): diff = today - link if diff.days > 5 or diff.days < 0: return "