Browse Source

#106 107 108

master
root 2 years ago
parent
commit
72a79c590c
14 changed files with 355 additions and 74 deletions
  1. +131
    -10
      controllers/kalachakra.py
  2. +92
    -0
      i18n/fr.po
  3. +1
    -1
      models/accounting_file.py
  4. +4
    -1
      models/event_registration.py
  5. +13
    -0
      models/membership.py
  6. +15
    -3
      models/partner.py
  7. +1
    -1
      models/res_users.py
  8. +1
    -0
      views/accounting_file.xml
  9. +5
    -13
      views/event_templates_page_registration.xml
  10. +2
    -1
      views/partner.xml
  11. +19
    -5
      views/portal_templates.xml
  12. +29
    -16
      views/website_event_registration.xml
  13. +41
    -23
      wizard/accounting_file_wizard.py
  14. +1
    -0
      wizard/accounting_file_wizard.xml

+ 131
- 10
controllers/kalachakra.py View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from odoo import http,_ from odoo import http,_
from odoo.http import request from odoo.http import request
import requests
from odoo.osv import expression from odoo.osv import expression
import logging import logging
from odoo import models, fields, api from odoo import models, fields, api
@ -18,6 +19,7 @@ from odoo.addons.website_event.controllers.main import WebsiteEventController
from odoo.addons.website.controllers.main import QueryURL from odoo.addons.website.controllers.main import QueryURL
from odoo.addons.payment.controllers.portal import PaymentProcessing from odoo.addons.payment.controllers.portal import PaymentProcessing
#from odoo.addons.sale.controllers.portal import CustomerPortal #from odoo.addons.sale.controllers.portal import CustomerPortal
import odoo.addons.portal.controllers.portal
from odoo.addons.account.controllers.portal import CustomerPortal from odoo.addons.account.controllers.portal import CustomerPortal
from odoo.tools.misc import formatLang, format_date as odoo_format_date, get_lang from odoo.tools.misc import formatLang, format_date as odoo_format_date, get_lang
from odoo.addons.portal.controllers.portal import pager as portal_pager, get_records_pager from odoo.addons.portal.controllers.portal import pager as portal_pager, get_records_pager
@ -29,6 +31,13 @@ from collections import OrderedDict
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
def create_donation(self): def create_donation(self):
return True return True
class Kalachakra_CustomerPortal(odoo.addons.portal.controllers.portal.CustomerPortal):
MANDATORY_BILLING_FIELDS = ["name","firstname", "birthday_year", "email", "street", "city", "country_id"]
OPTIONAL_BILLING_FIELDS = ["phone","mobile","zipcode", "state_id", "vat", "company_name"]
class Kalachakra_PortalAccount(CustomerPortal): class Kalachakra_PortalAccount(CustomerPortal):
@http.route(['/invoice_event'], type='http', auth='user', website=True, sitemap=False,csrf=False) @http.route(['/invoice_event'], type='http', auth='user', website=True, sitemap=False,csrf=False)
@ -145,11 +154,14 @@ class Kalachakra_PortalAccount(CustomerPortal):
values['invoice_count'] = invoice_count values['invoice_count'] = invoice_count
return values return values
class KalaAuthSignupHome(Home): class KalaAuthSignupHome(Home):
@http.route('/web/signup', type='http', auth='public', website=True, sitemap=False) @http.route('/web/signup', type='http', auth='public', website=True, sitemap=False)
def kalachakra_web_auth_signup(self, *args, **kw): def kalachakra_web_auth_signup(self, *args, **kw):
qcontext = self.get_auth_signup_qcontext() qcontext = self.get_auth_signup_qcontext()
_logger.info(qcontext)
if not qcontext.get('token') and not qcontext.get('signup_enabled'): if not qcontext.get('token') and not qcontext.get('signup_enabled'):
raise werkzeug.exceptions.NotFound() raise werkzeug.exceptions.NotFound()
@ -184,9 +196,45 @@ class KalaAuthSignupHome(Home):
return response return response
class kalachakra_event(WebsiteEventController,PaymentProcessing): class kalachakra_event(WebsiteEventController,PaymentProcessing):
def sitemap_event(env, rule, qs): def sitemap_event(env, rule, qs):
if not qs or qs.lower() in '/events': if not qs or qs.lower() in '/events':
yield {'loc': '/events'} yield {'loc': '/events'}
@http.route(['''/event/<model("event.event"):event>/register'''], type='http', auth="user", website=True, sitemap=False)
def event_register(self, event, **post):
if not event.can_access_from_current_website():
raise werkzeug.exceptions.NotFound()
values = self._prepare_event_register_values(event, **post)
return request.render("website_event.event_description_full", values)
def _prepare_event_register_values(self, event, **post):
"""Return the require values to render the template."""
#contact lié à l'utilisateur
userid=request.env.context.get('uid')
cancel_option=0
if userid:
user=request.env['res.users'].search([('id','=',int(userid))])
partner=request.env['res.partner'].sudo().search([('id','=',int(user.partner_id))])
#si le contact est déjà inscrit et qu'il n'a pas payé: il peut annuler son inscription
reg=request.env['event.registration'].sudo().search([('event_id','=',int(event.id)),('state','!=','cancel'),('partner_id','=',int(partner.id))])
if reg: cancel_option=1
urls = event._get_event_resource_urls()
return {
'cancel_option': cancel_option,
'event': event,
'main_object': event,
'range': range,
'google_url': urls.get('google_url'),
'iCal_url': urls.get('iCal_url'),
}
#afficher la liste des prochains événement sur la home page (sans les retraites ! ) #afficher la liste des prochains événement sur la home page (sans les retraites ! )
@http.route('/event/csv_booking_registrants', website=False, auth='user',methods=['GET']) @http.route('/event/csv_booking_registrants', website=False, auth='user',methods=['GET'])
def export_csv_booking_registrants(self,id,*args,**kw): def export_csv_booking_registrants(self,id,*args,**kw):
@ -296,6 +344,25 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
tags = request.env['event.tag'].search([('name', 'in',lst_tags)]) tags = request.env['event.tag'].search([('name', 'in',lst_tags)])
return tags return tags
def update_partner_data(self,partner,post):
_logger.error(partner)
_logger.error('post:'+str(post))
if len(post)>0:
partner.name=post.get('name')
partner.firstname=post.get('firstname')
partner.birthday_year=post.get('birthday_year')
partner.street=post.get('street')
partner.street2=post.get('street2')
partner.zip=post.get('zip')
partner.city=post.get('city')
partner.phone=post.get('phone')
partner.mobile=post.get('mobile')
partner.country_id=int(post.get('country_id'))
partner.contact_form_update_date=fields.Date.today()
@http.route(['/kalachakra/mediatheque/event'], type='http', auth="public", website=True, sitemap=sitemap_event) @http.route(['/kalachakra/mediatheque/event'], type='http', auth="public", website=True, sitemap=sitemap_event)
def kalachakraMediathequeEvent(self,**id): def kalachakraMediathequeEvent(self,**id):
id=id.get('id') id=id.get('id')
@ -601,6 +668,20 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
return http.request.redirect('https://www.dropbox.com/s/ijsd6n82oyp0gw8/programme_Paris.pdf?dl=0') return http.request.redirect('https://www.dropbox.com/s/ijsd6n82oyp0gw8/programme_Paris.pdf?dl=0')
@http.route(['/event/registration/cancel'], type='http', auth='user', website=True, sitemap=False,csrf=False)
def event_registration_cancel(self,event_id,*args,**kw):
#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))])
reg=request.env['event.registration'].sudo().search([('event_id','=',int(event_id)),('state','!=','cancel'),('partner_id','=',int(partner.id))],limit=1)
reg.action_cancel()
return http.request.render('kalachakra.registration_cancel')
@http.route(['/event/registration/step1'], type='http', auth='user', website=True, sitemap=False,csrf=False) @http.route(['/event/registration/step1'], type='http', auth='user', website=True, sitemap=False,csrf=False)
def event_registration_step1(self,event_id,*args,**kw): def event_registration_step1(self,event_id,*args,**kw):
data={} data={}
@ -608,6 +689,10 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
userid=request.env.context.get('uid') userid=request.env.context.get('uid')
user=request.env['res.users'].search([('id','=',int(userid))]) user=request.env['res.users'].search([('id','=',int(userid))])
partner=request.env['res.partner'].sudo().search([('id','=',int(user.partner_id))]) partner=request.env['res.partner'].sudo().search([('id','=',int(user.partner_id))])
#mise à jour des infos du contact à partir du formulaire
self.update_partner_data(partner,request.session['partner_data'])
data['partner']=partner data['partner']=partner
#évenement #évenement
event=request.env['event.event'].sudo().search([('id','=',int(event_id))]) event=request.env['event.event'].sudo().search([('id','=',int(event_id))])
@ -637,30 +722,62 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
@http.route(['/event/registration/contactform'], type='http', auth='user', website=True, sitemap=False,csrf=False) @http.route(['/event/registration/contactform'], type='http', auth='user', website=True, sitemap=False,csrf=False)
#def event_registration_contactform(self,event_id,*args,**kw): #def event_registration_contactform(self,event_id,*args,**kw):
def event_registration_contactform(self,*args,**kw):
def event_registration_contactform(self,event_id,*args,**kw):
data={} data={}
#contact lié à l'utilisateur #contact lié à l'utilisateur
event=request.env['event.event'].sudo().search([('id','=',int(event_id))])
request.session['event_id']=int(event_id)
data['event']=event
userid=request.env.context.get('uid') userid=request.env.context.get('uid')
data['lang']=request.env.context.get('lang') data['lang']=request.env.context.get('lang')
user=request.env['res.users'].search([('id','=',int(userid))]) user=request.env['res.users'].search([('id','=',int(userid))])
partner=request.env['res.partner'].sudo().search([('id','=',int(user.partner_id))]) partner=request.env['res.partner'].sudo().search([('id','=',int(user.partner_id))])
data['partner']=partner 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
country=request.env['res.country'].sudo().search([])
data['countries']=country
data['country_id']=int(partner.country_id)
last_update_date=partner.contact_form_update_date
#_logger.error('last update:'+str(last_update_date))
#_logger.error(str(last_update_date +relativedelta(days=365)))
if not last_update_date or last_update_date +relativedelta(days=365)<=datetime.now().date() :
return http.request.render('kalachakra.registration_contactform',data)
else:
url='/event/registration/step0?event_id='+str(event.id)
return request.redirect(url)
@http.route(['/event/registration/step0'], type='http', auth='user', website=True, sitemap=False,csrf=False)
def event_registration_step0(self,event_id,**post):
event=request.env['event.event'].sudo().search([('id','=',int(event_id))])
if event.online_event and not event.online_only:next_step="step1"
if event.online_only and not event.headphone_option:next_step="step2"
if not event.online_event and not event.online_only and not event.headphone_option:next_step="step2"
if event.online_only and event.headphone_option:next_step="step2"
if not event.online_event and not event.online_only and event.headphone_option:next_step="step1b"
url='/event/registration/'+next_step+'?event_id='+str(event.id)
request.session['partner_data']=post
return request.redirect(url)
return http.request.render('kalachakra.registration_contactform',data)
@http.route(['/event/registration/step1b'], type='http', auth='user', website=True, sitemap=False,csrf=False) @http.route(['/event/registration/step1b'], type='http', auth='user', website=True, sitemap=False,csrf=False)
def event_registration_step1b(self,event_id,*args,**kw):
def event_registration_step1b(self,event_id,**post):
data={} data={}
#contact lié à l'utilisateur #contact lié à l'utilisateur
userid=request.env.context.get('uid') userid=request.env.context.get('uid')
user=request.env['res.users'].search([('id','=',int(userid))]) user=request.env['res.users'].search([('id','=',int(userid))])
partner=request.env['res.partner'].sudo().search([('id','=',int(user.partner_id))]) partner=request.env['res.partner'].sudo().search([('id','=',int(user.partner_id))])
data['partner']=partner data['partner']=partner
#mise à jour des infos du contact à partir du formulaire
self.update_partner_data(partner,request.session['partner_data'])
#évenement #évenement
event=request.env['event.event'].sudo().search([('id','=',int(event_id))]) event=request.env['event.event'].sudo().search([('id','=',int(event_id))])
request.session['event_id']=int(event_id) request.session['event_id']=int(event_id)
@ -678,6 +795,10 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
userid=request.env.context.get('uid') userid=request.env.context.get('uid')
user=request.env['res.users'].search([('id','=',int(userid))]) user=request.env['res.users'].search([('id','=',int(userid))])
partner=request.env['res.partner'].sudo().search([('id','=',int(user.partner_id))]) partner=request.env['res.partner'].sudo().search([('id','=',int(user.partner_id))])
#mise à jour des infos du contact à partir du formulaire
self.update_partner_data(partner,request.session['partner_data'])
request.session['partner_id']=int(partner.id) request.session['partner_id']=int(partner.id)
request.session['status']=partner.member_status request.session['status']=partner.member_status
data['partner']=partner data['partner']=partner
@ -710,7 +831,7 @@ class kalachakra_event(WebsiteEventController,PaymentProcessing):
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))+')' 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 : #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)
res=request.env['event.registration'].sudo().search([('event_id','=',int(request.session['event_id'])),('state','!=','cancel'),('partner_id','=',int(request.session['partner_id']))],limit=1)
data['already_registered']=True data['already_registered']=True
data['payment_status']=res.payment_status data['payment_status']=res.payment_status


