Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions muskathlon/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"data/event_type_mail.xml",
"data/order_material_mail_template.xml",
"data/website.xml",
"data/registration_mail_template.xml",
"reports/muskathlon_view.xml",
"views/event_compassion_view.xml",
"views/recurring_contracts_view.xml",
Expand Down
36 changes: 36 additions & 0 deletions muskathlon/data/registration_mail_template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="muskathlon_registration_notification_view" model="ir.ui.view">
<field name="name">muskathlon.registration.notification.view</field>
<field name="type">qweb</field>
<field name="arch" type="xml">
<div>
<p>A new participant has registered for the Muskathlon!</p>
<p>Here are the registration details:</p>
<ul>
<li><strong>Title:</strong> <t t-esc="object.partner_title.name"/></li>
<li><strong>Name:</strong> <t t-esc="object.name"/></li>
<li><strong>Email:</strong> <t t-esc="object.partner_email"/></li>
<li><strong>Phone:</strong> <t t-esc="object.partner_phone"/></li>
<li><strong>Birth Name:</strong> <t t-esc="object.birth_name"/></li>
<li><strong>Date of Birth:</strong> <t t-esc="object.partner_birthdate_date"/></li>
<li><strong>Passport Number:</strong> <t t-esc="object.passport_number"/></li>
<li><strong>Passport Expiration Date:</strong> <t t-esc="object.passport_expiration_date"/></li>
<li><strong>Emergency Contact (<t t-esc="object.emergency_relation_type"/>):</strong> <t t-esc="object.emergency_name" /></li>
<li><strong>Emergency Contact Phone:</strong> <t t-esc="object.emergency_phone"/></li>
<li><strong>Address:</strong>
<t t-esc="object.partner_street"/>,
<t t-esc="object.partner_zip"/> <t t-esc="object.partner_city"/>
</li>
<li><strong>T-Shirt Size:</strong> <t t-esc="dict(object._fields['t_shirt_size'].selection).get(object.t_shirt_size, '')"/></li>
<li><strong>Sport Discipline:</strong> <t t-esc="object.sport_discipline_id.name"/></li>
<li><strong>Sport Level:</strong> <t t-esc="dict(object._fields['sport_level'].selection).get(object.sport_level, '')"/></li>
<li t-if="object.sport_level_description"><strong>Sport Description:</strong> <t t-esc="object.sport_level_description"/></li>
<li><strong>Comments:</strong> <t t-esc="object.comments"/></li>
</ul>
</div>
</field>
</record>
</data>
</odoo>
20 changes: 12 additions & 8 deletions muskathlon/models/event_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class MuskathlonRegistration(models.Model):
help="Used in thank you letters for donations linked to an event "
"and to this partner.",
)
comments = fields.Text("Registration Comments")

_sql_constraints = [
(
Expand Down Expand Up @@ -92,7 +93,7 @@ def create(self, values):
return registrations

def _compute_is_in_two_months(self):
"""this function define is the bollean hide or not the survey"""
"""this function defines if the boolean hides or shows the survey"""
for registration in self:
today = datetime.datetime.today()
start_day = registration.event_begin_date
Expand Down Expand Up @@ -139,14 +140,17 @@ def notify_muskathlon_registration(self):
)
self.message_subscribe(partners.ids)

body = _("The participant registered through the Muskathlon website.")
subtype_id = self.env.ref("website_event_compassion.mt_registration_create").id

for registration in self:
registration.message_post_with_view(
"muskathlon.muskathlon_registration_notification_view",
subject=_("%s - New Muskathlon registration") % registration.name,
values={"object": registration},
message_type="comment",
subtype_id=subtype_id,
)

self.message_post(
body=body,
subject=_("%s - New Muskathlon registration") % self.name,
message_type="email",
subtype_xmlid="website_event_compassion.mt_registration_create",
)
return True

def muskathlon_medical_survey_done(self):
Expand Down
6 changes: 6 additions & 0 deletions muskathlon/templates/muskathlon_registration_form.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<function model="ir.model.fields" name="formbuilder_whitelist">
<value>event.registration</value>
<value eval="['comments']" />
</function>
</data>
<template id="muskathlon_registration_form" inherit_id="website_event_compassion.event_registration_form">
<xpath expr="//h3[@id='tripHeader']" position="before">
<h3 id="muskathlonHeader" t-if="main_object.is_muskathlon">Muskathlon</h3>
Expand Down