Browse Source

GDPR Modules for OCA V11

- Line length to max 79 characters
- Flake conformity
pull/10/head
ITISAG-OCA 6 years ago
parent
commit
ba54543c08
  1. 5
      contact_search_form/models/contact_search.py
  2. 28
      website_contact_extend/controllers/myfilter.py

5
contact_search_form/models/contact_search.py

@ -1,5 +1,5 @@
from odoo import api, fields, models, _
#from odoo.exceptions import UserError
# from odoo.exceptions import UserError
class SearchLine(models.Model):
@ -35,6 +35,7 @@ class SearchLine(models.Model):
except:
record.record_name = "Name"
class ItisDpoView(models.Model):
_name = "dpo.view"
@ -84,4 +85,4 @@ class ItisDpoView(models.Model):
final_list.append(founded_json)
if final_list:
for vals in final_list:
create_id = self.env['search.line'].create(vals)
self.env['search.line'].create(vals)

28
website_contact_extend/controllers/myfilter.py

@ -32,8 +32,9 @@ class VerifyController(http.Controller):
return "<center style='color:red'>Not valid!<br/>" \
"The link you entered is either not valid or expired."\
"<br/>Please request a new link.</center>"
partner = request.env['res.partner'].sudo().search\
([('email', '=', email), ('name', '=', contact_name)])
partner = request.env['res.partner'].sudo()\
.search([('email', '=', email),
('name', '=', contact_name)])
if partner:
for part in partner:
part.is_verified = True
@ -50,9 +51,9 @@ class VerifyController(http.Controller):
part.letter_contact = True
else:
part.letter_contact = False
template = request.env.ref('website_contact_extend.'
'confirmation_email_template')\
.sudo().send_mail(part.id)
request.env.ref('website_contact_extend.'
'confirmation_email_template')\
.sudo().send_mail(part.id)
return "<center style='color:green'>" \
"Thank You! Your email address has been verified!" \
"</center>"
@ -78,15 +79,15 @@ class MyFilter(parent_controller.WebsiteForm):
# need_send_email = False
try:
data = self.extract_data(model_record, request.params)
contact_type=False
# contact_type = False
phone_contact = False
letter_contact = False
email_contact = False
send_mail = True
index = 0
for field_name, field_value in request.params.items():
if field_name == "contact_type":
contact_type = field_value
# if field_name == "contact_type":
# contact_type = field_value
if field_name == "send_mail" and field_value == "send_mail":
send_mail = True
if field_name == "phone_contact" \
@ -98,10 +99,9 @@ class MyFilter(parent_controller.WebsiteForm):
if field_name == "email_contact" \
and field_value == "email_contact":
email_contact = True
index += 1
contact_name = data.get("record").get("contact_name")
email_from = data.get("record").get("email_from")
# contact_name = data.get("record").get("contact_name")
# email_from = data.get("record").get("email_from")
# If we encounter an issue while extracting data
except ValidationError as e:
@ -136,9 +136,9 @@ class MyFilter(parent_controller.WebsiteForm):
)
if crm_lead_obj:
crm_lead_obj.email_link = action_url
template = request.env.ref('website_contact_extend.'
'verification_email_template')\
.send_mail(id_record)
request.env.ref('website_contact_extend.'
'verification_email_template')\
.send_mail(id_record)
# Some fields have additional SQL constraints
# that we can't check generically
# Ex: crm.lead.probability which is a float between 0 and 1

Loading…
Cancel
Save