+ 92
- 0
i18n/fr.po View File

@ -1924,3 +1924,95 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:kalachakra.kalachakra_template_donation_tax_receipt #: model_terms:ir.ui.view,arch_db:kalachakra.kalachakra_template_donation_tax_receipt
msgid "{{SIGNATORY}} / {{SIGNATORYJOB}}" msgid "{{SIGNATORY}} / {{SIGNATORYJOB}}"
msgstr "" msgstr ""
#. module: kalachakra
#: model_terms:ir.ui.view,arch_db:kalachakra.portal_my_details
msgid "Zip / Postal Code"
msgstr "Code postal"
#. module: kalachakra
#: model:ir.model.fields,field_description:kalachakra.field_res_partner__birthday_year
#: model:ir.model.fields,field_description:kalachakra.field_res_users__birthday_year
#: model_terms:ir.ui.view,arch_db:kalachakra.portal_my_details
msgid "Birthday year"
msgstr "Année de naissance"
#. module: kalachakra
#: model_terms:ir.ui.view,arch_db:kalachakra.registration_contactform
msgid ""
"<span class=\"s_website_form_label_content\">Birthday year</span>\n"
" <span class=\"s_website_form_mark\"> *</span>"
msgstr ""
"<span class=\"s_website_form_label_content\">Année de naissance</span>\n"
" <span class=\"s_website_form_mark\"> *</span>"
#. module: kalachakra
#: model_terms:ir.ui.view,arch_db:kalachakra.registration_contactform
msgid ""
"To help us communicate better with you, please provide some personal information about yourself.\n"
" This data will remain confidential and will not be shared."
msgstr ""
"Afin de nous aider à mieux communiquer avec vous, nous vous remercions de "
"préciser quelques informations personnelles vous concernant. Ces données "
"resteront confidentielles et ne seront pas partagées."
#. module: kalachakra
#: model_terms:ir.ui.view,arch_db:kalachakra.booking_registration_options_form2
#: model_terms:ir.ui.view,arch_db:kalachakra.registration_contactform
msgid ""
"<span class=\"s_website_form_label_content\">First name</span>\n"
" <span class=\"s_website_form_mark\"> *</span>"
msgstr ""
"<span class=\"s_website_form_label_content\">Prénom</span>\n"
" <span class=\"s_website_form_mark\"> *</span>"
#. module: kalachakra
#: model_terms:ir.ui.view,arch_db:kalachakra.booking_registration_options_form2
#: model_terms:ir.ui.view,arch_db:kalachakra.registration_contactform
msgid ""
"<span class=\"s_website_form_label_content\">Name</span>\n"
" <span class=\"s_website_form_mark\"> *</span>"
msgstr ""
"<span class=\"s_website_form_label_content\">Nom</span>\n"
" <span class=\"s_website_form_mark\"> *</span>"
#. module: kalachakra
#: model_terms:ir.ui.view,arch_db:kalachakra.booking_registration_options_form2
#: model_terms:ir.ui.view,arch_db:kalachakra.registration_contactform
msgid ""
"<span class=\"s_website_form_label_content\">Phone</span>\n"
" <span class=\"s_website_form_mark\"/>"
msgstr ""
"<span class=\"s_website_form_label_content\">Téléphone</span>\n"
" <span class=\"s_website_form_mark\"/>"
#. module: kalachakra
#: model_terms:ir.ui.view,arch_db:kalachakra.registration_contactform
msgid "<span class=\"s_website_form_label_content\">Street 2</span>"
msgstr "<span class=\"s_website_form_label_content\">Complément d'adresse</span>"
#. module: kalachakra
#: model_terms:ir.ui.view,arch_db:kalachakra.registration_contactform
msgid "<span class=\"s_website_form_label_content\">Street</span>"
msgstr "<span class=\"s_website_form_label_content\">Rue</span>"
#. module: kalachakra
#: model_terms:ir.ui.view,arch_db:kalachakra.registration_contactform
msgid ""
"<span class=\"s_website_form_label_content\">Zip</span>\n"
" <span class=\"s_website_form_mark\">*</span>"
msgstr ""
"<span class=\"s_website_form_label_content\">Code postal</span>\n"
" <span class=\"s_website_form_mark\">*</span>"
#. module: kalachakra
#: model_terms:ir.ui.view,arch_db:kalachakra.registration_cancel
msgid "Your registration has been cancelled"
msgstr "Votre inscription a été annulée"
#. module: kalachakra
#: model_terms:ir.ui.view,arch_db:kalachakra.event_registration_template
msgid "Cancel register"
msgstr "Annuler mon inscription"

