Browse Source

[IMP] put fields on sign on form

9.0_remove_national_register_number
houssine 5 years ago
parent
commit
ad2b8f377e
  1. 1
      easy_my_coop/__openerp__.py
  2. 15
      easy_my_coop/controllers/AuthSignupHome.py
  3. 48
      easy_my_coop/view/auth_signup_template.xml

1
easy_my_coop/__openerp__.py

@ -30,6 +30,7 @@
"partner_firstname", "partner_firstname",
"partner_contact_birthdate", "partner_contact_birthdate",
"partner_contact_address", "partner_contact_address",
"web",
"website", "website",
"website_recaptcha_reloaded", "website_recaptcha_reloaded",
"theme_light", "theme_light",

15
easy_my_coop/controllers/AuthSignupHome.py

@ -16,7 +16,7 @@ from openerp.exceptions import ValidationError
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
FORM_FIELDS = ['login', 'firstname', 'password', 'phone', 'street', FORM_FIELDS = ['login', 'firstname', 'password', 'phone', 'street',
'city', 'zip_code', 'country_id']
'city', 'zip_code', 'country_id', 'gender', 'birthdate']
class AuthSignupHome(AuthSignupHome): class AuthSignupHome(AuthSignupHome):
@ -43,8 +43,10 @@ class AuthSignupHome(AuthSignupHome):
in lang_obj.sudo().search_read([], ['code'])] in lang_obj.sudo().search_read([], ['code'])]
if request.lang in supported_langs: if request.lang in supported_langs:
values['lang'] = request.lang 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'] values['zip'] = values['zip_code']
uid = self._signup_with_values(qcontext.get('token'), values) uid = self._signup_with_values(qcontext.get('token'), values)
iban = qcontext.get('iban') iban = qcontext.get('iban')
@ -58,7 +60,11 @@ class AuthSignupHome(AuthSignupHome):
qcontext = self.get_auth_signup_qcontext() qcontext = self.get_auth_signup_qcontext()
users_obj = request.env["res.users"] users_obj = request.env["res.users"]
country_obj = request.env['res.country'] 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", "")): 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.") qcontext["error"] = _("That does not seem to be an email address.")
if qcontext.get("iban", False): if qcontext.get("iban", False):
@ -87,5 +93,8 @@ class AuthSignupHome(AuthSignupHome):
qcontext['delivery_point_id'] = 0 qcontext['delivery_point_id'] = 0
qcontext['countries'] = country_obj.sudo().search([]) qcontext['countries'] = country_obj.sudo().search([])
qcontext['country_id'] = '21' 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) return request.render('auth_signup.signup', qcontext)

48
easy_my_coop/view/auth_signup_template.xml

@ -1,21 +1,69 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<data> <data>
<!--<template id="easy_my_coop_login_layout" inherit_id="web.login_layout" name="Login Layout">
<xpath expr="//t[@t-set='head']" position="inside">
<script type="text/javascript" src="/easy_my_coop/static/src/js/jquery.inputmask.bundle.js"></script>
</xpath>
</template>-->
<template id="easy_my_coop_assets_backend" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/easy_my_coop/static/src/js/jquery.inputmask.bundle.js"></script>
</xpath>
</template>
<!--<template id="easy_my_coop_assets_common" inherit_id="web.assets_common">
<xpath expr="." position="inside">
<script type="text/javascript" src="/easy_my_coop/static/src/js/jquery.inputmask.bundle.js"></script>
</xpath>
</template>-->
<template id="easy_my_coop_signup" inherit_id="auth_signup.signup" name="Easy My Coop Sign up login">
<xpath expr="//t[@t-esc='error']/.." position="replace"/>
<xpath expr="//input[@name='csrf_token']" position="after">
<p class="alert alert-danger" t-if="error">
<t t-esc="error"/>
</p>
</xpath>
</template>
<template id="easy_my_coop_auth_fields" inherit_id="auth_signup.fields" name="Auth Signup/ResetPassword form fields"> <template id="easy_my_coop_auth_fields" inherit_id="auth_signup.fields" name="Auth Signup/ResetPassword form fields">
<xpath expr="//input[@name='name']/.." position="before"> <xpath expr="//input[@name='name']/.." position="before">
<div class="form-group field-name"> <div class="form-group field-name">
<label for="confirm_email" class="control-label">Confirm your email</label>
<input type="text" name="confirm_email" t-att-value="confirm_email" id="confirm_email" class="form-control"
required="required" t-att-invisible="'invisible' if only_passwords else None" />
</div>
<div class="form-group field-name">
<label for="firstname" class="control-label">Your firstname</label> <label for="firstname" class="control-label">Your firstname</label>
<input type="text" name="firstname" t-att-value="firstname" id="firstname" class="form-control" placeholder="John" <input type="text" name="firstname" t-att-value="firstname" id="firstname" class="form-control" placeholder="John"
required="required" t-att-readonly="'readonly' if only_passwords else None" /> required="required" t-att-readonly="'readonly' if only_passwords else None" />
</div> </div>
</xpath> </xpath>
<xpath expr="//label[@for='name']" position="replace"> <xpath expr="//label[@for='name']" position="replace">
<label for="name" class="control-label">Your lastname</label> <label for="name" class="control-label">Your lastname</label>
</xpath> </xpath>
<xpath expr="//input[@name='name']" position="attributes"> <xpath expr="//input[@name='name']" position="attributes">
<attribute name="placeholder">Doe</attribute> <attribute name="placeholder">Doe</attribute>
</xpath> </xpath>
<xpath expr="//input[@name='name']/.." position="after"> <xpath expr="//input[@name='name']/.." position="after">
<div class="form-group field-name">
<label for="gender" class="control-label">Your Gender</label>
<select name="gender" id="gender" class="form-control" required="True" style="width:54%"
t-att-disabled="'disabled' if only_passwords else None" >
<option value=""></option>
<t t-foreach="genders or []" t-as="type">
<option t-att-value="type[0]" t-att-selected="type[0] == gender"><t t-esc="type[1]"/></option>
</t>
</select>
</div>
<div class="form-group field-name">
<label class="control-label" for="birthdate">Birthdate</label>
<input type="text" data-inputmask="'alias': 'date'" class="form-control mandatory-field" name="birthdate" required="True" t-attf-value="#{birthdate or ''}" placeholder="05/03/1978"/>
</div>
<div class="form-group field-name"> <div class="form-group field-name">
<label for="iban" class="control-label">IBAN number</label> <label for="iban" class="control-label">IBAN number</label>
<input type="text" name="iban" t-att-value="iban" id="iban" class="form-control" placeholder="BE645215965478" <input type="text" name="iban" t-att-value="iban" id="iban" class="form-control" placeholder="BE645215965478"

Loading…
Cancel
Save