Browse Source

redmine #5 21 24 28 30

master
root 2 years ago
parent
commit
be583aec08
9 changed files with 80 additions and 18 deletions
  1. +1
    -1
      controllers/booking.py
  2. +19
    -4
      models/booking_event_registration.py
  3. +1
    -0
      models/event.py
  4. +19
    -0
      models/partner.py
  5. +18
    -13
      views/booking_event_templates_page_registration.xml
  6. +3
    -0
      views/event.xml
  7. +5
    -0
      views/event_registration.xml
  8. +3
    -0
      views/event_templates_list.xml
  9. +11
    -0
      views/event_templates_page_registration.xml

+ 1
- 1
controllers/booking.py View File

@ -114,7 +114,7 @@ class booking(WebsiteEventController,AuthSignupHome):
return request.redirect('/booking/registration/options?event_id='+str(request.session['event_id']))
#si déjà inscrit, redirection vers page d'information
reg=request.env['event.registration'].sudo().search([('event_id','=',int(post.get('event_id'))),('email','=',post.get('email'))])
reg=request.env['event.registration'].sudo().search([('state','!=','cancel'),('event_id','=',int(post.get('event_id'))),('email','=',post.get('email'))])
if reg and not request.session['individual_booking_event']:
return http.request.render('kalachakra.booking_registration_already_registered')


+ 19
- 4
models/booking_event_registration.py View File

@ -1,4 +1,4 @@
from odoo import models, fields, api
from odoo import models, fields, api,_
from odoo.exceptions import UserError, ValidationError, Warning
from psycopg2 import sql, DatabaseError
from dateutil.relativedelta import relativedelta
@ -124,6 +124,17 @@ class EventRegistration(models.Model):
if rec.down_payment_invoice_id and rec.balance_invoice_id:
rec.to_be_paid_amount=rec.down_payment_invoice_id.amount_residual+rec.balance_invoice_id.amount_residual
def action_cancel(self):
self.write({'state': 'cancel'})
#annulation de la facture liée à l'événement
if self.invoice_id: self.invoice_id.state='cancel'
#annulation des factures de retraites
if self.down_payment_invoice_id: self.down_payment_invoice_id.state='cancel'
if self.balance_invoice_id: self.balance_invoice_id.state='cancel'
def unlink(self):
if self.state!='cancel':raise UserError(_('This action is not allowed, please cancel the registration'))
if self.state=='cancel':raise UserError(_('This action is not allowed,the registration is already canceled'))
def _compute_payment_status(self):
for rec in self:
rec.payment_status='not paid'
@ -138,7 +149,7 @@ class EventRegistration(models.Model):
if rec.down_payment_invoice_state=='paid' and rec.balance_invoice_state=='paid' :rec.payment_status='paid'
if rec.down_payment_invoice_state=='paid' and rec.balance_invoice_state!='paid':rec.payment_status='down payment paid'
if rec.payment_status in('paid','down payment paid'):
if rec.payment_status in('paid','down payment paid') and rec.state!='cancel':
rec.state='open'
@ -455,7 +466,8 @@ class EventRegistration(models.Model):
if event_option:
if status=="super member":price_unit=event_option.booking_option_super_member_price
if status=="member":price_unit=event_option.booking_option_member_price
if status=="not member" and membership_option:price_unit=event_option.booking_option_member_price
if status=="not member" and membership_option and event_option.booking_option_id.membership_product:price_unit=event_option.booking_option_price
if status=="not member" and membership_option and not event_option.booking_option_id.membership_product:price_unit=event_option.booking_option_member_price
if status=="not member" and not membership_option:price_unit=event_option.booking_option_price
if backoffice:
if option.booking_option_id.booking_option_product_backoffice:
@ -716,8 +728,11 @@ class EventRegistration(models.Model):
if event_option:
if status=="super member":price_unit=event_option.booking_option_super_member_price
if status=="member":price_unit=event_option.booking_option_member_price
if status=="not member" and membership_option:price_unit=event_option.booking_option_member_price
if status=="not member" and membership_option and event_option.booking_option_id.membership_product:price_unit=event_option.booking_option_price
if status=="not member" and membership_option and not event_option.booking_option_id.membership_product:price_unit=event_option.booking_option_member_price
if status=="not member" and not membership_option:price_unit=event_option.booking_option_price
if backoffice:
if option.booking_option_id.booking_option_product_backoffice:
price_unit=option.booking_option_price


+ 1
- 0
models/event.py View File

@ -78,6 +78,7 @@ class KalachakraEvent(models.Model):
headphone_option=fields.Boolean('headphone option')
payment_required=fields.Boolean('payment required to valid a registering')
display_invoice=fields.Boolean('display invoice')
teacher_picto=fields.Binary('Teacher picto')
@api.depends('seats_unconfirmed', 'seats_reserved', 'seats_used')
def _compute_seats_expected(self):


+ 19
- 0
models/partner.py View File

@ -103,6 +103,25 @@ class ResPartner(models.Model):
res = super(ResPartner, self).create(values)
country_france=self.env['res.country'].sudo().search([('name','=','France')])
if not res.country_id:res.country_id=country_france.id
#ajout du contact à la mailing liste principale
if res.email:
mailing_contact=self.env['mailing.contact'].sudo().search([('email','=',res.email)],limit=1)
mailing_list=self.env['mailing.list'].sudo().search([('name','=','Newsletter '+self.env.company.name)])
if mailing_list:
if not mailing_contact:
vals={}
vals['email']=res.email
vals['name']=res.name
vals['title_id']=int(res.title)
vals['country_id']=int(res.country_id)
vals['list_ids']=[(4,int(mailing_list.id))]
mailing_contact=self.env['mailing.contact'].sudo().create(vals)
else:
if not mailing_list in mailing_contact.list_ids:
mailing_contact.sudo().write({'list_ids':[(4,int(mailing_list.id))]})
return res
def unlink(self):