+ 1
- 1
models/accounting_file.py View File

@ -10,5 +10,5 @@ class accounting_file(models.Model):
document_fname=fields.Char(default='undefined') document_fname=fields.Char(default='undefined')
exported_date=fields.Date(string='Exported Date',tracking=True, readonly=True) exported_date=fields.Date(string='Exported Date',tracking=True, readonly=True)
start_date=fields.Date(string='Start Date',tracking=True, readonly=True) start_date=fields.Date(string='Start Date',tracking=True, readonly=True)
end_date=fields.Date(string='End Date',tracking=True, readonly=True)

+ 4
- 1
models/event_registration.py View File

@ -247,7 +247,10 @@ class EventRegistration(models.Model):
l=self.env['account.move.line'].search([('move_id','=',invoice.id),('balance','<',0)]) l=self.env['account.move.line'].search([('move_id','=',invoice.id),('balance','<',0)])
l.partner_id=int(reg.partner_id) l.partner_id=int(reg.partner_id)
reg.invoice_id=invoice.id reg.invoice_id=invoice.id
_logger.error('state invoice='+reg.invoice_id.state)
#mettre la facture payée si son montant est à zéro
if product_price==0:reg.invoice_id.state='posted'
return invoice.id return invoice.id

+ 13
- 0
models/membership.py View File

