root 2 years ago
parent
commit
97c9fb051b
12 changed files with 148 additions and 78 deletions
  1. +1
    -0
      __manifest__.py
  2. +2
    -3
      controllers/booking.py
  3. +1
    -0
      models/__init__.py
  4. +19
    -11
      models/booking_event.py
  5. +14
    -0
      models/booking_parameter.py
  6. +23
    -23
      models/event_registration.py
  7. +2
    -0
      security/ir.model.access.csv
  8. +37
    -39
      static/js/booking.js
  9. +42
    -0
      views/booking_parameter.xml
  10. +4
    -0
      views/booking_website_registration.xml
  11. +2
    -2
      views/event.xml
  12. +1
    -0
      wizard/accounting_file_wizard.py

+ 1
- 0
__manifest__.py View File

@ -54,6 +54,7 @@
'views/individual_booking_website_registration.xml',
'views/booking_registration.xml',
'views/booking_location.xml',
'views/booking_parameter.xml',
'views/booking_room.xml',
'views/booking_questionnaire.xml',
'views/mailing_list.xml',


+ 2
- 3
controllers/booking.py View File

@ -40,7 +40,8 @@ class booking(WebsiteEventController,AuthSignupHome):
request.session['event_id']=int(event_id)
event=request.env['event.event'].sudo().search([('id','=',int(event_id))])
data['event']=event
data['bottom_text']=request.env['booking.parameter'].search([('name','=','bottom_text')]).value
request.session['individual_booking_event']=event.individual_booking_event
data['individual_booking_event']=event.individual_booking_event
@ -93,8 +94,6 @@ class booking(WebsiteEventController,AuthSignupHome):
#questions
data['questions']=event.question_ids
request.session['invoice_id']=False
return http.request.render('kalachakra.booking_registration_options_form',data)


+ 1
- 0
models/__init__.py View File

@ -16,6 +16,7 @@ from . import booking_room
from . import booking_questionnaire
from . import booking_event_registration
from . import booking_donation
from . import booking_parameter
#from . import booking_sale_order
from . import event_media_link
from . import mailing_list


+ 19
- 11
models/booking_event.py View File

@ -117,18 +117,26 @@ class BookingEvent(models.Model):
header_ligne='Nom & Prénom;Genre;Rôle;Options;Montant retraite;Adhésion;Autre options;Montant à payer;Statut commande;Type de paiement;Règlement\n'
csv_lines=''
for reg in booking.registration_ids:
if reg.state in ('draft','cancel'): continue
name=str(reg.name)
if reg.firstname:name=name+' '+str(reg.firstname)
gender=str(reg.gender)
if reg.gender=='male':gender='homme'
elif reg.gender=='femelle':gender='femme'
else:gender='N/A'
role=self._compute_member_status(reg)
if role=='not member':role='non adhérent'
elif role=='member':role='adhérent'
elif role=='super member':role='membre de soutien'
else: role='N/A'
options=self._compute_invoice_options(reg)
booking_amount=self._compute_booking_amount(reg)
membership_amount=self._compute_membership_amount(reg)
invoice_options_amount= self._compute_invoice_options_amount(reg)
amount_to_be_paid=self._compute_amount_to_be_paid(reg)
booking_amount=str(round(self._compute_booking_amount(reg)))
membership_amount=str(round(self._compute_membership_amount(reg)))
invoice_options_amount= str(round(self._compute_invoice_options_amount(reg)))
amount_to_be_paid=str(round(self._compute_amount_to_be_paid(reg)))
payment_status=str(reg.payment_status)
payment_mode=self._compute_payment_mode(reg)
amount_paid=self._compute_amount_paid(reg)
amount_paid=str(round(self._compute_amount_paid(reg)))
csv_lines=csv_lines+name+';'+gender+';'+role+';'+options+';'+booking_amount+';'+membership_amount+';'+invoice_options_amount+';'+amount_to_be_paid+';'+payment_status+';'+payment_mode+';'+amount_paid+'\n'
@ -155,7 +163,7 @@ class BookingEvent(models.Model):
if rec.end_of_stay_invoice_id:
amount_paid=amount_paid+rec.end_of_stay_invoice_id.amount_total-rec.end_of_stay_invoice_id.amount_residual
return str(amount_paid)
return amount_paid
def _compute_amount_to_be_paid(self,rec):
amount_to_be_paid=0
@ -167,7 +175,7 @@ class BookingEvent(models.Model):
amount_to_be_paid=amount_to_be_paid+rec.balance_invoice_id.amount_residual
if rec.end_of_stay_invoice_id:
amount_to_be_paid=amount_to_be_paid+rec.end_of_stay_invoice_id.amount_residual
return str(amount_to_be_paid)
return amount_to_be_paid
def _compute_invoice_options_amount(self,rec):
membership_product=self.env['product.product'].sudo().search([('membership_product','=',True)],limit=1)
@ -200,7 +208,7 @@ class BookingEvent(models.Model):
invoice_options_amount=invoice_options_amount+line.price_subtotal
i=i+1
return str(invoice_options_amount)
return invoice_options_amount
def _compute_booking_amount(self,rec):
membership_product=self.env['product.product'].sudo().search([('membership_product','=',True)],limit=1)
@ -227,7 +235,7 @@ class BookingEvent(models.Model):
booking_amount=booking_amount+line.price_subtotal
break
return str(booking_amount)
return booking_amount
def _compute_member_status(self,reg):
@ -262,7 +270,7 @@ class BookingEvent(models.Model):
if line.name==membership_product.name:
membership_amount=line.price_subtotal
return str(membership_amount)
return membership_amount
def _compute_invoice_options(self,rec):