+ 18
- 13
views/booking_event_templates_page_registration.xml View File

@ -9,21 +9,26 @@
<template id="event_registration_template" inherit_id="website_event.registration_template">
<xpath expr="//div[@class='o_wevent_sidebar_block'][1]" position="before">
<t t-if="event.teacher_picto">
<img class="image" t-att-src="'data:image/png;base64,%s' % event.teacher_logo" style="border:auto;"/>
</t>
</xpath>
<xpath expr="//div[@class='col-lg-4 pt-3 pt-lg-0 pl-2 pl-lg-0']" position="replace">
<t t-if="event.booking_event">
<div class="col-lg-4 pt-3 pt-lg-0 pl-2 pl-lg-0">
<a t-attf-id="#{event.id}" t-attf-href="/booking/registration/options?event_id={{event.id}}" class="btn btn-primary btn-block" data-original-title="" title="" aria-describedby="tooltip34075">Register</a>
</div>
</t>
<t t-if="event.booking_event">
<div class="col-lg-4 pt-3 pt-lg-0 pl-2 pl-lg-0">
<a t-attf-id="#{event.id}" t-attf-href="/booking/registration/options?event_id={{event.id}}" class="btn btn-primary btn-block" data-original-title="" title="" aria-describedby="tooltip34075">Register</a>
</div>
</t>
<t t-if="not event.booking_event">
<div class="col-lg-4 pt-3 pt-lg-0 pl-2 pl-lg-0">
<a t-attf-id="#{event.id}" t-attf-href="/event/registration/step1?event_id={{event.id}}" class="btn btn-primary btn-block" data-original-title="" title="" aria-describedby="tooltip34075">Register</a>
</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)
</t>
</t>
<t t-if="not event.booking_event">
<div class="col-lg-4 pt-3 pt-lg-0 pl-2 pl-lg-0">
<a t-attf-id="#{event.id}" t-attf-href="/event/registration/step1?event_id={{event.id}}" class="btn btn-primary btn-block" data-original-title="" title="" aria-describedby="tooltip34075">Register</a>
</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)
</t>
</t>
</xpath>
<!-- on bloque la qte à 1 -->
<xpath expr="//select[@class='w-auto custom-select']" position="replace">


+ 3
- 0
views/event.xml View File

@ -227,6 +227,9 @@
</xpath>
<xpath expr="//field[@name='auto_confirm']" position="after">
<field name="teacher_picto" widget='image' />
</xpath>


+ 5
- 0
views/event_registration.xml View File

@ -5,6 +5,11 @@
<field name="model">event.registration</field>
<field name="inherit_id" ref="event.view_event_registration_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='state']" position="replace">
<field name="state" nolabel="1" colspan="2" widget="statusbar" statusbar_visible="draft,open,done,cancel"/>
</xpath>
<xpath expr="//group[@name='attendee']" position="inside">
<field name="online" attrs="{'invisible':[('booking_event','=',True)]}" />


+ 3
- 0
views/event_templates_list.xml View File

@ -106,6 +106,9 @@
<template id="indivividual_booking_link" inherit_id="website_event.index_topbar" active="True" customize_show="True" name="Filter by Tags">
<xpath expr="//div[@class='container']" position="inside">
<t t-if="search_tags.name=='Retraite'">
<u><a style="color:green;font-size:smaller" href="/booking/registration/individual_booking">Cliquez sur ce lien pour vous inscrire à une retraite individuelle</a></u>
</t>
<t t-if="search_tags.name=='retraite'">
<u><a style="color:green;font-size:smaller" href="/booking/registration/individual_booking">Cliquez sur ce lien pour vous inscrire à une retraite individuelle</a></u>
</t>


+ 11
- 0
views/event_templates_page_registration.xml View File

@ -1,6 +1,7 @@
<odoo>
<template id="kalachakra.event_registration_template" inherit_id="website_event.registration_template">
<xpath expr="//div[@class='col-lg-4 pt-3 pt-lg-0 pl-2 pl-lg-0']" position="replace">
<t t-if="event.booking_event">
<div class="col-lg-4 pt-3 pt-lg-0 pl-2 pl-lg-0">
@ -25,6 +26,7 @@
<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)
</t>
@ -70,6 +72,15 @@
<div class="o_wevent_sidebar_block_kala">
<t t-if="not event.individual_booking_event">
<t t-if="event.teacher_picto">
<span class="o_wevent_sidebar_title kala_evt1">Teacher</span>
<br></br>
<div id="picture">
<img t-attf-src="data:image/jpg;base64,{{ event.teacher_picto}}" style="width:100%"/>
</div>
<br></br>
</t>
<span class="o_wevent_sidebar_title kala_evt1">Date &amp; Time</span>
<div class="d-flex">
<span t-field="event.with_context(tz=event.date_tz).date_begin" class="my-1 mr-1 kala_evt1" t-options="{'date_only': 'true', 'format': 'EEEE'}"/>


Loading…
Cancel
Save