@ -68,6 +68,7 @@ class kalachakra_membership(models.Model):
return end_date return end_date
end_date=fields.Date('end date',default=_default_end_date) end_date=fields.Date('end date',default=_default_end_date)
alert_mail_date=fields.Date('alert mail date')
@ -223,6 +224,18 @@ class kalachakra_membership(models.Model):
for m in members: for m in members:
m.update_membership() m.update_membership()
def bulk_mail_end_membership(self):
date_30=date.today()+relativedelta(months=1)
members=self.env['kalachakra.membership'].search([('alert_mail_date','=',False),('end_date','<=',date_30),('end_date','>=',date.today())])
for m in members:
m.alert_mail_date=date.today()
mail_template = self.env['mail.template'].search([('name','=','end_membership')])
mail_template.email_to = self.partner_id.email
#mail_template.send_mail(m.id,False)
_logger.error(m.partner_id.name+' '+str(m.end_date))
def email_confirmation(self): def email_confirmation(self):


+ 15
- 3
models/partner.py View File

@ -65,8 +65,9 @@ class ResPartner(models.Model):
date_adhesion=fields.Char(string='Date adhesion', readonly=True) date_adhesion=fields.Char(string='Date adhesion', readonly=True)
birthday_date=fields.Date(string="Birthday date") birthday_date=fields.Date(string="Birthday date")
birthday_yeardate=fields.Date(string="Birthday date")
birthday_year=fields.Integer(string="Birthday year")
contact_form_update_date=fields.Date(string="contact form update date")
name_for_list = fields.Char('name', compute='_compute_name_for_list',store=True) name_for_list = fields.Char('name', compute='_compute_name_for_list',store=True)
def _compute_end_date_membership(self): def _compute_end_date_membership(self):
@ -208,4 +209,15 @@ class ResPartner(models.Model):
first_name_ = record.firstname if record.firstname else "" first_name_ = record.firstname if record.firstname else ""
name = donor + name_ + first_name_ name = donor + name_ + first_name_
res.append((record.id,name)) res.append((record.id,name))
return res
return res
def _update_email_to_lower(self):
users = self.env['res.users'].search([])
for u in users:
_logger.info(u.login)
try:
u.login=u.login.lower()
_logger.info(u.login)
except :
_logger.info('erreur :'+u.login)