+ 14
- 0
models/booking_parameter.py View File

@ -0,0 +1,14 @@
from odoo import models, fields, api
class booking_parameter(models.Model):
_name = 'booking.parameter'
_description = 'booking parameters'
name = fields.Char()
value= fields.Text()

+ 23
- 23
models/event_registration.py View File

@ -42,30 +42,30 @@ class EventRegistration(models.Model):
# vals['booking_option_price']=option.booking_option_price
# vals['event_registration_id']=int(reg.id)
# res=self.env['event.registration_option'].create(vals)
else:
#inscription à la newsletter attachée à l'événement
#si pas une retraite et présence d'une newletter rattaché à l'événement
if reg.event_id.recurring_event_newsletter_id:
mailing_contact=self.env['mailing.contact'].sudo().search([('email','=',reg.partner_id.email)],limit=1)
#si le contact n'existe pas comme mailing contact, création
if not mailing_contact:
vals={}
vals['email']=reg.partner_id.email
vals['name']=reg.partner_id.name
vals['title_id']=int(reg.partner_id.title)
vals['country_id']=int(reg.partner_id.country_id)
vals['list_ids']=[(4,int(reg.event_id.recurring_event_newsletter_id))]
mailing_contact=self.env['mailing.contact'].sudo().create(vals)
else:
#si le contact existe, si la liste de diffusion n'est pas lié au contact, on l'ajoute
if not reg.event_id.recurring_event_newsletter_id in mailing_contact.list_ids:
mailing_contact.sudo().write({'list_ids':[(4,int(reg.event_id.recurring_event_newsletter_id))]})
#inscription à la newsletter attachée à l'événement
#si pas une retraite et présence d'une newletter rattaché à l'événement
if reg.event_id.recurring_event_newsletter_id:
mailing_contact=self.env['mailing.contact'].sudo().search([('email','=',reg.partner_id.email)],limit=1)
#si le contact n'existe pas comme mailing contact, création
if not mailing_contact:
vals={}
vals['email']=reg.partner_id.email
vals['name']=reg.partner_id.name
vals['title_id']=int(reg.partner_id.title)
vals['country_id']=int(reg.partner_id.country_id)
vals['list_ids']=[(4,int(reg.event_id.recurring_event_newsletter_id))]
mailing_contact=self.env['mailing.contact'].sudo().create(vals)
else:
#si le contact existe, si la liste de diffusion n'est pas lié au contact, on l'ajoute
if not reg.event_id.recurring_event_newsletter_id in mailing_contact.list_ids:
mailing_contact.sudo().write({'list_ids':[(4,int(reg.event_id.recurring_event_newsletter_id))]})
#inscription à la newsletter générale
mailing_list=self.env['mailing.list'].sudo().search([('name','=','Newsletter '+self.env.company.name)])
if mailing_list:
if not mailing_list in mailing_contact.list_ids:
mailing_contact.sudo().write({'list_ids':[(4,int(mailing_list.id))]})
#inscription à la newsletter générale
mailing_list=self.env['mailing.list'].sudo().search([('name','=','Newsletter '+self.env.company.name)])
if mailing_list:
if not mailing_list in mailing_contact.list_ids:
mailing_contact.sudo().write({'list_ids':[(4,int(mailing_list.id))]})
return reg


+ 2
- 0
security/ir.model.access.csv View File

@ -5,6 +5,8 @@ access_kalachakra_membership_import,kalachakra.membership_import,model_kalachakr
access_booking_booking_option,booking.booking_option,model_booking_option,base.group_user,1,1,1,1
access_booking_location,booking.booking_location,model_booking_location,base.group_user,1,1,1,1
access_booking_parameter,booking.booking_parameter,model_booking_parameter,base.group_user,1,1,1,1
access_booking_room,booking.booking_room,model_booking_room,base.group_user,1,1,1,1
access_booking_room_occupation,booking.booking_room_occupation,model_booking_room_occupation,base.group_user,1,1,1,1


+ 37
- 39
static/js/booking.js View File

