Browse Source

[PEP8] fixing more PEP8 error

pull/1/head
houssine 5 years ago
parent
commit
781de91209
  1. 25
      easy_my_coop/controllers/main.py

25
easy_my_coop/controllers/main.py

@ -3,10 +3,7 @@ import base64
from datetime import datetime
import re
import werkzeug
import werkzeug.urls
from openerp import http, SUPERUSER_ID
from openerp import http
from openerp.http import request
from openerp.tools.translate import _
@ -16,6 +13,18 @@ _TECHNICAL = ['view_from', 'view_callback']
_BLACKLIST = ['id', 'create_uid', 'create_date', 'write_uid', 'write_date',
'user_id', 'active']
_COOP_FORM_FIELD = ['email', 'firstname', 'lastname', 'birthdate', 'iban',
'share_product_id', 'no_registre', 'address', 'city',
'zip_code', 'country_id', 'phone', 'lang', 'nb_parts',
'total_parts', 'error_msg']
_COMPANY_FORM_FIELD = ['is_company', 'company_register_number', 'company_name',
'company_email', 'company_type', 'email', 'firstname',
'lastname', 'birthdate', 'iban', 'share_product_id',
'no_registre', 'address', 'city', 'zip_code',
'country_id', 'phone', 'lang', 'nb_parts',
'total_parts', 'error_msg']
class WebsiteSubscription(http.Controller):
@ -30,7 +39,7 @@ class WebsiteSubscription(http.Controller):
return request.website.render("easy_my_coop.becomecompanycooperator", values)
values = self.fill_values(values, False, True)
for field in ['email','firstname','lastname','birthdate','iban','share_product_id','no_registre','address','city','zip_code','country_id','phone','lang','nb_parts','total_parts','error_msg']:
for field in _COOP_FORM_FIELD:
if kwargs.get(field):
values[field] = kwargs.pop(field)
@ -45,7 +54,7 @@ class WebsiteSubscription(http.Controller):
values = self.fill_values(values, True, True)
for field in ['is_company','company_register_number','company_name','company_email','company_type','email','firstname','lastname','birthdate','iban','share_product_id','no_registre','address','city','zip_code','country_id','phone','lang','nb_parts','total_parts','error_msg']:
for field in _COMPANY_FORM_FIELD:
if kwargs.get(field):
values[field] = kwargs.pop(field)
values.update(kwargs=kwargs.items())
@ -127,7 +136,7 @@ class WebsiteSubscription(http.Controller):
if not values.get('share_product_id'):
products = request.env['product.template'].sudo().get_web_share_products(is_company)
for product in products:
if product.default_share_product == True:
if product.default_share_product is True:
values['share_product_id'] = product.id
break
if not values.get('country_id'):
@ -280,6 +289,6 @@ class WebsiteSubscription(http.Controller):
'datas': base64.encodestring(field_value.read()),
'datas_fname': field_value.filename,
}
request.registry['ir.attachment'].sudo().create(attachment_value)
request.env['ir.attachment'].sudo().create(attachment_value)
return self.get_subscription_response(values, kwargs)
Loading…
Cancel
Save