Browse Source

[UPD] fix lint errors for travis build

pull/35/head
ITISAG-Git 5 years ago
parent
commit
e7c977e974
  1. 2
      website_contact_extend/__manifest__.py
  2. 33
      website_contact_extend/controllers/contactby.py
  3. 21
      website_contact_extend/controllers/myfilter.py
  4. 1
      website_contact_extend/models/res_partner.py

2
website_contact_extend/__manifest__.py

@ -35,6 +35,6 @@
'views/means_of_contact.xml',
'views/disp_msg_template.xml',
'views/email_template.xml'
#'security/ir.model.access.csv',
# 'security/ir.model.access.csv',
],
}

33
website_contact_extend/controllers/contactby.py

@ -13,7 +13,7 @@ link_data = {}
class ContactByController(http.Controller):
@http.route('/check_user_exists/',type='json',auth="public",methods=['POST'],website=True,csrf=False)
@http.route('/check_user_exists/', type='json', auth="public", methods=['POST'], website=True, csrf=False)
def check_user_exists(self, email_from, company_name, **kwargs):
res_part_rec = request.env['res.partner'].sudo().search([
('email', '=', email_from),
@ -91,13 +91,13 @@ class ContactByController(http.Controller):
return json.dumps(False)
# print(link_data)
link_data_split = base64.b64decode(link_data).decode("utf-8").split("####")
link_data_split = base64.b64decode(
link_data).decode("utf-8").split("####")
# print(link_data_split)
email = link_data_split[0]
contact_name = link_data_split[1]
print(email, contact_name, email_name, phone_name, letter_name)
partner = request.env['res.partner'].sudo().search([
@ -105,7 +105,8 @@ class ContactByController(http.Controller):
('name', '=', contact_name)
])
if not partner:
partner = request.env['res.partner'].sudo().create({'name': contact_name, 'email': email})
partner = request.env['res.partner'].sudo().create(
{'name': contact_name, 'email': email})
if partner:
for part in partner:
part.is_verified = True
@ -168,8 +169,6 @@ class FormReview(parent_controller.WebsiteForm):
print('Verified?')
print(res_part_email[0].is_verified)
id_record = self.insert_record(
request,
model_record,
@ -181,7 +180,8 @@ class FormReview(parent_controller.WebsiteForm):
if len(res_part_email) > 0 and len(res_part_rec) == 0 and res_part_email[0].is_verified == True:
print('Company change detected')
res_cat = request.env['res.partner.category'].search([('name', '=', 'New')])
res_cat = request.env['res.partner.category'].search(
[('name', '=', 'New')])
print(res_cat)
cat_id = 0
@ -189,7 +189,8 @@ class FormReview(parent_controller.WebsiteForm):
print('Hit')
id_part_res_cat = self.insert_record(
request,
request.env['ir.model'].search([('model', '=', 'res.partner.category')]),
request.env['ir.model'].search(
[('model', '=', 'res.partner.category')]),
{'name': 'New', 'create_uid': request.env.uid},
'',
''
@ -242,24 +243,27 @@ class FormReview(parent_controller.WebsiteForm):
id_record_res = self.insert_record(
request,
request.env['ir.model'].search([('model', '=', 'res.partner')]),
request.env['ir.model'].search(
[('model', '=', 'res.partner')]),
res_partner_dict,
'',
''
)
res_partner_company_dict['child_ids'] = [[6, 'virtual_1798', [id_record_res]]]
res_partner_company_dict['child_ids'] = [
[6, 'virtual_1798', [id_record_res]]]
id_record_res_company = self.insert_record(
request,
request.env['ir.model'].search([('model', '=', 'res.partner')]),
request.env['ir.model'].search(
[('model', '=', 'res.partner')]),
res_partner_company_dict,
'',
''
)
if update_parent_partner and len(update_parent_partner) > 0:
update_parent_partner[0].child_ids = [[6, 'virtual_1798', [id_record_res]]]
update_parent_partner[0].child_ids = [
[6, 'virtual_1798', [id_record_res]]]
id_record = self.insert_record(
request,
@ -301,7 +305,8 @@ class FormReview(parent_controller.WebsiteForm):
'website_contact_extend.verification_email_template'
).sudo().send_mail(id_record)
request.env.ref('website_contact_extend.email_template_onchange_data').sudo().send_mail(id_record)
request.env.ref('website_contact_extend.email_template_onchange_data').sudo(
).send_mail(id_record)
request.session['form_builder_model_model'] = model_record.model
request.session['form_builder_model'] = model_record.name

21
website_contact_extend/controllers/myfilter.py

@ -8,6 +8,7 @@ from psycopg2 import IntegrityError
import base64
import json
class VerifyController(http.Controller):
@http.route('/verify_email',
type='http',
@ -49,7 +50,8 @@ class VerifyController(http.Controller):
('name', '=', contact_name)
])
if not partner:
partner = request.env['res.partner'].sudo().create({'name':contact_name,'email':email})
partner = request.env['res.partner'].sudo().create(
{'name': contact_name, 'email': email})
if partner:
for part in partner:
part.is_verified = True
@ -78,7 +80,8 @@ class VerifyController(http.Controller):
if request_gdpdr == "True":
# print("Hit")
page_render_html = page_render_html + "<br/>"\
"<div style='text-align: center'>Click <a href='" + contact_url + "'>here</a> to choose how you want to be contacted</div>"
"<div style='text-align: center'>Click <a href='" + contact_url + \
"'>here</a> to choose how you want to be contacted</div>"
if personal_data == "True":
@ -219,7 +222,8 @@ class MyFilter(parent_controller.WebsiteForm):
print('Hello')
request.session['review_form'] = "/contactus-thank-you"
res_cat = request.env['res.partner.category'].search([('name', '=', 'New')])
res_cat = request.env['res.partner.category'].search(
[('name', '=', 'New')])
print(res_cat)
cat_id = 0
@ -227,7 +231,8 @@ class MyFilter(parent_controller.WebsiteForm):
print('Hit')
id_part_res_cat = self.insert_record(
request,
request.env['ir.model'].search([('model', '=', 'res.partner.category')]),
request.env['ir.model'].search(
[('model', '=', 'res.partner.category')]),
{'name': 'New', 'create_uid': request.env.uid},
'',
''
@ -237,7 +242,6 @@ class MyFilter(parent_controller.WebsiteForm):
else:
cat_id = res_cat[0].id
res_partner_dict = {}
# if 'phone' not in res_partner_data:
@ -251,7 +255,6 @@ class MyFilter(parent_controller.WebsiteForm):
res_partner_dict['company_name'] = res_partner_data['partner_name']
res_partner_dict['category_id'] = [[6, False, [cat_id]]]
res_partner_company_dict = res_partner_dict.copy()
res_partner_company_dict.pop('email')
res_partner_company_dict.pop('company_name')
@ -266,7 +269,8 @@ class MyFilter(parent_controller.WebsiteForm):
id_record_res_company = self.insert_record(
request,
request.env['ir.model'].search([('model', '=', 'res.partner')]),
request.env['ir.model'].search(
[('model', '=', 'res.partner')]),
res_partner_company_dict,
'',
data.get('meta')
@ -276,7 +280,8 @@ class MyFilter(parent_controller.WebsiteForm):
id_record_res = self.insert_record(
request,
request.env['ir.model'].search([('model', '=', 'res.partner')]),
request.env['ir.model'].search(
[('model', '=', 'res.partner')]),
res_partner_dict,
'',
data.get('meta')

1
website_contact_extend/models/res_partner.py

@ -2,6 +2,7 @@
from odoo import fields, models, api
class ResContacts(models.Model):
_inherit = "res.partner"

Loading…
Cancel
Save