@ -311,61 +311,59 @@ odoo.define('booking.main', function (require) {
});
$( "#continue_button" ).click(function() {
if ($('#email').val()=='' && $('#mobile').val()=='' && $('#phone').val()=='')
if ($('#email').val()=='')
{
$('#validation_message').text('merci de saisir un email ou un mobile ou un téléphone')
$('#validation_message').show()
}
else
else if ($('#mobile').val()=='' && $('#phone').val()=='')
{
$('#validation_message').text('afin de pouvoir vous contacter merci de saisir un mobile ou un téléphone')
$('#validation_message').show()
}
else if ($('#name').val()=='')
{
if ($('#name').val()=='')
{
$('#validation_message').text('merci de saisir un nom')
$('#validation_message').show()
}
else if ($('#firstname').val()=='')
{
}
else if ($('#firstname').val()=='')
{
$('#validation_message').text('merci de saisir un prénom')
$('#validation_message').show()
}
else if ($('#age').val()=='')
{
$('#validation_message').text('merci de saisir l\'age du participant')
$('#validation_message').show()
}
else if ($('#city').val()=='')
{
$('#validation_message').text('merci de saisir la ville du participant')
$('#validation_message').show()
}
else if ($('#gender').val()=='')
{
$('#validation_message').text('merci de sélectionner le sexe du participant')
$('#validation_message').show()
}
// else if ($("#pre_registration_required").length>0 && !$('input[name=pre_registration_required]').is(':checked') )
// {
// $('#validation_message').text("Vous n'avez pas cocher la case 'J'ai bien reçu le mail de confirmation suite à ma pré-inscription'")
// $('#validation_message').show()
// }
else
{
$('#form1').submit()
}
}
else if ($('#age').val()=='')
{
$('#validation_message').text('merci de saisir l\'age du participant')
$('#validation_message').show()
}
else if ($('#city').val()=='')
{
$('#validation_message').text('merci de saisir la ville du participant')
$('#validation_message').show()
}
else if ($('#gender').val()=='')
{
$('#validation_message').text('merci de sélectionner le sexe du participant')
$('#validation_message').show()
}
else
{
$('#form1').submit()
}
});
$( "#continue_button2" ).click(function() {


+ 42
- 0
views/booking_parameter.xml View File

@ -0,0 +1,42 @@
<odoo>
<data>
<!-- explicit list view definition -->
<record model="ir.ui.view" id="parameter_list">
<field name="name">booking_parameter list</field>
<field name="model">booking.parameter</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="value"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="parameter_form">
<field name="name">booking_parameter form</field>
<field name="model">booking.parameter</field>
<field name="arch" type="xml">
<form>
<group>
<field name="name"/>
<field name="value" widget="text"/>
</group>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="parameter_action">
<field name="name">parameters</field>
<field name="res_model">booking.parameter</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="booking_parameter_menu" action="parameter_action"
parent="booking_title_menu" groups="event.group_event_user" sequence="1"/>
</data>
</odoo>

+ 4
- 0
views/booking_website_registration.xml View File

@ -56,6 +56,7 @@
<td><input type="checkbox" name="pre_registration_required" id="pre_registration_required" style="width: 30px; height: 30px;" /></td>
</table>
</t>
<br></br>
<t t-if="not options">
<input type="hidden" name="nb_o" value="0"/>
@ -333,6 +334,9 @@
</div>
</div>
<h6 id='validation_message' style='display:none;color:red'>Please enter an email or a phone or a mobile</h6>
<div><span t-esc="bottom_text" style='color:red'></span></div>
<button id="back_button1" type="button" class="btn btn-warning" >back</button>
<button id="continue_button" type="button" class="btn btn-primary" >Continue</button>
<br/>


+ 2
- 2
views/event.xml View File

@ -60,7 +60,7 @@
<field name="free_participation" invisible="context.get('booking_event_view')"/>
<field name="participation_product_id" invisible="context.get('booking_event_view')"/>
<field name="recurring_event" invisible="context.get('booking_event_view')"/>
<field name="recurring_event_newsletter_id" invisible="context.get('booking_event_view')"/>
<field name="recurring_event_newsletter_id"/>
<field name="find_out_more_link" invisible="context.get('booking_event_view')"/>
<field name="online_link" invisible="context.get('booking_event_view')"/>
<field name="online_id" invisible="context.get('booking_event_view')"/>
@ -174,7 +174,7 @@
<field name="end_generation_date" widget="date" attrs="{'invisible':['|',('booking_event','=',True),('recurring_event','=',False)]}"/>
<field name="parent_event_id" attrs="{'invisible':['|',('booking_event','=',True),('recurring_event','=',False)]}"/>
<field name="recurring_event_newsletter_id" attrs="{'invisible':[('booking_event','=',True)]}"/>
<field name="recurring_event_newsletter_id"/>
<field name="find_out_more_link"/>
<field name="headphone_option"/>


+ 1
- 0
wizard/accounting_file_wizard.py View File

@ -401,6 +401,7 @@ class AccountingFileWizard(models.TransientModel):
for d in donations:
donation_amount+=d.amount_total
if self._payment_date_date(reg.invoice_id):continue
date_line=self._payment_date(reg.invoice_id)
trans=self.env['payment.transaction'].search([('state','=','done'),('invoice_ids','in',reg.invoice_id.id)],limit=1)


Loading…
Cancel
Save