Browse Source

payment required

master
root 2 years ago
parent
commit
7885388712
7 changed files with 114 additions and 9 deletions
  1. +29
    -1
      controllers/kalachakra.py
  2. +10
    -0
      models/event.py
  3. +1
    -0
      models/event_registration.py
  4. +3
    -1
      views/booking_event_registration.xml
  5. +3
    -0
      views/event.xml
  6. +8
    -2
      views/event_templates_page_registration.xml
  7. +60
    -5
      views/website_event_registration.xml

+ 29
- 1
controllers/kalachakra.py View File

@ -603,11 +603,29 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
if data['status']=='not member':data['status']='non adhérent'
if data['status']=='member':data['status']='adhérent'
if data['status']=='super member':data['status']='adhérent de soutien'
data['form_action']='step2'
if event.headphone_option :data['form_action']='step1b'
request.session['status']=partner.member_status
return http.request.render('kalachakra.registration_step1',data)
@http.route(['/event/registration/step1b'], type='http', auth='user', website=True, sitemap=False,csrf=False)
def event_registration_step1b(self,event_id,*args,**kw):
data={}
#contact lié à l'utilisateur
userid=request.env.context.get('uid')
user=request.env['res.users'].search([('id','=',int(userid))])
partner=request.env['res.partner'].sudo().search([('id','=',int(user.partner_id))])
data['partner']=partner
#évenement
event=request.env['event.event'].sudo().search([('id','=',int(event_id))])
request.session['event_id']=int(event_id)
data['event']=event
return http.request.render('kalachakra.registration_step1b',data)
@http.route(['/event/registration/step2'], type='http', auth='user', website=True, sitemap=False,csrf=False)
def event_registration_step2(self,event_id,**post):
@ -626,7 +644,10 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
data['event']=event
data['online']=False
data['headphone']=False
if post.get('headphone')=='yes':data['headphone']=True
if event.online_event:
if post.get('online')=='yes':data['online']=True
if event.online_only:data['online']=True
@ -656,6 +677,9 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
vals={}
vals['event_id']=request.session['event_id']
vals['partner_id']=request.session['partner_id']
if post.get('headphone')=='yes':vals['headphone']=True
else:vals['headphone']=False
if event.online_event:
if post.get('online')=='yes':vals['online']=True
else:vals['online']=False
@ -670,6 +694,10 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
membership=False
invoice_id=request.env['event.registration'].sudo().action_generate_participation_invoice(int(res.id),'CB',membership)
else:
data['headphone']=True
if post.get('headphone')=='yes':data['headphone']=True
res.headphone=True
request.session['res_id']=res.id


+ 10
- 0
models/event.py View File

@ -74,6 +74,8 @@ class KalachakraEvent(models.Model):
city=fields.Char('city', related="address_id.city")
no_online_payment=fields.Boolean('no online payment')
no_onthespot_payment=fields.Boolean('no on the spot payment')
headphone_option=fields.Boolean('headphone option')
payment_required=fields.Boolean('payment required to valid a registering')
@api.depends('seats_unconfirmed', 'seats_reserved', 'seats_used')
def _compute_seats_expected(self):
@ -269,8 +271,16 @@ class KalachakraEvent(models.Model):
dup.add_event_to_google_agenda()
hour_end=end_date_event.hour
minute_end=end_date_event.minute
hour_start=start_date_event.hour
minute_start=start_date_event.minute
end_date_event=end_date_event+timedelta(days=d)
end_date_event.replace(hour=hour_end, minute=minute_end)
start_date_event=start_date_event+timedelta(days=d)
start_date_event.replace(hour=hour_start, minute=minute_start)
i=i+1


+ 1
- 0
models/event_registration.py View File

@ -13,6 +13,7 @@ class EventRegistration(models.Model):
onthespot_payment=fields.Boolean(string='On the spot payment')
free_participation=fields.Boolean(related='event_id.free_participation')
with_membership=fields.Boolean('with membership')
headphone=fields.Boolean('headphone')
def create(self,vals):


+ 3
- 1
views/booking_event_registration.xml View File

@ -88,7 +88,7 @@
<field name="train_arrival_date" widget="date" attrs="{'invisible':[('booking_event','!=',True)]}"/>
<field name="train_arrival_time" widget="float_time" attrs="{'invisible':[('booking_event','!=',True)]}"/>
<field name="image_permission" attrs="{'invisible':[('booking_event','!=',True)]}"/>
<field name="headphone" invisible="context.get('booking_view')==True"/>
</xpath>
<xpath expr="//div[@name='button_box']" position="inside">
@ -245,6 +245,7 @@
</xpath>
<xpath expr="//field[@name='event_ticket_id']" position="replace">
<field name="online" invisible="context.get('booking_view')==True"/>
<field name="headphone" invisible="context.get('booking_view')==True"/>
<!-- <field name="invoice_options" invisible="context.get('booking_view')==False"/>
<field name="invoice_options_amount" invisible="context.get('booking_view')==False"/>
<field name="membership_amount" invisible="context.get('booking_view')==False"/>
@ -264,6 +265,7 @@
</xpath>
<xpath expr="//button[@name='action_confirm']" position="replace">


+ 3
- 0
views/event.xml View File

