Browse Source

liste evt pour verif

dev-rcn
root 3 years ago
parent
commit
9f0e77def0
2 changed files with 92 additions and 4 deletions
  1. +71
    -4
      models/event.py
  2. +21
    -0
      views/event.xml

+ 71
- 4
models/event.py View File

@ -87,6 +87,7 @@ class KalachakraEvent(models.Model):
for child_event in child_events: for child_event in child_events:
child_event.name=self.name child_event.name=self.name
child_event.event_type_id=self.event_type_id
child_event.recurring_event_newsletter_id=self.recurring_event_newsletter_id child_event.recurring_event_newsletter_id=self.recurring_event_newsletter_id
child_event.find_out_more_link=self.find_out_more_link child_event.find_out_more_link=self.find_out_more_link
@ -107,6 +108,7 @@ class KalachakraEvent(models.Model):
child_event.tag_ids=self.tag_ids child_event.tag_ids=self.tag_ids
child_event.description=self.description child_event.description=self.description
child_event.is_published=self.is_published child_event.is_published=self.is_published
#child_event.event_mail_ids=self.event_mail_ids
@ -118,11 +120,11 @@ class KalachakraEvent(models.Model):
def _compute_generated_events(self): def _compute_generated_events(self):
for rec in self: for rec in self:
rec.generated_events=False rec.generated_events=False
evt=rec.env['event.event'].search([('parent_event_id','=', int(rec.id))])
evt=rec.env['event.event'].search([('parent_event_id','=', rec.id)])
if evt:rec.generated_events=True if evt:rec.generated_events=True
def remove_generated_events(self): def remove_generated_events(self):
evt=self.env['event.event'].search([('parent_event_id','=', int(self.id))])
evt=self.env['event.event'].search([('parent_event_id','=', self.id)])
if evt: if evt:
for e in evt: for e in evt:
if e.calendar_id and e.calendar_event_id: if e.calendar_id and e.calendar_event_id:
@ -175,6 +177,7 @@ class KalachakraEvent(models.Model):
vals['date_end']=end_date_event vals['date_end']=end_date_event
vals['description']=rec.description vals['description']=rec.description
vals['tag_ids']=rec.tag_ids vals['tag_ids']=rec.tag_ids
vals['event_mail_ids']=rec.event_mail_ids
vals['event_logo']=rec.event_logo vals['event_logo']=rec.event_logo
vals['is_published']=True vals['is_published']=True
vals['free_participation']=rec.free_participation vals['free_participation']=rec.free_participation
@ -244,15 +247,79 @@ class KalachakraEvent(models.Model):
if prd.price_per=='night': if prd.price_per=='night':
price=option.list_price*(self.duration-1) price=option.list_price*(self.duration-1)
vals['event_id']=self.id
vals['event_id']=self._origin.id
vals['booking_option_id']=option.id vals['booking_option_id']=option.id
vals['booking_option_price']=price vals['booking_option_price']=price
vals['booking_option_member_price']=price vals['booking_option_member_price']=price
vals['booking_option_super_member_price']=price vals['booking_option_super_member_price']=price
vals['currency_id']=option.currency_id vals['currency_id']=option.currency_id
self.booking_option_ids = [(0, 0, vals)] self.booking_option_ids = [(0, 0, vals)]
#suppression des 2 templates de mail
# self.event_mail_ids=False
# self.env['event.mail'].sudo().search([('event_id','=',self._origin.id)]).unlink()
# template_mail_reg=self.env['mail.template'].sudo().search([('name','=','Retraite : Inscription')])
# #création du mail d'enregistrement
# if template_mail_reg:
# vals={}
# vals['display_name']=template_mail_reg.name
# vals['event_id']=self._origin.id
# vals['template_id']=template_mail_reg.id
# vals['interval_nbr']=0
# vals['interval_unit']='now'
# vals['interval_type']='after_sub'
# mail=self.env['event.mail'].sudo().create(vals)
# self.event_mail_ids=[(4, mail.id)]
# template_mail_remind=self.env['mail.template'].sudo().search([('name','=','Retraite : Rappel')])
# #création du mail avant événement
# if template_mail_remind:
# vals={}
# vals['display_name']=template_mail_remind.name
# vals['event_id']=self._origin.id
# vals['template_id']=int(template_mail_remind.id)
# vals['interval_nbr']=5
# vals['interval_unit']='days'
# vals['interval_type']='before_event'
# mail=self.env['event.mail'].sudo().create(vals)
# self.event_mail_ids=[(4, mail.id)]
# #événement
# else:
# #suppression des 2 templates de mail
# self.event_mail_ids=False
# self.env['event.mail'].sudo().search([('event_id','=',self._origin.id)]).unlink()
# template_mail_reg=self.env['mail.template'].sudo().search([('name','=','Evénement : Inscription')])
# #création du mail d'enregistrement
# if template_mail_reg:
# vals={}
# vals['display_name']=template_mail_reg.name
# vals['event_id']=self._origin.id
# vals['template_id']=template_mail_reg.id
# vals['interval_nbr']=0
# vals['interval_unit']='now'
# vals['interval_type']='after_sub'
# mail=self.env['event.mail'].sudo().create(vals)
# self.event_mail_ids=[(4, mail.id)]
# template_mail_remind=self.env['mail.template'].sudo().search([('name','=','Evénement : Rappel')])
# #création du mail avant événement
# if template_mail_remind:
# vals={}
# vals['display_name']=template_mail_remind.name
# vals['event_id']=self._origin.id
# vals['template_id']=int(template_mail_remind.id)
# vals['interval_nbr']=5
# vals['interval_unit']='days'
# vals['interval_type']='before_event'
# mail=self.env['event.mail'].sudo().create(vals)
# self.event_mail_ids=[(4, mail.id)]


+ 21
- 0
views/event.xml View File

@ -14,6 +14,27 @@
</field> </field>
</record> </record>
<record id="kalachakra_event_view_tree" model="ir.ui.view">
<field name="name">event.view.tree.inherit.kalachakra</field>
<field name="model">event.event</field>
<field name="inherit_id" ref="event.view_event_tree" />
<field name="arch" type="xml">
<xpath expr="//field[@name='seats_used']" position="after">
<field string="calendar event id" name="calendar_event_id"/>
<field name="online_event"/>
<field name="free_participation"/>
<field name="participation_product_id"/>
<field name="recurring_event"/>
<field name="recurring_event_newsletter_id"/>
<field name="find_out_more_link"/>
<field name="online_link"/>
<field name="online_id"/>
<field name="online_password"/>
</xpath>
</field>
</record>
<record id="kalachakra_event_view_form" model="ir.ui.view"> <record id="kalachakra_event_view_form" model="ir.ui.view">
<field name="name">event.view.form.inherit.kalachakra</field> <field name="name">event.view.form.inherit.kalachakra</field>


Loading…
Cancel
Save