Browse Source

[Fix] add changes for lint errors

pull/35/head
ITISAG-Git 5 years ago
parent
commit
ffd5526705
  1. 0
      website_contact_extend/controllers/__init__.py
  2. 16
      website_contact_extend/controllers/contactby.py
  3. 12
      website_contact_extend/controllers/myfilter.py
  4. 14
      website_contact_extend/static/src/js/contactus.js

0
website_contact_extend/controllers/__init__.py

16
website_contact_extend/controllers/contactby.py

@ -49,7 +49,6 @@ class ContactByController(http.Controller):
website=True)
def contact_by(self, data, **kwargs):
global link_data
print(data)
# print(kwargs.get("data"))
# link_data =base64.b64decode(kwargs.get("data")).decode("utf-8") \
link_data = data
@ -71,8 +70,6 @@ class ContactByController(http.Controller):
('website_form_access', '=', True)
])
print(model_record)
print(request.params)
means_of_cont_dict = request.params
if 'letter_contact' in means_of_cont_dict:
@ -101,7 +98,6 @@ class ContactByController(http.Controller):
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([
('email', '=', email),
@ -155,7 +151,6 @@ class FormReview(parent_controller.WebsiteForm):
website=True)
def form_review_send(self, model_name, **kwargs):
# model_name = 'crm.lead'
print('Send')
res_partner_data = request.session['form_data_dict']
model_record = request.env['ir.model'].sudo().search([
@ -173,10 +168,6 @@ class FormReview(parent_controller.WebsiteForm):
# if len(res_part_rec) == 0 and res_part_email:
# print('Company change detected!')
print(res_part_email)
print('Verified?')
print(res_part_email[0].is_verified)
id_record = self.insert_record(
request,
@ -188,15 +179,12 @@ class FormReview(parent_controller.WebsiteForm):
if len(res_part_email) > 0 and len(res_part_rec) == 0 and \
res_part_email[0].is_verified is True:
print('Company change detected')
res_cat = request.env['res.partner.category'].search(
[('name', '=', 'New')])
print(res_cat)
cat_id = 0
if len(res_cat) == 0:
print('Hit')
id_part_res_cat = self.insert_record(
request,
request.env['ir.model'].search(
@ -206,7 +194,6 @@ class FormReview(parent_controller.WebsiteForm):
''
)
cat_id = id_part_res_cat
print(id_part_res_cat)
else:
cat_id = res_cat[0].id
@ -221,12 +208,9 @@ class FormReview(parent_controller.WebsiteForm):
if 'phone' in res_partner_data:
res_partner_dict['phone'] = res_partner_data['phone']
print('Here')
update_parent_partner = request.env['res.partner'].sudo().search([
('id', '=', res_part_email[0].id)])
print(update_parent_partner)
if update_parent_partner and len(update_parent_partner) > 0:
update_parent_partner[0].category_id = False

12
website_contact_extend/controllers/myfilter.py

@ -175,12 +175,10 @@ class MyFilter(parent_controller.WebsiteForm):
if len(res_part_rec) > 0 or len(res_part_rec) == 0 \
and len(res_part_email) > 0:
request.session['review_form'] = "/contact-us-form-review"
print('Display review')
for chkbx_val_out in data['custom'].split('\n'):
if chkbx_val_out != '':
for chkbx_val_in in chkbx_val_out.split(':'):
print(chkbx_val_in)
if chkbx_val_in.strip() == "request_gdpdr":
request_gdpdr = True
break
@ -188,7 +186,6 @@ class MyFilter(parent_controller.WebsiteForm):
id_record = res_part_email[0].id
rec_form = data.get('record')
print(rec_form)
# if 'phone' not in data.get('record'):
# rec_form['phone'] = ""
lst_form_rec = []
@ -212,7 +209,6 @@ class MyFilter(parent_controller.WebsiteForm):
request.session['form_data'] = lst_form_rec
request.session['form_data_dict'] = rec_form
print(request.session['form_data'])
# Some fields have additional SQL constraints
# that we can't check generically
@ -220,16 +216,13 @@ class MyFilter(parent_controller.WebsiteForm):
# TODO: How to get the name of the erroneous field ?
else:
# code for adding new customer
print('Hello')
request.session['review_form'] = "/contactus-thank-you"
res_cat = request.env['res.partner.category'].search(
[('name', '=', 'New')])
print(res_cat)
cat_id = 0
if len(res_cat) == 0:
print('Hit')
id_part_res_cat = self.insert_record(
request,
request.env['ir.model'].search(
@ -239,7 +232,6 @@ class MyFilter(parent_controller.WebsiteForm):
''
)
cat_id = id_part_res_cat
print(id_part_res_cat)
else:
cat_id = res_cat[0].id
@ -309,12 +301,10 @@ class MyFilter(parent_controller.WebsiteForm):
for chkbx_val_out in data['custom'].split('\n'):
if chkbx_val_out != '':
for chkbx_val_in in chkbx_val_out.split(':'):
print(chkbx_val_in)
if chkbx_val_in.strip() == "request_gdpdr":
request_gdpdr = True
break
print("RGPDR" + str(request_gdpdr))
# if request_gdpdr == True:
if request_gdpdr is True or send_mail is True:
@ -332,7 +322,6 @@ class MyFilter(parent_controller.WebsiteForm):
str(id_record) + "####" + \
str(crm_lead_obj.create_date)
print(email_data)
ency_email = base64.b64encode(email_data.encode())\
.decode("utf-8")
action_url = '%s/verify_email/?data=%s' % (
@ -350,7 +339,6 @@ class MyFilter(parent_controller.WebsiteForm):
except IntegrityError:
return json.dumps(False)
print(request.session['review_form'])
request.session['form_builder_model_model'] = model_record.model
request.session['form_builder_model'] = model_record.name
request.session['form_builder_id'] = id_record

14
website_contact_extend/static/src/js/contactus.js

@ -1,16 +1,17 @@
odoo.define('website_contact_extend.success_page', function(require) {
odoo.define('website_contact_extend.success_page', function (require) {
"use strict";
var ajax = require("web.ajax");
$(document).on('blur', '.input_email_from', function(ev) {
$(document).on('blur', '.input_email_from', function (ev) {
console.log(ev);
var email_from = $('.input_email_from').val();
var company_name = $('.input_company').val();
return ajax.jsonRpc('/check_user_exists', 'call', {
email_from: email_from,
company_name: company_name,
}).then(function(res) {
}).then(function (res) {
var contactus_page = "/contactus-thank-you";
if (res) {
contactus_page = "/contact-us-form-review";
@ -20,14 +21,15 @@ odoo.define('website_contact_extend.success_page', function(require) {
});
});
$(document).on('blur', '.input_company', function(ev) {
$(document).on('blur', '.input_company', function (ev) {
console.log(ev);
var email_from = $('.input_email_from').val();
var company_name = $('.input_company').val();
return ajax.jsonRpc('/check_user_exists', 'call', {
email_from: email_from,
company_name: company_name,
}).then(function(res) {
}).then(function (res) {
var contactus_page = "/contactus-thank-you";
if (res) {
contactus_page = "/contact-us-form-review";
@ -37,4 +39,4 @@ odoo.define('website_contact_extend.success_page', function(require) {
});
});
});
});
Loading…
Cancel
Save