Compare commits

...

1 Commits

Author SHA1 Message Date
  root 2a2344b34c create new account fielsd 2 years ago
9 changed files with 88 additions and 13 deletions
Split View
  1. +19
    -1
      controllers/kalachakra.py
  2. +1
    -0
      models/partner.py
  3. +6
    -1
      models/res_users.py
  4. +5
    -0
      static/js/booking.js
  5. +37
    -1
      views/auth_signup_login_templates.xml
  6. +1
    -1
      views/booking_event.xml
  7. +2
    -0
      views/partner.xml
  8. +1
    -9
      views/portal.xml
  9. +16
    -0
      views/portal_templates.xml

+ 19
- 1
controllers/kalachakra.py View File

@ -29,7 +29,11 @@ from collections import OrderedDict
_logger = logging.getLogger(__name__)
def create_donation(self):
return True
class Kalachakra_PortalAccount(CustomerPortal):
MANDATORY_BILLING_FIELDS = ["name","firstname", "phone", "email","birthday_date", "street", "city", "country_id"]
OPTIONAL_BILLING_FIELDS = ["zipcode", "state_id", "vat", "company_name"]
@http.route(['/my/invoices', '/my/invoices/page/<int:page>'], type='http', auth="user", website=True)
def kalachakra_portal_my_invoices(self, page=1, date_begin=None, date_end=None, sortby=None, filterby=None, **kw):
values = self._prepare_portal_layout_values()
@ -132,6 +136,7 @@ class KalaAuthSignupHome(Home):
if 'error' not in qcontext and request.httprequest.method == 'POST':
try:
self.do_signup(qcontext)
_logger.error('do_sign_up'+str(qcontext))
# Send an account creation confirmation email
if qcontext.get('token'):
User = request.env['res.users']
@ -158,7 +163,20 @@ class KalaAuthSignupHome(Home):
response = request.render('auth_signup.signup', qcontext)
response.headers['X-Frame-Options'] = 'DENY'
return response
def do_signup(self, qcontext):
""" Shared helper that creates a res.partner out of a token """
values = { key: qcontext.get(key) for key in ('login', 'name', 'password', 'firstname','phone','birthday_date') }
if not values:
raise UserError(_("The form was not properly filled in."))
if values.get('password') != qcontext.get('confirm_password'):
raise UserError(_("Passwords do not match; please retype them."))
supported_lang_codes = [code for code, _ in request.env['res.lang'].get_installed()]
lang = request.context.get('lang', '')
if lang in supported_lang_codes:
values['lang'] = lang
self._signup_with_values(qcontext.get('token'), values)
request.env.cr.commit()
class kalachakra_event(WebsiteEventController,PaymentProcessing):
def sitemap_event(env, rule, qs):
if not qs or qs.lower() in '/events':


+ 1
- 0
models/partner.py View File

