From ad2b8f377e302be18c512b75a7051dc23e270260 Mon Sep 17 00:00:00 2001 From: houssine Date: Thu, 18 Jul 2019 18:31:41 +0200 Subject: [PATCH] [IMP] put fields on sign on form --- easy_my_coop/__openerp__.py | 1 + easy_my_coop/controllers/AuthSignupHome.py | 15 +++++-- easy_my_coop/view/auth_signup_template.xml | 48 ++++++++++++++++++++++ 3 files changed, 61 insertions(+), 3 deletions(-) diff --git a/easy_my_coop/__openerp__.py b/easy_my_coop/__openerp__.py index 07cd752..1678308 100644 --- a/easy_my_coop/__openerp__.py +++ b/easy_my_coop/__openerp__.py @@ -30,6 +30,7 @@ "partner_firstname", "partner_contact_birthdate", "partner_contact_address", + "web", "website", "website_recaptcha_reloaded", "theme_light", diff --git a/easy_my_coop/controllers/AuthSignupHome.py b/easy_my_coop/controllers/AuthSignupHome.py index d36897f..6387fb9 100644 --- a/easy_my_coop/controllers/AuthSignupHome.py +++ b/easy_my_coop/controllers/AuthSignupHome.py @@ -16,7 +16,7 @@ from openerp.exceptions import ValidationError _logger = logging.getLogger(__name__) FORM_FIELDS = ['login', 'firstname', 'password', 'phone', 'street', - 'city', 'zip_code', 'country_id'] + 'city', 'zip_code', 'country_id', 'gender', 'birthdate'] class AuthSignupHome(AuthSignupHome): @@ -43,8 +43,10 @@ class AuthSignupHome(AuthSignupHome): in lang_obj.sudo().search_read([], ['code'])] if request.lang in supported_langs: values['lang'] = request.lang - values['lastname'] = qcontext.get('name') - values['name'] = values.get('firstname') + ' ' + values.get('lastsname') + firstname = qcontext.get("firstname").title() + lastname = qcontext.get('name').upper() + values['lastname'] = lastname + values['name'] = firstname + ' ' + lastname values['zip'] = values['zip_code'] uid = self._signup_with_values(qcontext.get('token'), values) iban = qcontext.get('iban') @@ -58,7 +60,11 @@ class AuthSignupHome(AuthSignupHome): qcontext = self.get_auth_signup_qcontext() users_obj = request.env["res.users"] country_obj = request.env['res.country'] + sub_req_obj = request.env['subscription.request'] + if qcontext.get("login") != qcontext.get("confirm_email"): + qcontext["error"] = _("The email address doesn't seem to match" + " the email confirmation.") if qcontext.get("login", False) and not tools.single_email_re.match(qcontext.get("login", "")): qcontext["error"] = _("That does not seem to be an email address.") if qcontext.get("iban", False): @@ -87,5 +93,8 @@ class AuthSignupHome(AuthSignupHome): qcontext['delivery_point_id'] = 0 qcontext['countries'] = country_obj.sudo().search([]) qcontext['country_id'] = '21' + fields_desc = sub_req_obj.sudo().fields_get(['company_type', 'gender']) + qcontext['company_types'] = fields_desc['company_type']['selection'] + qcontext['genders'] = fields_desc['gender']['selection'] return request.render('auth_signup.signup', qcontext) diff --git a/easy_my_coop/view/auth_signup_template.xml b/easy_my_coop/view/auth_signup_template.xml index f2f821b..053827e 100644 --- a/easy_my_coop/view/auth_signup_template.xml +++ b/easy_my_coop/view/auth_signup_template.xml @@ -1,21 +1,69 @@ + + + + + + +