@ -155,6 +155,7 @@
<field name="online_event" attrs="{'invisible':[('booking_event','=',True)]}"/>
<field name="no_online_payment" attrs="{'invisible':[('booking_event','=',True)]}"/>
<field name="no_onthespot_payment" invisible="context.get('booking_event_view')"/>
<field name="payment_required" invisible="context.get('booking_event_view')"/>
<field name="online_only" attrs="{'invisible':[('booking_event','=',True)]}"/>
<field name="free_participation" attrs="{'invisible':[('booking_event','=',True)]}"/>
<field name="recurring_event" attrs="{'invisible':[('booking_event','=',True)]}"/>
@ -166,6 +167,8 @@
<field name="recurring_event_newsletter_id" attrs="{'invisible':[('booking_event','=',True)]}"/>
<field name="find_out_more_link"/>
<field name="headphone_option"/>
</xpath>


+ 8
- 2
views/event_templates_page_registration.xml View File

@ -12,12 +12,18 @@
<t t-if="event.online_event and not event.online_only">
<a t-attf-id="#{event.id}" t-attf-href="/event/registration/step1?event_id={{event.id}}" class="btn btn-secondary btn-block" data-original-title="" title="" aria-describedby="tooltip34075">Register</a>
</t>
<t t-if="event.online_only">
<t t-if="event.online_only and not event.heaphone_option">
<a t-attf-id="#{event.id}" t-attf-href="/event/registration/step2?event_id={{event.id}}" class="btn btn-secondary btn-block" data-original-title="" title="" aria-describedby="tooltip34075">Register</a>
</t>
<t t-if="not event.online_event and not event.online_only">
<t t-if="not event.online_event and not event.online_only and not event.headphone_option">
<a t-attf-id="#{event.id}" t-attf-href="/event/registration/step2?event_id={{event.id}}" class="btn btn-secondary btn-block" data-original-title="" title="" aria-describedby="tooltip34075">Register</a>
</t>
<t t-if="event.online_only and event.heaphone_option">
<a t-attf-id="#{event.id}" t-attf-href="/event/registration/step2?event_id={{event.id}}" class="btn btn-secondary btn-block" data-original-title="" title="" aria-describedby="tooltip34075">Register</a>
</t>
<t t-if="not event.online_event and not event.online_only and event.headphone_option">
<a t-attf-id="#{event.id}" t-attf-href="/event/registration/step1b?event_id={{event.id}}" class="btn btn-secondary btn-block" data-original-title="" title="" aria-describedby="tooltip34075">Register</a>
</t>
</div>
<t t-if="event.seats_limited and event.seats_max and event.seats_available &lt;= (event.seats_max * 0.2)">
(only <t t-esc="event.seats_available"/> available)


+ 60
- 5
views/website_event_registration.xml View File

@ -2,12 +2,42 @@
<template id="assets_frontend" name="booking assets" inherit_id="web.assets_frontend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/kalachakra/static/js/kalachakra.js"></script>
</xpath>
</template>
<template id="kalachakra.registration_step1b" name="Form">
<t t-call="website.layout">
<div class="container-fluid">
<br>
</br>
<form t-att-action="'step2?event_id='+str(event.id)" method="post" class="form js_website_submit_form">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class=" col-sm-auto s_website_form_label " style="width: 200px" for="headphone">
<span class="s_website_form_label_content">I need a tibetan to english translation</span>
</label>
<div class="col-sm">
<input type="checkbox" value="yes" class="s_website_form_input" name="headphone" id="headphone"/>
</div>
</div>
<br></br>
<button id="back_button1" type="button" class="btn btn-warning" >back</button>
<button type="submit" class="btn btn-primary" >Continue</button>
</form>
</div>
</t>
</template>
<template id="kalachakra.registration_step1" name="Distancial Event Form">
<t t-call="website.layout">
@ -33,8 +63,11 @@
</h7>
<br></br>
<form t-att-action="'step2?event_id='+str(event.id)" method="post" class="form js_website_submit_form">
<form t-att-action="form_action+'?event_id='+str(event.id)" method="post" class="form js_website_submit_form">
<label class=" col-sm-auto s_website_form_label " style="width: 200px" for="2bp1hybvcoe">
<span class="s_website_form_label_content"></span>
@ -69,6 +102,7 @@
<br></br>
<br></br>
<button id="back_button1" type="button" class="btn btn-warning" >back</button>
<button type="submit" class="btn btn-primary" >Continue</button>
<br></br>
@ -103,12 +137,33 @@
</h7>
<br></br>
<br></br>
<t t-if="not already_registered">
<t t-if="not already_registered and not event.payment_required">
<h7>your registration is taken into account !</h7>
<br></br>
<h7>You will soon receive a confirmation email.</h7>
</t>
<t t-if="already_registered">
<t t-if="not already_registered and event.payment_required">
<h7>Your registration request has been taken into account and will be validated after your payment.</h7>
<br></br>
<h7>You will soon receive a confirmation email.</h7>
</t>
<t t-if="already_registered and event.payment_required and payment_status=='paid'">
<h7><b>You are already registered</b></h7>
<t t-if="payment_status=='paid'">
<br></br>
<h7>You have already paid</h7>
</t>
</t>
<t t-if="already_registered and event.payment_required and payment_status!='paid'">
<h7><b>Your registration request has already been taken into account </b></h7>
<br></br>
<h7><b>and will be validated after your payment. </b></h7>
</t>
<t t-if="already_registered and not event.payment_required">
<h7><b>You are already registered</b></h7>
<t t-if="payment_status=='paid'">
<br></br>


Loading…
Cancel
Save