+ 1
- 1
models/res_users.py View File

@ -98,7 +98,7 @@ class ResUsers(models.Model):
# no token, sign up an external user # no token, sign up an external user
_logger.error("errK6no token, sign up an external user") _logger.error("errK6no token, sign up an external user")
values['email'] = values.get('email') or values.get('login') values['email'] = values.get('email') or values.get('login')
values['email'] =values['email'].lower()
self._signup_create_user(values) self._signup_create_user(values)

+ 1
- 0
views/accounting_file.xml View File

@ -31,6 +31,7 @@
<field name="accounting_file" filename="document_fname" widget="binary"/> <field name="accounting_file" filename="document_fname" widget="binary"/>
<field name="document_fname" invisible="1"/> <field name="document_fname" invisible="1"/>
<field name="start_date"/> <field name="start_date"/>
<field name="end_date"/>
<field name="exported_date"/> <field name="exported_date"/>
</group> </group>


+ 5
- 13
views/event_templates_page_registration.xml View File

@ -11,20 +11,11 @@
</t> </t>
<t t-if="not event.booking_event"> <t t-if="not event.booking_event">
<div class="col-lg-4 pt-3 pt-lg-0 pl-2 pl-lg-0"> <div class="col-lg-4 pt-3 pt-lg-0 pl-2 pl-lg-0">
<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-if="cancel_option!=1">
<a t-attf-id="#{event.id}" t-attf-href="/event/registration/contactform?event_id={{event.id}}" class="btn btn-secondary btn-block" data-original-title="" title="" aria-describedby="tooltip34075">Register</a>
</t> </t>
<t t-if="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="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.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="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 t-if="cancel_option==1">
<a t-attf-id="#{event.id}" t-attf-href="/event/registration/cancel?event_id={{event.id}}" class="btn btn-secondary btn-block" data-original-title="" title="" aria-describedby="tooltip34075">Cancel register</a>
</t> </t>
</div> </div>
@ -75,6 +66,7 @@
<t t-if="not event.individual_booking_event"> <t t-if="not event.individual_booking_event">
<t t-if="event.teacher_picto"> <t t-if="event.teacher_picto">
<span class="o_wevent_sidebar_title kala_evt1">Teacher</span> <span class="o_wevent_sidebar_title kala_evt1">Teacher</span>
<br></br> <br></br>
<div id="picture"> <div id="picture">


+ 2
- 1
views/partner.xml View File

@ -27,7 +27,8 @@
<field name="member_status" widget='label_selection'/> <field name="member_status" widget='label_selection'/>
<field name="date_membership"/> <field name="date_membership"/>
<field name="super_member"/> <field name="super_member"/>
<field name="birthday_date"/>
<field name="birthday_year"/>
<field name="contact_form_update_date"/>
</xpath> </xpath>


+ 19
- 5
views/portal_templates.xml View File