@ -11,6 +11,7 @@ class ResPartner(models.Model):
external_id=fields.Char('id')
statut_contact=fields.Selection([('adherent', 'Adhérent'), ('bienfaiteur', 'Bienfaiteur'),('contact', 'Contact'), ('soutien','Soutien') ],'Statut', index=True)
date_creation_contact=fields.Char(string='Date de création du contact', readonly=True)
birthday_date=fields.Date(string='Birthday date')
origine=fields.Selection([
('boutique','Boutique'),
('visiteur','Visiteur'),


+ 6
- 1
models/res_users.py View File

@ -101,5 +101,10 @@ class ResUsers(models.Model):
self._signup_create_user(values)
partner=self.env['res.partner'].sudo().search([('email','ilike',values.get('login'))],limit=1)
partner.firstname=values.get('firstname')
return (self.env.cr.dbname, values.get('login'), values.get('password'))
return (self.env.cr.dbname, values.get('login'), values.get('password'))

+ 5
- 0
static/js/booking.js View File

@ -18,6 +18,11 @@ odoo.define('booking.main', function (require) {
format: 'DD/MM/YYYY',
enableOnReadonly: true
});
$('#datetimepicker_birthday_date').datetimepicker({
format: 'YYYY-MM-DD',
enableOnReadonly: true
});
$('#medical_info').hide()


+ 37
- 1
views/auth_signup_login_templates.xml View File

@ -7,7 +7,43 @@
required="required" t-att-readonly="'readonly' if only_passwords else None"
t-att-autofocus="'autofocus' if login and not only_passwords else None" />
</div>
<div class="form-group field-name">
<label for="name">Your Firstname</label>
<input type="text" name="firstname" t-att-value="firstname" id="firstname" class="form-control form-control-sm"
required="required" t-att-readonly="'readonly' if only_passwords else None"
t-att-autofocus="'autofocus' if login and not only_passwords else None" />
</div>
<div class="form-group field-name">
<label for="name">Your Phone number</label>
<input type="text" name="phone" t-att-value="phone" id="phone" class="form-control form-control-sm"
t-att-readonly="'readonly' if only_passwords else None"
t-att-autofocus="'autofocus' if login and not only_passwords else None" />
</div>
<!-- <div class="form-group">
data-target-input="nearest">
<label for="birthday_date">Your birthday date</label>
<input type="text" name="birthday_date"
class="form-control datetimepicker-input"
data-target="#datetimepicker_birthday_date"
t-att-value="birthday_date" id="birthday_date"
required="required" t-att-readonly="'readonly' if only_passwords else None"
t-att-autofocus="'autofocus' if login and not only_passwords else None" />
<div class="input-group-append"
data-target="#datetimepicker_birthday_date"
data-toggle="datetimepicker">
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
</div>
</div> -->
<div class="form-group field-name">
<label for="birthday_date">Your birthday date</label>
<div class="input-group datetime" id="datetimepicker_birthday_date" data-target-input="nearest">
<input type="text" name="birthday_date" class="form-control datetimepicker-input" data-target="#datetimepicker_birthday_date"/>
<div class="input-group-append" data-target="#datetimepicker_birthday_date" data-toggle="datetimepicker">
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
</div>
</div>
</div>
</xpath>
</template>


+ 1
- 1
views/booking_event.xml View File

@ -102,7 +102,7 @@
</page>
</xpath>
<xpath expr="//page[@name='booking']" position="after">
<page string="Options" name="booking_options" attrs="{'invisible':['|',('booking_event','=',False),('individual_booking_event','=',True)]}">
<page string="Options" name="booking_options" attrs="{'invisible':[('booking_event','=',False)]}">
<group style="width:100%%">
<field name="booking_option_ids" style="width: 100%;">
<tree string="Options" editable="bottom">


+ 2
- 0
views/partner.xml View File

@ -28,12 +28,14 @@
<field name="date_membership"/>
<field name="super_member"/>
</xpath>
<xpath expr="//field[@name='title']" position="replace">
<field name="title" options="{&quot;no_open&quot;: True}" placeholder="" attrs="{'invisible': [('is_company', '=', True)]}"/>
</xpath>
<xpath expr="//field[@name='firstname']" position="replace">
<field name="firstname" attrs="{'invisible':[('is_company','=',True)]}"/>
<field name="birthday_date" attrs="{'invisible':[('is_company','=',True)]}"/>
</xpath>
</field>


+ 1
- 9
views/portal.xml View File

@ -9,15 +9,7 @@
</xpath>
</template>
<template id="portal_layout" name="portal_layout" inherit_id="portal.portal_layout" customize_show="True" priority="30">
<xpath expr="//div[hasclass('o_portal_my_details')]" position="replace">
<h4>Details <a role="button" href="/my/account" class="btn btn-sm btn-link"><i class="fa fa-pencil"/> Edit</a></h4>
<hr class="mt-1 mb-0"/>
<div t-field="user_id.partner_id" t-options='{"widget": "contact", "fields": ["email", "phone", "address", "name"]}'/>
<div style="color:red" t-field="user_id.partner_id.member_status"/>
</xpath>
</template>
<template id="portal_kala_user_dropdown" name="kala user dropdown" inherit_id="portal.user_dropdown">
<xpath expr="//span[@t-if='_user_name']" position="replace">


+ 16
- 0
views/portal_templates.xml View File

@ -15,10 +15,26 @@
<label class="col-form-label" for="name">Name</label>
<input type="text" name="name" t-attf-class="form-control #{error.get('name') and 'is-invalid' or ''}" t-att-value="name or partner.name" />
</div>
<div t-attf-class="form-group #{error.get('firstname') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="firstname">firstname</label>
<input type="text" name="firstname" t-attf-class="form-control #{error.get('firstname') and 'is-invalid' or ''}" t-att-value="firstname or partner.firstname" />
</div>
<div t-attf-class="form-group #{error.get('email') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="email">Email</label>
<input type="email" name="email" t-attf-class="form-control #{error.get('email') and 'is-invalid' or ''}" t-att-value="email or partner.email" />
</div>
<div t-attf-class="form-group #{error.get('birthday_date') and 'o_has_error' or ''} col-xl-6">
<!--
<input type="text" name="birthday_date" t-attf-class="form-control #{error.get('birthday_date') and 'is-invalid' or ''}" t-att-value="birthday_date or partner.birthday_date" /> -->
<label class="col-form-label" for="email">Birthday date</label>
<div class="input-group datetime" id="datetimepicker_birthday_date" data-target-input="nearest">
<input type="text" name="birthday_date" t-attf-class="form-control datetimepicker-input #{error.get('birthday_date') and 'is-invalid' or ''}" t-att-value="birthday_date or partner.birthday_date" data-target="#datetimepicker_birthday_date"/>
<div class="input-group-append" data-target="#datetimepicker_birthday_date" data-toggle="datetimepicker">
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
</div>
</div>
</div>
<div class="clearfix" />


Loading…
Cancel
Save