Browse Source

corrections

dev-rcn
root 3 years ago
parent
commit
a154f60e31
11 changed files with 76 additions and 21 deletions
  1. +1
    -0
      __manifest__.py
  2. +20
    -6
      controllers/kalachakra.py
  3. +26
    -6
      models/event.py
  4. +1
    -1
      models/event_registration.py
  5. +1
    -1
      static/js/kalachakra.js
  6. +12
    -0
      views/account_portal_templates.xml
  7. +3
    -2
      views/booking_website_registration.xml
  8. +4
    -0
      views/event.xml
  9. +4
    -1
      views/event_templates_page_registration.xml
  10. +1
    -1
      views/website_event_registration.xml
  11. +3
    -3
      views/website_participation.xml

+ 1
- 0
__manifest__.py View File

@ -56,6 +56,7 @@
'views/booking_questionnaire.xml',
'views/mailing_list.xml',
'views/ir.attachment.xml',
'views/account_portal_templates.xml'
],


+ 20
- 6
controllers/kalachakra.py View File

@ -248,6 +248,7 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
user=request.env['res.users'].search([('id','=',int(userid))])
partner=request.env['res.partner'].sudo().search([('id','=',int(user.partner_id))])
request.session['partner_id']=int(partner.id)
request.session['status']=partner.member_status
data['partner']=partner
#évenement
@ -271,7 +272,8 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
membership_product=request.env['product.product'].sudo().search([('membership_product','=',True)],limit=1)
if not membership_product: raise UserError(_('No membership product, please add one'))
data['membership_amount']=membership_product.list_price
data['membership_and_participation_amount']=data['membership_amount']+data['participation_amount']
data['standard_amount']=event.participation_standard_price
data['membership_and_participation_amount']=str(int(data['membership_amount'])+int(event.participation_member_price)) +' ('+str(int(data['membership_amount']))+'+'+str(int(event.participation_member_price))+')'
#enregistrement de l'inscription si pas déjà inscrit :
res=request.env['event.registration'].sudo().search([('event_id','=',int(request.session['event_id'])),('partner_id','=',int(request.session['partner_id']))],limit=1)
@ -314,6 +316,14 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
data={}
request.session['kalachakra_transaction']=''
# acquirers = request.env['payment.acquirer'].sudo().search([
# ('state', 'in', ['enabled', 'test']),
# ('company_id', '=', request.env.company.id)])
# result=''
# for ac in acquirers:
# result=result+' '+ac.provider
# return result
if type=='participation':
res=request.env['event.registration'].sudo().search([('id','=',request.session['res_id'])])
invoice_id=res.invoice_id
@ -406,6 +416,7 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
data['registred']=True
country=request.env['res.country'].sudo().search([])
data['countries']=country
data['country_id']=int(partner.country_id)
# si pas connecté
else:
@ -420,7 +431,7 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
partner=request.env['res.partner']
partner.email=''
partner.title=title_male.id
partner.country_id=country_france.id
partner.country_id=int(country_france.id)
partner.firstname=''
partner.name=''
@ -429,7 +440,7 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
partner.zip=''
data['partner']=partner
data['country_id']=int(country_france.id)
return http.request.render('kalachakra.participation_form',data)
@ -470,8 +481,10 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
#si pas connecté on cherche le contact indiqué par l'email
partner=request.env['res.partner'].sudo().search([('email','=',post.get('email'))],limit=1)
#si pas de contact on le créé dans la base
if not partner:
vals={}
vals['email']=post.get('email')
vals['name']=post.get('name')
@ -483,7 +496,7 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
vals['country_id']=int(post.get('country_id'))
vals['phone']=post.get('phone')
partner=request.env['res.partner'].sudo().create(vals)
#création du compte utilisateur
user=request.env['res.users'].sudo().search([('email','=',partner.email)])
group_portal=request.env.ref('base.group_portal')
if not user:
@ -511,6 +524,7 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
vals['country_id']=int(post.get('country_id'))
vals['phone']=post.get('phone')
partner.sudo().write(vals)
user=request.env['res.users'].sudo().search([('email','=',partner.email)])
group_portal=request.env.ref('base.group_portal')
#création du compte utilisateur
@ -524,7 +538,7 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
})
user.sudo().action_reset_password()
#on vérifie qu'il n'est pas déjà adhérent si demande d'adhésion
#demande d'adhésion : on vérifie qu'il n'est pas déjà adhérent si demande d'adhésion
if partner.member_status in ('member','super member') and request.session['kalachakra_transaction']=='membership':
data={}
data['email']==post.get('email')
@ -548,7 +562,7 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
('company_id', '=', request.env.company.id),
('provider', '!=', 'transfer')
]))
],order="provider desc"))
else:
data['acquirers'] = list(request.env['payment.acquirer'].sudo().search([
('state', 'in', ['enabled', 'test']),


+ 26
- 6
models/event.py View File

@ -55,7 +55,8 @@ class KalachakraEvent(models.Model):
recurring_event=fields.Boolean('Recurring event')
recurring_event_newsletter_id=fields.Many2one('mailing.list',string='Recurring event Newsletter')
online_event=fields.Boolean('Online event')
onthespot_event=fields.Boolean('Online event')
onthespot_event=fields.Boolean('On the spot event', default=True)
online_only=fields.Boolean('Online only')
online_link=fields.Char('link')
online_id=fields.Char('id')
online_password=fields.Char('password',default='123456')
@ -97,10 +98,11 @@ class KalachakraEvent(models.Model):
child_event.auto_confirm=self.auto_confirm
child_event.seats_limited=self.seats_limited
child_event.seats_max=self.seats_max
if vals.get('organizer_id'):child_event.organizer_id=self.organizer_id
child_event.user_id=self.user_id
child_event.address_id=self.address_id
child_event.online_only=self.online_only
child_event.online_event=self.online_event
child_event.online_link=self.online_link
child_event.online_id=self.online_id
@ -111,6 +113,11 @@ class KalachakraEvent(models.Model):
child_event.tag_ids=self.tag_ids
child_event.description=self.description
child_event.is_published=self.is_published
child_event.participation_product_id=self.participation_product_id
child_event.participation_standard_price=self.participation_standard_price
child_event.participation_member_price=self.participation_member_price
child_event.participation_super_member_price=self.participation_super_member_price
#child_event.event_mail_ids=self.event_mail_ids
@ -136,8 +143,21 @@ class KalachakraEvent(models.Model):
# if reg:
# return str(e.date_begin)
e.unlink()
def remove_generated_calendar_events(self):
evt=self.env['event.event'].search([('parent_event_id','=', self.id)])
if evt:
for e in evt:
if e.calendar_id and e.calendar_event_id:
e.remove_event_from_google_agenda()
def generate_calendar_events(self):
self.remove_generated_calendar_events()
evt=self.env['event.event'].search([('parent_event_id','=', self.id)])
if evt:
for e in evt:
e.add_event_to_google_agenda()
def generate_events(self):
for rec in self:
@ -401,7 +421,7 @@ class KalachakraEvent(models.Model):
self.calendar_id=tag.category_id.calendar_id
if not calendar_find: raise Warning('operation cancelled: no calendar id find, please selected a label wih category with a calendar_id')
def remove_event_from_google_agenda(self):
credentials = service_account.Credentials.from_service_account_file(GOOGLE_ACCOUNT_FILE, scopes=SCOPES)


+ 1
- 1
models/event_registration.py View File

@ -112,7 +112,7 @@ class EventRegistration(models.Model):
#creation des écritures comptable
name=event.participation_product_id.name
if membership and status=='not member':
product_price=product_price+membership_product.list_price
product_price=event.participation_member_price+membership_product.list_price
name=event.participation_product_id.name+"+"+membership_product.name
vals={}
account_credit=self.env['account.account'].search([('code','=','707100')])


+ 1
- 1
static/js/kalachakra.js View File

@ -56,7 +56,7 @@ odoo.define('kalachakra.main', function (require) {
//vérification montant
if ($("#amount_id").val()==0)
{
alert('please enter an amount')
alert('merci de saisir un montant')
}
else
{


+ 12
- 0
views/account_portal_templates.xml View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="portal_invoice_page" name="Invoice Portal Template" inherit_id="account.portal_invoice_page">
<xpath expr="//div[1][@class='small']" position="replace">
</xpath>
<xpath expr="//li[2][@class='list-group-item flex-grow-1']" position="replace">
</xpath>
</template>
</odoo>

+ 3
- 2
views/booking_website_registration.xml View File

@ -206,8 +206,8 @@
</label>
<div class="form-group s_website_form_field col-8 s_website_form_custom">
<select id="medical_concern" name="medical_concern" class="form-control s_website_form_input">
<option name="medical_concern" value="have medical concern" label="J'ai un soucis médical à signaler"></option>
<option name="medical_concern" selected="selected" value="have no medical concern" label="Je n'ai pas de soucis médical à signaler"></option>
<option name="medical_concern" value="have medical concern" label="J'ai un souci médical à signaler"></option>
<option name="medical_concern" selected="selected" value="have no medical concern" label="Je n'ai pas de souci médical à signaler"></option>
<option name="medical_concern" value="no answer" label="Je ne veux pas répondre"></option>
@ -227,6 +227,7 @@
</div>
</div>
</div>
<h6>Please provide us with the contact details of a loved one in the event of a problem encountered during your stay:</h6>
<div class="form-group s_website_form_field col-6 s_website_form_custom" data-type="char" data-name="Field">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="9ois9pkv0wv">


+ 4
- 0
views/event.xml View File

@ -23,6 +23,7 @@
<field string="calendar event id" name="calendar_event_id"/>
<field name="online_event"/>
<field name="onthespot_event"/>
<field name="free_participation"/>
<field name="participation_product_id"/>
<field name="recurring_event"/>
@ -45,6 +46,8 @@
<button name="add_event_to_google_agenda" type="object" attrs="{'invisible':[('calendar_event_id','!=',False)]}" string="Add event to google agenda" class="btn btn-warning"/>
<button name="remove_event_from_google_agenda" attrs="{'invisible':[('calendar_event_id','=',False)]}" type="object" string="Remove event from google agenda" class="btn btn-danger"/>
<button name="generate_calendar_events" attrs="{'invisible':[('generated_events','=',False)]}" type="object" string="Add all event to google agenda" class="btn btn-primary"/>
<button name="generate_events" attrs="{'invisible':['|',('generated_events','=',True),'|','|',('frequency','=',False),('end_generation_date','=',False),('parent_event_id','!=',False)]}" type="object" string="generate the events" class="btn btn-primary"/>
<button name="remove_generated_events" attrs="{'invisible':['|',('generated_events','=',False),'|','|',('frequency','=',False),('end_generation_date','=',False),('parent_event_id','!=',False)]}" type="object" string="remove generated events" class="btn btn-danger"/>
@ -59,6 +62,7 @@
<field name="online_event" attrs="{'invisible':[('booking_event','=',True)]}"/>
<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)]}"/>


+ 4
- 1
views/event_templates_page_registration.xml View File

@ -9,9 +9,12 @@
</t>
<t t-if="not event.booking_event">
<div class="col-lg-4 pt-3 pt-lg-0 pl-2 pl-lg-0">
<t t-if="event.online_event">
<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-primary btn-block" data-original-title="" title="" aria-describedby="tooltip34075">Register</a>
</t>
<t t-if="event.online_only">
<a t-attf-id="#{event.id}" t-attf-href="/event/registration/step2?event_id={{event.id}}" class="btn btn-primary btn-block" data-original-title="" title="" aria-describedby="tooltip34075">Register</a>
</t>
<t t-if="not event.online_event">
<a t-attf-id="#{event.id}" t-attf-href="/event/registration/step2?event_id={{event.id}}" class="btn btn-primary btn-block" data-original-title="" title="" aria-describedby="tooltip34075">Register</a>
</t>


+ 1
- 1
views/website_event_registration.xml View File

@ -118,7 +118,7 @@
<br></br>
<br></br>
<t t-if="event.online_event">
<t t-if="online==true">
<t t-if="online==true or event.online_only">
<font color="blue">
<h7>Here is the information to attend on Zoom :</h7>
<br></br>


+ 3
- 3
views/website_participation.xml View File

@ -16,7 +16,7 @@
<div class="container-fluid">
<form id="form" action="payment_choice" method="post" class="form js_website_submit_form">
<t t-if="title=='make donation'">
<h6 class="mt16 mb4">Make donation :</h6>
<!-- <h6 class="mt16 mb4">Make donation :</h6> -->
<h6>The Kalachakra Center thanks you for your donation.<br></br>We invite you to fill in the following fields :</h6>
</t>
<t t-if="title=='Become a member'">
@ -95,8 +95,8 @@ reduced participation for pensions in the Sarthe.</h6>
<select id="country_id" name="country_id" class="o_wpayment_fee_impact form-control ">
<t t-foreach="countries" t-as="country">
<option t-att-selected="'selected' if int(country.id)==int(partner.country_id) else None" t-att-value="country.id" t-esc="country.name"></option>
<option t-att-selected="country.id==country_id" t-att-value="country.id" t-esc="country.name"></option>
</t>


Loading…
Cancel
Save