@ -15,16 +15,30 @@
<label class="col-form-label" for="name">Name</label> <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" /> <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>
<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 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>
<div class="clearfix" /> <div class="clearfix" />
<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_year') and 'o_has_error'} col-xl-6">
<label class="col-form-label" for="birthday_year">Birthday year</label>
<input type="number" name="birthday_year" t-attf-class="form-control #{error.get('birthday_year') and 'is-invalid'}" t-att-value="birthday_year or partner.birthday_year" />
</div>
<div t-attf-class="form-group #{error.get('phone') and 'o_has_error' or ''} col-xl-6">
<div class="clearfix" />
<div t-attf-class="form-group #{error.get('phone') and 'o_has_error'} col-xl-6">
<label class="col-form-label" for="phone">Phone</label> <label class="col-form-label" for="phone">Phone</label>
<input type="tel" name="phone" t-attf-class="form-control #{error.get('phone') and 'is-invalid' or ''}" t-att-value="phone or partner.phone" />
<input type="tel" name="phone" t-attf-class="form-control #{error.get('phone') and 'is-invalid'}" t-att-value="phone or partner.phone" />
</div>
<div t-attf-class="form-group #{error.get('mobile') and 'o_has_error'} col-xl-6">
<label class="col-form-label" for="mobile">Mobile</label>
<input type="tel" name="mobile" t-attf-class="form-control #{error.get('mobile') and 'is-invalid'}" t-att-value="mobile or partner.mobile" />
</div> </div>
<div class="clearfix" /> <div class="clearfix" />


+ 29
- 16
views/website_event_registration.xml View File

@ -230,10 +230,11 @@
<input type="hidden" name="participation_amount" t-att-value="participation_amount"/> <input type="hidden" name="participation_amount" t-att-value="participation_amount"/>
<br></br> <br></br>
<br></br> <br></br>
<t t-if="participation_amount>0">
<button type="submit" id="pay_now_btn" class="btn btn-primary" >I pay the participation now</button> <button type="submit" id="pay_now_btn" class="btn btn-primary" >I pay the participation now</button>
<br></br> <br></br>
<br></br> <br></br>
</t>
<t t-if="partner.member_status=='not member'"> <t t-if="partner.member_status=='not member'">
<h7> If you want to become a member for one year and pay the participation, </h7> <h7> If you want to become a member for one year and pay the participation, </h7>
<br></br> <br></br>
@ -248,6 +249,7 @@
<br></br> <br></br>
<br></br> <br></br>
</t> </t>
<t t-if="participation_amount>0">
<t t-if="not online"> <t t-if="not online">
<t t-if="not event.no_onthespot_payment"> <t t-if="not event.no_onthespot_payment">
<h7>If you want pay on the spot, click here : </h7><button type="submit" id="pay_on_the_spot_btn" class="btn btn-primary" >I will pay the participation on the spot</button> <h7>If you want pay on the spot, click here : </h7><button type="submit" id="pay_on_the_spot_btn" class="btn btn-primary" >I will pay the participation on the spot</button>
@ -255,6 +257,7 @@
<br></br> <br></br>
</t> </t>
</t> </t>
</t>
</t> </t>
</t> </t>
<br></br> <br></br>
@ -311,10 +314,11 @@
<t t-call="website.layout"> <t t-call="website.layout">
<div class="container-fluid"> <div class="container-fluid">
<form id="form1" t-att-action="'step2?event_id='+str(event.id)" method="post" class="form js_website_submit_form">
<form id="form1" t-att-action="'step0?event_id='+str(event.id)" method="post" class="form js_website_submit_form">
<input type="hidden" id="lang" t-att-value="lang"/> <input type="hidden" id="lang" t-att-value="lang"/>
<section class="s_website_form pt16 pb16 o_colored_level"> <section class="s_website_form pt16 pb16 o_colored_level">
<h6>Please fill in or update your personnals informations :</h6>
<h6>To help us communicate better with you, please provide some personal information about yourself.
This data will remain confidential and will not be shared.</h6>
<div class="form-group s_website_form_field s_website_form_custom s_website_form_required" data-type="char" data-name="Field"> <div class="form-group s_website_form_field s_website_form_custom s_website_form_required" data-type="char" data-name="Field">
<div class="row s_col_no_resize s_col_no_bgcolor"> <div class="row s_col_no_resize s_col_no_bgcolor">
@ -342,23 +346,14 @@
<div class="form-group s_website_form_field s_website_form_custom" data-type="date" data-name="Field"> <div class="form-group s_website_form_field s_website_form_custom" data-type="date" data-name="Field">
<div class="row s_col_no_resize s_col_no_bgcolor"> <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="ofy6dixdwt"> <label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="ofy6dixdwt">
<span class="s_website_form_label_content">Birthday date</span>
<span class="s_website_form_label_content">Birthday year</span>
<span class="s_website_form_mark"> *</span>
</label> </label>
<div class="col-12 col-sm-12 col-md-6 col-lg-4 col-xl-3"> <div class="col-12 col-sm-12 col-md-6 col-lg-4 col-xl-3">
<div class="s_website_form_date input-group datetime" id="datepickerbirthday_date" data-target-input="nearest">
<input type="text" class="form-control datetimepicker-input"
data-target="#datepickerbirthday_date" name="birthday_date"
placeholder="" id="birthday_date"/>
<div class="input-group-append"
data-target="#datepickerbirthday_date" data-toggle="datetimepicker">
<div class="input-group-text">
<i class="fa fa-calendar"></i>
</div>
</div>
</div>
<input type="number" class="form-control s_website_form_input" name="birthday_year" t-att-value="partner.birthday_year" required="1" id="contact_birthday_year" style="cursor: auto;"/>
</div> </div>
</div> </div>
</div>
</div>
@ -463,4 +458,22 @@
</div> </div>
</t> </t>
</template> </template>
<template id="kalachakra.registration_cancel" name="registration_cancel">
<t t-call="website.layout">
<div class="container-fluid">
<h6>Your registration has been cancelled</h6>
<a href="/" class="ml-4 btn btn-secondary">back Home</a>
<br></br>
<br></br>
</div>
</t>
</template>
</odoo> </odoo>

