[ADD][WIP] email templates based on QWeb

This commit is contained in:
Pablo
2019-10-04 17:59:57 +02:00
parent fce24dacc3
commit 09420bd763
3 changed files with 128 additions and 0 deletions

View File

@@ -23,6 +23,13 @@
<field name="company_id" ref="base.main_company"/>
<field name="default_pricelist_id" ref="product.list0"/>
<field name="default_restriction_id" ref="main_hotel_room_type_restriction"/>
<field name="street">Rua Street Demo, s/n</field>
<field name="city">Roomdoo city</field>
<field name="country_id" ref="base.es"/>
<field name="zip">15703</field>
<field name="phone">+34 123 456 879</field>
<field name="email">roomdoo@hoteldemo.roomdoo.com</field>
<field name="website">https://www.roomdoo.com</field>
</record>
<record model="res.users" id="base.user_root">

View File

@@ -0,0 +1,117 @@
<?xml version="1.0"?>
<odoo>
<data noupdate="0">
<template id="template_header">
<h1 t-field="object.hotel_id.name" />
<div class="row">
<div class="col-sm-4">
<t t-esc="object.hotel_id.street" />
<t t-if="object.hotel_id.street2" >- <t t-esc="object.hotel_id.street2" /></t> <br />
<t t-esc="object.hotel_id.zip" />
<t t-esc="object.hotel_id.city" />,
<t t-esc="object.hotel_id.state_id.name" /> <br />
<t t-esc="object.hotel_id.country_id.name" />
</div>
<div class="col-sm-4">
<i class="glyphicon glyphicon-phone-alt" /> <t t-esc="object.hotel_id.phone" /> <br />
<i class="glyphicon glyphicon-envelope" /> <t t-esc="object.hotel_id.email" /> <br />
<i class="glyphicon glyphicon-home" /> <t t-esc="object.hotel_id.website" /> <br />
</div>
</div>
</template>
<template id="template_reservation_details">
<div class="row table-responsive" style="padding-top: 20px;">
<div class="col-sm-12">
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Room Type</th>
<th scope="col">Checkin</th>
<th scope="col">Nights</th>
<th scope="col">Price <t t-esc="object.currency_id.name"/></th>
</tr>
</thead>
<tbody>
<t t-foreach="object.reservation_ids" t-as="r">
<tr>
<th scope="row"><t t-esc="r_index+1"/></th>
<td><t t-esc="r.room_type_id.name"/></td>
<td><t t-esc="r.real_checkin"/></td>
<td><t t-esc="r.nights"/></td>
<td><t t-esc="r.price_total"/></td>
</tr>
</t>
</tbody>
</table>
</div>
</div>
</template>
<template id="template_reservation">
<div class="row" style="padding-top: 20px;">
<div class="col-sm-12">
<p>Dear <span t-field="object.partner_id.name"/>,<br />
Thank you for your reservation.</p>
<p>Here is your confirmation code: <b t-esc="object.name" />.
Keep this code for any question about your booking order.</p>
<p>You can find the reservation details below:</p>
</div>
</div>
<t t-call="hotel.template_reservation_details"/>
<div class="row" style="padding-top: 20px;">
<div class="col-sm-12">
If you have any questions, please do not hesitate to contact with the hotel's staff. <br/>
Looking forward to seeing you at our hotel, <br />
Best regards.
</div>
</div>
</template>
<template id="template_footer">
<div class="row" style="padding-top: 20px;">
<div class="col-sm-12">
Privacy Policy: We use your Personal Information only for managing your reservation. By using the hotel, you
agree to the collection and use of information in accordance with this policy.
</div>
</div>
</template>
<template id="template_reservation_confirmed" name="Hotel Reservation Confirmed">
<t t-call="web.layout">
<t t-set="head">
<!-- TODO: ensure bootstrap in shipped within the email -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous" />
</t>
<t t-set="body_classname" t-value="'container'"/>
<div class="container">
<t t-call="hotel.template_header"/>
<t t-call="hotel.template_reservation"/>
<t t-call="hotel.template_footer"/>
</div>
</t>
</template>
<!-- notify customer that reservation has been confirmed -->
<record id="email_template_reservation" model="mail.template">
<field name="name">Hotel: Reservation Confirmed</field>
<field name="model_id" ref="hotel.model_hotel_folio"/>
<field name="email_from">${('%s &lt;%s&gt;' % (object.hotel_id.partner_id.name, object.hotel_id.partner_id.email) or '')|safe}</field>
<field name="email_to">${(object.email or '')|safe}</field>
<field name="partner_to">${(object.partner_id.id or '')}</field>
<field name="lang">${object.partner_id.lang}</field>
<field name="subject">Your reservation ${object.name} has been confirmed by the hotel staff</field>
<field name="auto_delete" eval="True"/>
<field name="body_type">qweb</field>
<field name="body_view_id" ref="hotel.template_reservation_confirmed"/>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
</odoo>