[IMP]: Added automated mails in data and confirmed, modified and cancelled mail templates

This commit is contained in:
braisab
2021-09-01 22:19:23 +02:00
parent 68b8503113
commit eaeb86eb8f
5 changed files with 436 additions and 1 deletions

View File

@@ -33,6 +33,9 @@
"security/ir.model.access.csv",
"data/cron_jobs.xml",
"data/pms_sequence.xml",
"data/pms_confirmed_reservation_email_template.xml",
"data/pms_modified_reservation_email_template.xml",
"data/pms_cancelled_reservation_email_template.xml",
"data/pms_data.xml",
"data/traveller_report_paperformat.xml",
"report/pms_folio.xml",

View File

@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="cancelled_reservation_email" model="mail.template">
<field name="name">Cancelled Reservation</field>
<field name="model_id" ref="pms.model_pms_reservation"/>
<field name="subject">Your reservation in ${object.pms_property_id.name} has been cancelled</field>
<field name="email_from">${object.pms_property_id.partner_id.email | safe}</field>
<field name="email_to">${(object.email and '"%s" &lt;%s&gt;' % (object.name, object.email) or object.partner_id.email_formatted or '') | safe}</field>
<field name="body_html" type="html">
<table border="0" cellpadding="0" cellspacing="0" style="padding-top: 16px; background-color: #F1F1F1; font-family:Verdana, Arial,sans-serif; color: #454748; width: 100%; border-collapse:separate;"><tr><td align="center">
<table border="0" cellpadding="0" cellspacing="0" width="590" style="padding: 16px; background-color: white; color: #454748; border-collapse:separate;">
<tbody>
<!-- HEADER -->
<!-- PROPERTY DESCRIPTION -->
<tr>
<td align="center" style="min-width: 590px;">
<table width="590" border="0" cellpadding="0" cellspacing="0" style="min-width: 590px; background-color: white; padding: 0px 0px 0px 0px; border-collapse:separate;">
<tr><td align="right">
<div class="col-sm-4">
% if object.pms_property_id.partner_id.street
<p>${object.pms_property_id.partner_id.street}</p>
% endif
% if object.pms_property_id.partner_id.street2
<p>${object.pms_property_id.partner_id.street2}</p>
% endif
<p>${object.pms_property_id.partner_id.zip}</p>
<p>${object.pms_property_id.partner_id.city}</p>
<p>${object.pms_property_id.partner_id.country_id.name}</p>
</div>
</td></tr>
<tr><td valign="top" style="font-size: 14px;">
<hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;"/>
<div>
Hello ${object.partner_id.name or ''},<br/>
Your reservation at ${object.pms_property_id.name} has been successfully canceled.
</div>
</td></tr>
</table>
</td>
</tr>
<!-- DETAILS -->
<tr>
<td align="center" style="min-width: 590px;">
<table width="590" border="0" cellpadding="0" cellspacing="0" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
<tr><td valign="top" style="font-size: 14px;">
<hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;"/>
<!-- CONTACT -->
<div>
<div>If you have questions please contact with us:</div>
<ul>
<li>${object.pms_property_id.name}</li>
% if object.pms_property_id.partner_id.email
<li>Mail: <a href="mailto:${object.pms_property_id.partner_id.email}" style="text-decoration:none;color:#875A7B;">${object.pms_property_id.partner_id.email}</a></li>
% endif
% if object.pms_property_id.partner_id.phone
<li>Phone: ${object.pms_property_id.partner_id.phone}</li>
% endif
% if object.pms_property_id.partner_id.mobile
<li>Mobile: ${object.pms_property_id.partner_id.mobile}</li>
% endif
</ul>
</div>
</td></tr>
</table>
</td>
</tr>
</tbody>
</table>
</td></tr>
<!-- FOOTER -->
<tr><td align="center" style="min-width: 590px;">
% if object.pms_property_id.privacy_policy
<table width="590" border="0" cellpadding="0" cellspacing="0" style="min-width: 590px; background-color: #F1F1F1; color: #454748; padding: 8px; border-collapse:separate;">
<tr><td style="font-size: 10px;">
${object.pms_property_id.privacy_policy}
</td></tr>
</table>
% endif
</td></tr>
<tr><td align="center" style="min-width: 590px;">
% if object.company_id
<table width="590" border="0" cellpadding="0" cellspacing="0" style="min-width: 590px; background-color: #F1F1F1; color: #454748; padding: 8px; border-collapse:separate;">
<tr><td style="text-align: center; font-size: 10px;">
Sent by <a target="_blank" href="${object.company_id.website}" style="color: #875A7B;">${object.company_id.name}</a>
<br />
</td></tr>
</table>
% endif
</td></tr>
</table>
</field>
<field name="lang">${object.partner_id.lang}</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,151 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="confirmed_reservation_email" model="mail.template">
<field name="name">Confirmed Reservation</field>
<field name="model_id" ref="pms.model_pms_reservation"/>
<field name="subject">${object.company_id.name} has confirmed your reservation in ${object.pms_property_id.name}</field>
<field name="email_from">${object.pms_property_id.partner_id.email | safe}</field>
<field name="email_to">${(object.email and '"%s" &lt;%s&gt;' % (object.name, object.email) or object.partner_id.email_formatted or '') | safe}</field>
<field name="body_html" type="html">
<table border="0" cellpadding="0" cellspacing="0" style="padding-top: 16px; background-color: #F1F1F1; font-family:Verdana, Arial,sans-serif; color: #454748; width: 100%; border-collapse:separate;"><tr><td align="center">
<table border="0" cellpadding="0" cellspacing="0" width="590" style="padding: 16px; background-color: white; color: #454748; border-collapse:separate;">
<head>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous"/>
</head>
<tbody>
<!-- PROPERTY DESCRIPTION -->
<tr>
<td align="center" style="min-width: 590px;">
<table width="590" border="0" cellpadding="0" cellspacing="0" style="min-width: 590px; background-color: white; padding: 0px 0px 0px 0px; border-collapse:separate;">
<tr><td align="right">
<div class="col-sm-4">
% if object.pms_property_id.partner_id.street
<p>${object.pms_property_id.partner_id.street}</p>
% endif
% if object.pms_property_id.partner_id.street2
<p>${object.pms_property_id.partner_id.street2}</p>
% endif
<p>${object.pms_property_id.partner_id.zip}</p>
<p>${object.pms_property_id.partner_id.city}</p>
<p>${object.pms_property_id.partner_id.country_id.name}</p>
</div>
</td></tr>
<tr><td valign="top" style="font-size: 14px;">
<hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;"/>
<div>
Hello ${object.partner_id.name or ''},<br/>
We are happy to confirm your reservation in ${object.pms_property_id.name}
</div>
<div>
See you soon,<br/>
<span style="color: #454748;">
<br/>
${object.company_id.name}
</span>
</div>
</td></tr>
</table>
</td>
</tr>
<!-- DETAILS -->
<tr>
<td align="center" style="min-width: 590px;">
<hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;"/>
<div align="left" style = "margin: 16px 0px 16px 0px;"><strong>Reservation Details</strong></div>
<table width="590" border="0" cellpadding="0" cellspacing="0" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
<tr><td valign="top" style="font-size: 14px;">
<table style="width:50%;">
<tr>
<td>
<div class="far fa-calendar-alt fa-2x" style="margin: 0px 16px 0px 0px;"/>
</td>
<td style="margin: 16px 0px 16px 0px; font-size: 14px;">
<div><strong>From</strong> ${object.checkin} <strong>At</strong> ${object.arrival_hour}</div>
<div><strong>To</strong> ${object.checkout} <strong>At</strong> ${object.departure_hour}</div>
<div style="font-size:12px;color:#9e9e9e"><i><strong>TZ</strong> ${object.pms_property_id.tz}</i></div>
</td>
</tr>
<tr>
<td style="margin: 16px 0px 16px 0px;">
<br/>
<div class="fas fa-bed fa-2x" style="margin: 0px 16px 0px 0px;"/>
</td>
<td style="vertical-align:top;">
<br/>
<div><strong>Room: </strong> ${object.room_type_id.name}</div>
</td>
</tr>
<tr>
<td style="margin: 16px 0px 16px 0px;">
<br/>
<div class="fas fa-coins fa-2x" style="margin: 0px 16px 0px 0px;"/>
</td>
<td style="margin: 16px 0px 16px 0px; font-size: 14px;">
<br/>
<div><strong>Price: </strong> ${object.price_room_services_set} ${object.pms_property_id.country_id.currency_id.symbol}</div>
</td>
</tr>
</table>
</td></tr>
<tr><td valign="top" style="font-size: 14px;">
<div>
% if object.pms_property_id.mail_information
<hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;"/>
<div align="left" style = "margin: 16px 0px 16px 0px;"><strong>Additional Information</strong></div>
${object.pms_property_id.mail_information|safe}
% endif
</div>
</td></tr>
<tr><td valign="top" style="font-size: 14px;">
<hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;"/>
<!-- CONTACT -->
<div>
<span style="font-weight:300;margin:10px 0px">Questions about the reservation?</span>
<div>Please contact with us:</div>
<ul>
<li>${object.pms_property_id.name}</li>
% if object.pms_property_id.partner_id.email
<li>Mail: <a href="mailto:${object.pms_property_id.partner_id.email}" style="text-decoration:none;color:#875A7B;">${object.pms_property_id.partner_id.email}</a></li>
% endif
% if object.pms_property_id.partner_id.phone
<li>Phone: ${object.pms_property_id.partner_id.phone}</li>
% endif
% if object.pms_property_id.partner_id.mobile
<li>Mobile: ${object.pms_property_id.partner_id.mobile}</li>
% endif
</ul>
</div>
</td></tr>
</table>
</td>
</tr>
</tbody>
</table>
</td></tr>
<!-- FOOTER -->
<tr><td align="center" style="min-width: 590px;">
% if object.pms_property_id.privacy_policy
<table width="590" border="0" cellpadding="0" cellspacing="0" style="min-width: 590px; background-color: #F1F1F1; color: #454748; padding: 8px; border-collapse:separate;">
<tr><td style="font-size: 10px;">
${object.pms_property_id.privacy_policy|safe}
</td></tr>
</table>
% endif
</td></tr>
<tr><td align="center" style="min-width: 590px;">
% if object.company_id
<table width="590" border="0" cellpadding="0" cellspacing="0" style="min-width: 590px; background-color: #F1F1F1; color: #454748; padding: 8px; border-collapse:separate;">
<tr><td style="text-align: center; font-size: 10px;">
Sent by <a target="_blank" href="${object.company_id.website}" style="color: #875A7B;">${object.company_id.name}</a>
<br />
</td></tr>
</table>
% endif
</td></tr>
</table>
</field>
<field name="lang">${object.partner_id.lang}</field>
</record>
</data>
</odoo>

