[IMP]: added buttons from send email in pms.reservation

This commit is contained in:
braisab
2021-09-01 22:23:08 +02:00
parent 38ce8debb6
commit 3915a8c439
9 changed files with 577 additions and 146 deletions

View File

@@ -1,38 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<?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="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;">
<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;">
<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>
<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>
<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>
<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;"/>
<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/>
Hello ${object.partner_id.name or ''},<br
/>
Your reservation at ${object.pms_property_id.name} has been successfully canceled.
</div>
</td></tr>
@@ -42,22 +74,38 @@
<!-- 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;">
<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;"/>
<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>
<div
>If you have questions please contact with us:</div>
<ul>
<li>${object.pms_property_id.name}</li>
<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>
<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>
<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>
<li
>Mobile: ${object.pms_property_id.partner_id.mobile}</li>
% endif
</ul>
</div>
@@ -71,7 +119,13 @@
<!-- 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;">
<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>
@@ -80,9 +134,19 @@
</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;">
<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>
Sent by <a
target="_blank"
href="${object.company_id.website}"
style="color: #875A7B;"
>${object.company_id.name}</a>
<br />
</td></tr>
</table>

View File

@@ -1,46 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<?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="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;">
<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"/>
<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;">
<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>
<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>
<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>
<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;"/>
<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/>
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/>
See you soon,<br />
<span style="color: #454748;">
<br/>
<br />
${object.company_id.name}
</span>
</div>
@@ -51,39 +88,77 @@
<!-- 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;">
<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;"/>
<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
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
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 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
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
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>
@@ -91,28 +166,46 @@
<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>
<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;"/>
<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>
<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>
<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>
<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>
<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>
<li
>Mobile: ${object.pms_property_id.partner_id.mobile}</li>
% endif
</ul>
</div>
@@ -126,7 +219,13 @@
<!-- 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;">
<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>
@@ -135,9 +234,19 @@
</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;">
<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>
Sent by <a
target="_blank"
href="${object.company_id.website}"
style="color: #875A7B;"
>${object.company_id.name}</a>
<br />
</td></tr>
</table>

View File

@@ -1,47 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<?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="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;">
<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"/>
<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;">
<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>
<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>
<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>
<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;"/>
<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/>
Hello ${object.partner_id.name or ''},<br
/>
Your reservation in ${object.pms_property_id.name} has been modified
</div>
<div>
See you soon,<br/>
See you soon,<br />
<span style="color: #454748;">
<br/>
<br />
${object.company_id.name}
</span>
</div>
@@ -52,39 +89,77 @@
<!-- 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;">
<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;"/>
<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
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
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 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
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
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>
@@ -92,28 +167,47 @@
<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>
<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;"/>
<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>
<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>
<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>
<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>
<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>
<li
>Mobile: ${object.pms_property_id.partner_id.mobile}</li>
% endif
</ul>
</div>
@@ -127,7 +221,13 @@
<!-- 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;">
<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>
@@ -136,9 +236,19 @@
</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;">
<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>
Sent by <a
target="_blank"
href="${object.company_id.website}"
style="color: #875A7B;"
>${object.company_id.name}</a>
<br />
</td></tr>
</table>

View File

@@ -31,7 +31,7 @@ from . import product_pricelist_item
from . import res_partner
from . import pms_sale_channel
# from . import mail_compose_message
from . import mail_compose_message
from . import pms_room_type_class
from . import pms_room_closure_reason
from . import pms_service_line

View File

@@ -1,24 +1,43 @@
# Copyright 2017 Alexandre Díaz
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
from odoo import api, models
class MailComposeMessage(models.TransientModel):
_inherit = "mail.compose.message"
@api.model
def default_get(self, fields):
res = super(MailComposeMessage, self).default_get(fields)
template = self.env["mail.template"].browse(self._context.get("template_id"))
res.update(
{
"composition_mode": "comment",
"attachment_ids": False,
"template_id": template.id,
}
)
return res
def send_mail(self, auto_commit=False):
if (
self._context.get("default_model") == "pms.folio"
and self._context.get("default_res_id")
and self._context.get("mark_so_as_sent")
):
# TODO: WorkFlow Mails
folio = self.env["pms.folio"].browse([self._context["default_res_id"]])
if folio:
cmds = [
(1, lid, {"to_send": False}) for lid in folio.reservation_ids.ids
]
if any(cmds):
folio.reservation_ids = cmds
return super(MailComposeMessage, self).send_mail(auto_commit=auto_commit)
# if (
# self._context.get("default_model") == "pms.folio"
# and self._context.get("default_res_id")
# and self._context.get("mark_so_as_sent")
# ):
# # TODO: WorkFlow Mails
# folio = self.env["pms.folio"].browse([self._context["default_res_id"]])
# if folio:
# cmds = [
# (1, lid, {"to_send": False}) for lid in folio.reservation_ids.ids
# ]
# if any(cmds):
# folio.reservation_ids = cmds
res = super(MailComposeMessage, self).send_mail(auto_commit=auto_commit)
if self._context.get("record_id"):
reservation = self.env["pms.reservation"].search(
[("id", "=", self._context.get("record_id"))]
)
reservation.is_mail_send = True
return res

View File

