root 3 years ago
parent
commit
560ebf070a
5 changed files with 86 additions and 3 deletions
  1. +1
    -0
      __manifest__.py
  2. +19
    -3
      models/event.py
  3. +4
    -0
      views/event.xml
  4. +45
    -0
      views/event_templates_list.xml
  5. +17
    -0
      views/event_templates_page.xml

+ 1
- 0
__manifest__.py View File

@ -39,6 +39,7 @@
#'report/report.xml' #'report/report.xml'
'views/event.xml', 'views/event.xml',
'views/event_templates_list.xml', 'views/event_templates_list.xml',
'views/event_templates_page.xml',
'views/membership.xml', 'views/membership.xml',
'views/website_event_registration.xml', 'views/website_event_registration.xml',
'views/event_templates_page_registration.xml', 'views/event_templates_page_registration.xml',


+ 19
- 3
models/event.py View File

@ -35,6 +35,7 @@ class EventTagCategory(models.Model):
_description = 'Event tag category' _description = 'Event tag category'
calendar_id=fields.Char('google calendar id') calendar_id=fields.Char('google calendar id')
hidden=fields.Boolean('hidden tag')
class KalachakraEvent(models.Model): class KalachakraEvent(models.Model):
_inherit = "event.event" _inherit = "event.event"
@ -73,6 +74,17 @@ class KalachakraEvent(models.Model):
def bulk_change_date_events(self,name,date_start_str,hour):
date_format_str = '%d/%m/%Y %H:%M:%S'
date_start=datetime.strptime(date_start_str, date_format_str)
events=self.env['event.event'].search([('name','=', name),('date_begin','>',date_start)])
if events:
for ev in events:
ev.date_begin=ev.date_begin+timedelta(hours=1)
ev.date_end=ev.date_end+timedelta(hours=1)
def write(self,vals): def write(self,vals):
res = super(KalachakraEvent, self).write(vals) res = super(KalachakraEvent, self).write(vals)
@ -456,7 +468,7 @@ class KalachakraEvent(models.Model):
name_param=self.name.replace(' ','-') name_param=self.name.replace(' ','-')
name_param=name_param.replace('\'','-') name_param=name_param.replace('\'','-')
description='<a href="'+self.env['ir.config_parameter'].sudo().get_param('web.base.url')+'/event/'+name_param+'-'+date_param+'/register">Click here to register</a>'
description='<a href="'+self.env['ir.config_parameter'].sudo().get_param('web.base.url')+'/event/'+name_param+'-'+date_param+'/register">cliquer ici pour s\'inscrire</a>'
#str(self.date_begin.year())+'-'+str(self.date_begin.month())+'-'+self.date_begin.day() #str(self.date_begin.year())+'-'+str(self.date_begin.month())+'-'+self.date_begin.day()
body={"summary": self.name, body={"summary": self.name,
@ -466,5 +478,9 @@ class KalachakraEvent(models.Model):
} }
#event = service.events().get(calendarId=self.calendar_id, eventId=self.calendar_event_id).execute() #event = service.events().get(calendarId=self.calendar_id, eventId=self.calendar_event_id).execute()
updated_event = service.events().update(calendarId=self.calendar_id, eventId=self.calendar_event_id, body=body).execute() updated_event = service.events().update(calendarId=self.calendar_id, eventId=self.calendar_event_id, body=body).execute()
class EventTag(models.Model):
_inherit = "event.tag"
_description = 'Event tag'
hidden=fields.Boolean('hidden tag')

+ 4
- 0
views/event.xml View File

@ -11,6 +11,10 @@
<field name="calendar_id"/> <field name="calendar_id"/>
</group> </group>
</xpath> </xpath>
<xpath expr="//field[@name='color']" position="before">
<field name="hidden"/>
</xpath>
</field> </field>
</record> </record>


+ 45
- 0
views/event_templates_list.xml View File

@ -1,6 +1,39 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<data> <data>
<!-- inversion de la top bar et de la drag/drop Area -->
<template id="index" inherit_id="website_event.index">
<xpath expr="//div[@id='wrap']" position="replace">
<div id="wrap" class="o_wevent_index">
<!-- Options -->
<t t-set="opt_events_list_cards" t-value="is_view_active('website_event.opt_events_list_cards')"/>
<t t-set="opt_events_list_columns" t-value="is_view_active('website_event.opt_events_list_columns')"/>
<!-- Drag/Drop Area -->
<div id="oe_structure_we_index_1" class="oe_structure oe_empty"/>
<!-- Topbar -->
<t t-call="website_event.index_topbar"/>
<!-- Content -->
<div t-attf-class="o_wevent_events_list #{opt_events_list_cards and 'opt_event_list_cards_bg'}">
<div class="container">
<div class="row">
<t t-call="website_event.searched_tags"/>
</div>
<div class="row">
<div id="o_wevent_index_main_col" t-attf-class="col-md my-5 #{opt_events_list_columns and 'opt_events_list_columns' or 'opt_events_list_rows'}">
<div class="row">
<!-- Events List -->
<t t-call="website_event.events_list"/>
</div>
</div>
</div>
</div>
</div>
<!-- Drag/Drop Area -->
<div id="oe_structure_we_index_2" class="oe_structure oe_empty"/>
</div>
</xpath>
</template>
<template id="index_topbar" inherit_id="website_event.index_topbar"> <template id="index_topbar" inherit_id="website_event.index_topbar">
@ -54,6 +87,7 @@
<div class="dropdown-menu"> <div class="dropdown-menu">
<t t-foreach="categories" t-as="category"> <t t-foreach="categories" t-as="category">
<t t-foreach="category.tag_ids" t-as="tag"> <t t-foreach="category.tag_ids" t-as="tag">
<t t-if="not tag.hidden">
<a t-if="tag.color" <a t-if="tag.color"
t-att-href="'/event?tags='+tag.name" t-att-href="'/event?tags='+tag.name"
t-attf-class="dropdown-item d-flex align-items-center justify-content-between #{'active' if tag in search_tags else ''}"> t-attf-class="dropdown-item d-flex align-items-center justify-content-between #{'active' if tag in search_tags else ''}">
@ -61,6 +95,7 @@
</a> </a>
</t> </t>
</t> </t>
</t>
</div> </div>
</li> </li>
@ -177,6 +212,16 @@
<xpath expr="//div[@itemprop='location']" position="replace"> <xpath expr="//div[@itemprop='location']" position="replace">
<div itemprop="location" t-field="event.city"/> <div itemprop="location" t-field="event.city"/>
</xpath> </xpath>
<xpath expr="//div[@class='mt8 d-flex align-items-center']" position="replace">
<t t-foreach="event.tag_ids" t-as="tag">
<t t-if="not tag.hidden">
<span t-if="tag.color"
t-attf-class="badge mr8 #{'badge-primary' if tag in search_tags else 'badge-light'} #{'o_tag_color_%s' % tag.color if tag.color else ''}">
<span t-esc="tag.name"/>
</span>
</t>
</t>
</xpath>


+ 17
- 0
views/event_templates_page.xml View File

@ -0,0 +1,17 @@
<odoo>
<template id="layout" name="Event" inherit_id="website_event.layout">
<xpath expr="//nav" position="replace">
<nav class="navbar navbar-light border-top shadow-sm d-print-none">
<div class="container align-items-baseline justify-content-start">
<a href="/event" class="navbar-brand h4 my-0 mr-0 mr-md-4">
<i class="fa fa-long-arrow-left text-primary mr-2"/>
<span>Toutes les activités</span>
</a>
</div>
</nav>
</xpath>
</template>
</odoo>

Loading…
Cancel
Save