View File

@@ -135,7 +135,40 @@ if (permit_first_letter.upper() in ['X','Y']) and id_number.name[1:8].isdigit()
else:
failed = True
</field>
<!-- <field name="has_unique_numbers">True</field>-->
</record>
<!-- pms.automated_mails-->
<record id="pms_auto_mail_confirm" model="pms.automated.mails">
<field name="name">Confirmed Reservation</field>
<field name="active">False</field>
<field name="template_id" ref="pms.confirmed_reservation_email" />
<field name="action">creation</field>
<field
name="pms_property_ids"
eval="[(6, False, [ref('main_pms_property')])]"
/>
<field name="moment">in_act</field>
</record>
<record id="pms_auto_mail_write" model="pms.automated.mails">
<field name="name">Modified Reservation</field>
<field name="active">False</field>
<field name="template_id" ref="pms.modified_reservation_email" />
<field name="action">write</field>
<field
name="pms_property_ids"
eval="[(6, False, [ref('main_pms_property')])]"
/>
<field name="moment">in_act</field>
</record>
<record id="pms_auto_mail_cancel" model="pms.automated.mails">
<field name="name">Cancelled Reservation</field>
<field name="active">False</field>
<field name="template_id" ref="pms.cancelled_reservation_email" />
<field name="action">cancel</field>
<field
name="pms_property_ids"
eval="[(6, False, [ref('main_pms_property')])]"
/>
<field name="moment">in_act</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,152 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="modified_reservation_email" model="mail.template">
<field name="name">Modified Reservation</field>
<field name="model_id" ref="pms.model_pms_reservation"/>
<field name="subject">Your reservation in ${object.pms_property_id.name} has been modified</field>
<field name="email_from">${object.pms_property_id.partner_id.email | safe}</field>
<field name="email_to">${(object.email and '"%s" &lt;%s&gt;' % (object.name, object.email) or object.partner_id.email_formatted or '') | safe}</field>
<field name="body_html" type="html">
<table border="0" cellpadding="0" cellspacing="0" style="padding-top: 16px; background-color: #F1F1F1; font-family:Verdana, Arial,sans-serif; color: #454748; width: 100%; border-collapse:separate;"><tr><td align="center">
<table border="0" cellpadding="0" cellspacing="0" width="590" style="padding: 16px; background-color: white; color: #454748; border-collapse:separate;">
<head>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous"/>
</head>
<tbody>
<!-- HEADER -->
<!-- PROPERTY DESCRIPTION -->
<tr>
<td align="center" style="min-width: 590px;">
<table width="590" border="0" cellpadding="0" cellspacing="0" style="min-width: 590px; background-color: white; padding: 0px 0px 0px 0px; border-collapse:separate;">
<tr><td align="right">
<div class="col-sm-4">
% if object.pms_property_id.partner_id.street
<p>${object.pms_property_id.partner_id.street}</p>
% endif
% if object.pms_property_id.partner_id.street2
<p>${object.pms_property_id.partner_id.street2}</p>
% endif
<p>${object.pms_property_id.partner_id.zip}</p>
<p>${object.pms_property_id.partner_id.city}</p>
<p>${object.pms_property_id.partner_id.country_id.name}</p>
</div>
</td></tr>
<tr><td valign="top" style="font-size: 14px;">
<hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;"/>
<div>
Hello ${object.partner_id.name or ''},<br/>
Your reservation in ${object.pms_property_id.name} has been modified
</div>
<div>
See you soon,<br/>
<span style="color: #454748;">
<br/>
${object.company_id.name}
</span>
</div>
</td></tr>
</table>
</td>
</tr>
<!-- DETAILS -->
<tr>
<td align="center" style="min-width: 590px;">
<hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;"/>
<div align="left" style = "margin: 16px 0px 16px 0px;"><strong>Reservation Details</strong></div>
<table width="590" border="0" cellpadding="0" cellspacing="0" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
<tr><td valign="top" style="font-size: 14px;">
<table style="width:50%;">
<tr>
<td>
<div class="far fa-calendar-alt fa-2x" style="margin: 0px 16px 0px 0px;"/>
</td>
<td style="margin: 16px 0px 16px 0px; font-size: 14px;">
<div><strong>From</strong> ${object.checkin} <strong>At</strong> ${object.arrival_hour}</div>
<div><strong>To</strong> ${object.checkout} <strong>At</strong> ${object.departure_hour}</div>
<div style="font-size:12px;color:#9e9e9e"><i><strong>TZ</strong> ${object.pms_property_id.tz}</i></div>
</td>
</tr>
<tr>
<td style="margin: 16px 0px 16px 0px;">
<br/>
<div class="fas fa-bed fa-2x" style="margin: 0px 16px 0px 0px;"/>
</td>
<td style="vertical-align:top;">
<br/>
<div><strong>Room: </strong> ${object.room_type_id.name}</div>
</td>
</tr>
<tr>
<td style="margin: 16px 0px 16px 0px;">
<br/>
<div class="fas fa-coins fa-2x" style="margin: 0px 16px 0px 0px;"/>
</td>
<td style="margin: 16px 0px 16px 0px; font-size: 14px;">
<br/>
<div><strong>Price: </strong> ${object.price_total} ${object.pms_property_id.country_id.currency_id.symbol}</div>
</td>
</tr>
</table>
</td></tr>
<tr><td valign="top" style="font-size: 14px;">
<div>
% if object.pms_property_id.mail_information
<hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;"/>
<div align="left" style = "margin: 16px 0px 16px 0px;"><strong>Additional Information</strong></div>
<p>${object.pms_property_id.mail_information|safe}</p>
% endif
</div>
</td></tr>
<tr><td valign="top" style="font-size: 14px;">
<hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;"/>
<!-- CONTACT -->
<div>
<span style="font-weight:300;margin:10px 0px">Questions about the reservation?</span>
<div>Please contact with us:</div>
<ul>
<li>${object.pms_property_id.name}</li>
% if object.pms_property_id.partner_id.email
<li>Mail: <a href="mailto:${object.pms_property_id.partner_id.email}" style="text-decoration:none;color:#875A7B;">${object.pms_property_id.partner_id.email}</a></li>
% endif
% if object.pms_property_id.partner_id.phone
<li>Phone: ${object.pms_property_id.partner_id.phone}</li>
% endif
% if object.pms_property_id.partner_id.mobile
<li>Mobile: ${object.pms_property_id.partner_id.mobile}</li>
% endif
</ul>
</div>
</td></tr>
</table>
</td>
</tr>
</tbody>
</table>
</td></tr>
<!-- FOOTER -->
<tr><td align="center" style="min-width: 590px;">
% if object.pms_property_id.privacy_policy
<table width="590" border="0" cellpadding="0" cellspacing="0" style="min-width: 590px; background-color: #F1F1F1; color: #454748; padding: 8px; border-collapse:separate;">
<tr><td style="font-size: 10px;">
${object.pms_property_id.privacy_policy|safe}
</td></tr>
</table>
% endif
</td></tr>
<tr><td align="center" style="min-width: 590px;">
% if object.company_id
<table width="590" border="0" cellpadding="0" cellspacing="0" style="min-width: 590px; background-color: #F1F1F1; color: #454748; padding: 8px; border-collapse:separate;">
<tr><td style="text-align: center; font-size: 10px;">
Sent by <a target="_blank" href="${object.company_id.website}" style="color: #875A7B;">${object.company_id.name}</a>
<br />
</td></tr>
</table>
% endif
</td></tr>
</table>
</field>
<field name="lang">${object.partner_id.lang}</field>
</record>
</data>
</odoo>