@@ -116,14 +116,10 @@ class PmsProperty(models.Model):
)
mail_information = fields.Html(
string="Mail Information",
help="Additional information of the mail"
string="Mail Information", help="Additional information of the mail"
)
privacy_policy = fields.Html(
string="Privacy Policy",
help="Mail privacy policy "
)
privacy_policy = fields.Html(string="Privacy Policy", help="Mail privacy policy ")
property_confirmed_template = fields.Many2one(
string="Confirmation Template",

View File

@@ -644,6 +644,19 @@ class PmsReservation(models.Model):
add_possible_customer = fields.Boolean(string="Add possible Customer")
is_mail_send = fields.Boolean(string="Mail Sent", default=False)
is_modified_reservation = fields.Boolean(
string="Is A Modified Reservation",
compute="_compute_is_modified_reservation",
readonly=False,
store=True,
)
lang = fields.Many2one(
string="Language", comodel_name="res.lang", compute="_compute_lang"
)
def _compute_date_order(self):
for record in self:
record.date_order = datetime.datetime.today()
@@ -1428,6 +1441,25 @@ class PmsReservation(models.Model):
for record in self:
self.env["pms.folio"]._apply_is_possible_existing_customer_id(record)
@api.depends("checkin", "checkout")
def _compute_is_modified_reservation(self):
for record in self:
if record.state in "draft":
record.is_modified_reservation = False
elif record.state in ("confirm", "onboard") and record.is_mail_send:
record.is_modified_reservation = True
record.is_mail_send = False
else:
record.is_modified_reservation = False
@api.depends("partner_id")
def _compute_lang(self):
for record in self:
if record.partner_id:
record.lang = record.partner_id.lang
else:
record.lang = self.env["res.lang"].get_installed()
def _search_allowed_checkin(self, operator, value):
if operator not in ("=",):
raise UserError(
@@ -1666,6 +1698,54 @@ class PmsReservation(models.Model):
},
}
def action_open_mail_composer(self):
self.ensure_one()
template = False
if (
not self.is_mail_send
and not self.is_modified_reservation
and self.state not in "cancel"
):
template = self.env.ref(
"pms.confirmed_reservation_email", raise_if_not_found=False
)
elif (
not self.is_mail_send
and self.is_modified_reservation
and self.state not in "cancel"
):
template = self.env.ref(
"pms.modified_reservation_email", raise_if_not_found=False
)
elif not self.is_mail_send and self.state in "cancel":
template = self.env.ref(
"pms.cancelled_reservation_email", raise_if_not_found=False
)
compose_form = self.env.ref(
"mail.email_compose_message_wizard_form", raise_if_not_found=False
)
ctx = dict(
model="pms.reservation",
default_res_model="pms.reservation",
default_res_id=self.id,
template_id=template and template.id or False,
composition_mode="comment",
partner_ids=[self.partner_id.id],
force_email=True,
record_id=self.id,
)
return {
"name": _("Send Confirmed Reservation Mail "),
"type": "ir.actions.act_window",
"view_type": "form",
"view_mode": "form",
"res_model": "mail.compose.message",
"views": [(compose_form.id, "form")],
"view_id": compose_form.id,
"target": "new",
"context": ctx,
}
@api.model
def name_search(self, name="", args=None, operator="ilike", limit=100):
if args is None:
@@ -1811,6 +1891,7 @@ class PmsReservation(models.Model):
else:
record.state = "cancel"
record.folio_id._compute_amount()
record.is_mail_send = False
def action_assign(self):
for record in self:

View File

@@ -51,6 +51,9 @@
<field name="name" />
<field name="action" />
<field name="template_id" />
<field name="moment" />
<field name="time" />
<field name="time_type" />
</tree>
</field>
</record>

View File

@@ -43,7 +43,27 @@
states="onboard,departure_delayed"
type="object"
/>
<button
name="action_open_mail_composer"
string="Send Confirmation Email "
type="object"
attrs="{'invisible':['|','|',('is_mail_send', '=', True),('is_modified_reservation', '=', True),('state', 'in', 'cancel')]}"
/>
<button
name="action_open_mail_composer"
string="Send Modification Email "
type="object"
attrs="{'invisible':['|','|',('is_mail_send', '=', True), ('is_modified_reservation', '=', False), ('state', 'in', 'cancel')]}"
/>
<button
name="action_open_mail_composer"
string="Send Cancellation Email "
type="object"
attrs="{'invisible':['|',('is_mail_send', '=', True), ('state', 'not in', 'cancel')]}"
/>
<field name="state" widget="statusbar" />
<field name="is_mail_send" invisible="1" />
<field name="is_modified_reservation" invisible="1" />
</header>
<div
class="alert alert-info"
@@ -1043,4 +1063,33 @@
<field name="binding_view_types">form</field>
</record>
<record id="action_resend_confirmation_email" model="ir.actions.act_window">
<field name="name">Resend confirmation email</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">mail.compose.message</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="binding_model_id" ref="pms.model_pms_reservation" />
<field name="binding_view_types">form</field>
</record>
<record id="action_resend_modification_email" model="ir.actions.act_window">
<field name="name">Resend modification email</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">mail.compose.message</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="binding_model_id" ref="pms.model_pms_reservation" />
<field name="binding_view_types">form</field>
</record>
<record id="action_resend_cancellation_email" model="ir.actions.act_window">
<field name="name">Resend cancellation email</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">mail.compose.message</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="binding_model_id" ref="pms.model_pms_reservation" />
<field name="binding_view_types">form</field>
</record>
</odoo>