From e7c977e9746293c694c51ffc950b6649079d9ced Mon Sep 17 00:00:00 2001 From: ITISAG-Git Date: Wed, 11 Sep 2019 13:06:05 +0530 Subject: [PATCH] [UPD] fix lint errors for travis build --- contact_search_form/models/contact_search.py | 2 +- website_contact_extend/__manifest__.py | 2 +- .../controllers/contactby.py | 49 ++++++++++--------- .../controllers/myfilter.py | 47 ++++++++++-------- website_contact_extend/models/res_partner.py | 1 + 5 files changed, 56 insertions(+), 45 deletions(-) diff --git a/contact_search_form/models/contact_search.py b/contact_search_form/models/contact_search.py index 4766750..26c71d2 100755 --- a/contact_search_form/models/contact_search.py +++ b/contact_search_form/models/contact_search.py @@ -24,7 +24,7 @@ class SearchLine(models.Model): 'type': 'ir.actions.act_window', 'res_id': self.record_id, 'target': 'new' - } + } def _compute_record_name(self): for record in self: diff --git a/website_contact_extend/__manifest__.py b/website_contact_extend/__manifest__.py index 299315f..188d2bc 100755 --- a/website_contact_extend/__manifest__.py +++ b/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', ], } diff --git a/website_contact_extend/controllers/contactby.py b/website_contact_extend/controllers/contactby.py index a12d44a..fb03951 100755 --- a/website_contact_extend/controllers/contactby.py +++ b/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), @@ -23,7 +23,7 @@ class ContactByController(http.Controller): ('email', '=', email_from)]) if len(res_part_rec) > 0 or len(res_part_rec) == 0 and len(res_part_email) > 0: - # if partner: + # if partner: return True return False @@ -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 @@ -129,7 +130,7 @@ class ContactByController(http.Controller): return json.dumps({'id': partner[0].id}) - # return http.request.render('website_contact_extend.disp_msg_template', {'message_success': 'Means of contact changed!'}) + # return http.request.render('website_contact_extend.disp_msg_template', {'message_success': 'Means of contact changed!'}) # return "

Means of contact changed!

" # else: # # return http.request.render('website_contact_extend.disp_msg_template', {'message_failure': 'Could not change your means of contact. Please request a new link'}) @@ -168,20 +169,19 @@ class FormReview(parent_controller.WebsiteForm): print('Verified?') print(res_part_email[0].is_verified) - - id_record = self.insert_record( - request, - model_record, - res_partner_data, - '', - '' - ) + request, + model_record, + res_partner_data, + '', + '' + ) 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 diff --git a/website_contact_extend/controllers/myfilter.py b/website_contact_extend/controllers/myfilter.py index b0da140..56331e9 100755 --- a/website_contact_extend/controllers/myfilter.py +++ b/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 @@ -71,14 +73,15 @@ class VerifyController(http.Controller): ).sudo().send_mail(part.id) page_render_html = "
"\ - "Thank You! Your email address has been verified!"\ - "
" + "Thank You! Your email address has been verified!"\ + "" # print(request_gdpdr) if request_gdpdr == "True": # print("Hit") page_render_html = page_render_html + "
"\ - "
Click here to choose how you want to be contacted
" + "
Click here to choose how you want to be contacted
" if personal_data == "True": @@ -161,8 +164,8 @@ class MyFilter(parent_controller.WebsiteForm): email = data.get("record").get("email_from") company = data.get("record").get("partner_name") res_part_rec = request.env['res.partner'].sudo().search([ - ('email', '=', email), - ('company_name', '=', company)]) + ('email', '=', email), + ('company_name', '=', company)]) # ('name', '=', contact_name)]) # ('company_name', '=', company) @@ -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') @@ -313,14 +318,14 @@ class MyFilter(parent_controller.WebsiteForm): ('id', '=', id_record)] ) email_data = crm_lead_obj.email_from + "####" + \ - crm_lead_obj.contact_name + "####" + \ - str(email_contact) + "####" + \ - str(phone_contact) + "####" + \ - str(letter_contact) + "####" + \ - str(send_mail) + "####" + \ - str(request_gdpdr) + "####" + \ - str(id_record) + "####" + \ - str(crm_lead_obj.create_date) + crm_lead_obj.contact_name + "####" + \ + str(email_contact) + "####" + \ + str(phone_contact) + "####" + \ + str(letter_contact) + "####" + \ + str(send_mail) + "####" + \ + str(request_gdpdr) + "####" + \ + str(id_record) + "####" + \ + str(crm_lead_obj.create_date) print(email_data) ency_email = base64.b64encode(email_data.encode()).decode( @@ -328,7 +333,7 @@ class MyFilter(parent_controller.WebsiteForm): ) action_url = '%s/verify_email/?data=%s' % ( request.env['ir.config_parameter']. - sudo().get_param('web.base.url'), + sudo().get_param('web.base.url'), ency_email, ) if crm_lead_obj: diff --git a/website_contact_extend/models/res_partner.py b/website_contact_extend/models/res_partner.py index a60118a..9daa842 100755 --- a/website_contact_extend/models/res_partner.py +++ b/website_contact_extend/models/res_partner.py @@ -2,6 +2,7 @@ from odoo import fields, models, api + class ResContacts(models.Model): _inherit = "res.partner"