+ 41
- 23
wizard/accounting_file_wizard.py View File

@ -19,6 +19,8 @@ class AccountingFileWizard(models.TransientModel):
_description = 'accounting file wizard' _description = 'accounting file wizard'
start_date=fields.Datetime('start date',required=True,default=lambda self: self._compute_start_date()) start_date=fields.Datetime('start date',required=True,default=lambda self: self._compute_start_date())
end_date=fields.Datetime('end date',required=True,default=lambda self: self._compute_end_date())
debug_mode=fields.Boolean('debug mode',default=True) debug_mode=fields.Boolean('debug mode',default=True)
export_donation_lines=fields.Boolean('export donation lines',default=True) export_donation_lines=fields.Boolean('export donation lines',default=True)
export_membership_lines=fields.Boolean('export_membership_lines',default=True) export_membership_lines=fields.Boolean('export_membership_lines',default=True)
@ -27,33 +29,42 @@ class AccountingFileWizard(models.TransientModel):
export_out_refund_lines=fields.Boolean('export_out_refund_lines',default=True) export_out_refund_lines=fields.Boolean('export_out_refund_lines',default=True)
export_end_of_stay_lines=fields.Boolean('export_end_of_stay_lines',default=True) export_end_of_stay_lines=fields.Boolean('export_end_of_stay_lines',default=True)
def _compute_end_date(self):
date_today=fields.Date.context_today(self)
return date_today
def _compute_start_date(self): def _compute_start_date(self):
date_max=[]
#recherche de la date d'export d'écriture la plus récente
query="select max(date_compta) as date_compta from donation_donation"
self._cr.execute(query)
query_res = self._cr.dictfetchall()
for r in query_res:
d_date_compta=r['date_compta']
if d_date_compta: date_max.append(d_date_compta)
date_today=fields.Date.context_today(self)
return datetime(date_today.year,date_today.month,1)
# date_max=[]
# #recherche de la date d'export d'écriture la plus récente
# query="select max(date_compta) as date_compta from donation_donation"
# self._cr.execute(query)
# query_res = self._cr.dictfetchall()
# for r in query_res:
# d_date_compta=r['date_compta']
# if d_date_compta: date_max.append(d_date_compta)
query="select max(date_compta) as date_compta from kalachakra_membership"
self._cr.execute(query)
query_res = self._cr.dictfetchall()
for r in query_res:
m_date_compta=r['date_compta']
if m_date_compta: date_max.append(m_date_compta)
# query="select max(date_compta) as date_compta from kalachakra_membership"
# self._cr.execute(query)
# query_res = self._cr.dictfetchall()
# for r in query_res:
# m_date_compta=r['date_compta']
# if m_date_compta: date_max.append(m_date_compta)
query="select max(date_compta) as date_compta from event_registration"
self._cr.execute(query)
query_res = self._cr.dictfetchall()
for r in query_res:
e_date_compta=r['date_compta']
if e_date_compta: date_max.append(e_date_compta)
# query="select max(date_compta) as date_compta from event_registration"
# self._cr.execute(query)
# query_res = self._cr.dictfetchall()
# for r in query_res:
# e_date_compta=r['date_compta']
# if e_date_compta: date_max.append(e_date_compta)
if date_max: return max(date_max)
else: return fields.Date.context_today(self)
# if date_max: return max(date_max)
# else: return fields.Date.context_today(self)
@ -121,6 +132,7 @@ class AccountingFileWizard(models.TransientModel):
vals['document_fname']='export_comptable.csv' vals['document_fname']='export_comptable.csv'
vals['exported_date']=fields.Date.context_today(self) vals['exported_date']=fields.Date.context_today(self)
vals['start_date']=self.start_date vals['start_date']=self.start_date
vals['end_date']=self.end_date
res=self.env['accounting.file'].create(vals) res=self.env['accounting.file'].create(vals)
f.close f.close
os.unlink(filename) os.unlink(filename)
@ -158,6 +170,7 @@ class AccountingFileWizard(models.TransientModel):
#if datetime(d.donation_date.year, d.donation_date.month, d.donation_date.day)<self.start_date:continue #if datetime(d.donation_date.year, d.donation_date.month, d.donation_date.day)<self.start_date:continue
if date_payment<self.start_date.date():continue if date_payment<self.start_date.date():continue
if date_payment>self.end_date.date():continue
date_payment=self._date_format(date_payment) date_payment=self._date_format(date_payment)
#on ne prend pas en compte les dons liés à une retraite #on ne prend pas en compte les dons liés à une retraite
#car traité avec les retraites #car traité avec les retraites
@ -222,6 +235,7 @@ class AccountingFileWizard(models.TransientModel):
for m in membership: for m in membership:
if datetime(m.start_date.year,m.start_date.month,m.start_date.day)<self.start_date:continue if datetime(m.start_date.year,m.start_date.month,m.start_date.day)<self.start_date:continue
if datetime(m.start_date.year,m.start_date.month,m.start_date.day)>self.end_date:continue
if not self.debug_mode: m.date_compta=date_compta if not self.debug_mode: m.date_compta=date_compta
#on ne prend pas en compte les adhésions liés à une retraite #on ne prend pas en compte les adhésions liés à une retraite
#car traité avec les retraites #car traité avec les retraites
@ -298,6 +312,7 @@ class AccountingFileWizard(models.TransientModel):
if reg.date_payment and reg.date_payment<self.start_date.date(): continue if reg.date_payment and reg.date_payment<self.start_date.date(): continue
if reg.date_payment and reg.date_payment>self.end_date.date(): continue
membership_credit_line=False membership_credit_line=False
membership_amount=0 membership_amount=0
if not self.debug_mode: reg.date_compta=date_compta if not self.debug_mode: reg.date_compta=date_compta
@ -375,7 +390,8 @@ class AccountingFileWizard(models.TransientModel):
if reg.end_of_stay_invoice_id.date_compta_end_of_stay:continue if reg.end_of_stay_invoice_id.date_compta_end_of_stay:continue
if not reg.date_payment_end_of_stay:continue if not reg.date_payment_end_of_stay:continue
if reg.date_payment_end_of_stay and reg.date_payment_end_of_stay<self.start_date.date(): continue if reg.date_payment_end_of_stay and reg.date_payment_end_of_stay<self.start_date.date(): continue
if reg.date_payment_end_of_stay and reg.date_payment_end_of_stay>self.end_date.date(): continue
account_debit_number=self._file_format(str(reg.end_of_stay_invoice_id.payment_mode_id.fixed_journal_id.default_account_id.code),6) account_debit_number=self._file_format(str(reg.end_of_stay_invoice_id.payment_mode_id.fixed_journal_id.default_account_id.code),6)
trans=self.env['payment.transaction'].search([('invoice_ids','in',reg.end_of_stay_invoice_id.id),('state','=','done')],limit=1) trans=self.env['payment.transaction'].search([('invoice_ids','in',reg.end_of_stay_invoice_id.id),('state','=','done')],limit=1)
if trans and trans.acquirer_id.name=='Paypal': if trans and trans.acquirer_id.name=='Paypal':
@ -478,6 +494,7 @@ class AccountingFileWizard(models.TransientModel):
if reg.invoice_id.amount_total>0 and reg.invoice_id.payment_state=='paid' and reg.date_compta==False : if reg.invoice_id.amount_total>0 and reg.invoice_id.payment_state=='paid' and reg.date_compta==False :
if reg.date_payment and reg.date_payment<self.start_date.date(): continue if reg.date_payment and reg.date_payment<self.start_date.date(): continue
if reg.date_payment and reg.date_payment>self.end_date.date(): continue
self.booking_invoice_lines(f,reg) self.booking_invoice_lines(f,reg)
#si facture d'acompte payée et pas encore exporté #si facture d'acompte payée et pas encore exporté
@ -794,6 +811,7 @@ class AccountingFileWizard(models.TransientModel):
out_refund_invoices=self.env['account.move'].search([('move_type','=','out_refund'),('state','=','posted'),('payment_state','=','not_paid'),('date_compta','=',False),('date_compta_out_refund','=',False)]) out_refund_invoices=self.env['account.move'].search([('move_type','=','out_refund'),('state','=','posted'),('payment_state','=','not_paid'),('date_compta','=',False),('date_compta_out_refund','=',False)])
for invoice in out_refund_invoices: for invoice in out_refund_invoices:
if invoice.invoice_date<self.start_date.date(): continue if invoice.invoice_date<self.start_date.date(): continue
if invoice.invoice_date>self.end_date.date(): continue
if not self.debug_mode: invoice.date_compta_out_refund=date_compta if not self.debug_mode: invoice.date_compta_out_refund=date_compta
firstname=invoice.partner_id.firstname firstname=invoice.partner_id.firstname
name=invoice.partner_id.name name=invoice.partner_id.name


+ 1
- 0
wizard/accounting_file_wizard.xml View File

@ -6,6 +6,7 @@
<form string="Accounting file wizard"> <form string="Accounting file wizard">
<group> <group>
<field name="start_date" widget="date"/> <field name="start_date" widget="date"/>
<field name="end_date" widget="date"/>
<field name="debug_mode"/> <field name="debug_mode"/>
<field name="export_donation_lines"/> <field name="export_donation_lines"/>
<field name="export_membership_lines"/> <field name="export_membership_lines"/>


Loading…
Cancel
Save