mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
@@ -65,7 +65,7 @@
|
||||
<div>
|
||||
Hello ${object.partner_id.name or ''},<br
|
||||
/>
|
||||
Your reservation at ${object.pms_property_id.name} has been successfully canceled.
|
||||
Your reservation at ${object.pms_property_id.name} has been cancelled.
|
||||
</div>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<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="model_id" ref="pms.model_pms_folio" />
|
||||
<field
|
||||
name="subject"
|
||||
>${object.company_id.name} has confirmed your reservation in ${object.pms_property_id.name}</field>
|
||||
@@ -116,11 +116,9 @@
|
||||
style="margin: 16px 0px 16px 0px; font-size: 14px;"
|
||||
>
|
||||
<div><strong
|
||||
>From</strong> ${object.checkin} <strong
|
||||
>At</strong> ${object.arrival_hour}</div>
|
||||
>From</strong> ${object.first_checkin}</div>
|
||||
<div><strong
|
||||
>To</strong> ${object.checkout} <strong
|
||||
>At</strong> ${object.departure_hour}</div>
|
||||
>To</strong> ${object.last_checkout}</div>
|
||||
<div
|
||||
style="font-size:12px;color:#9e9e9e"
|
||||
><i><strong
|
||||
@@ -140,7 +138,12 @@
|
||||
<td style="vertical-align:top;">
|
||||
<br />
|
||||
<div><strong
|
||||
>Room: </strong> ${object.room_type_id.name}</div>
|
||||
>Rooms: </strong></div><div
|
||||
>
|
||||
% for reservation in object.reservation_ids:
|
||||
${reservation.room_type_id.name}<br
|
||||
/></div>
|
||||
% endfor
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -158,7 +161,7 @@
|
||||
>
|
||||
<br />
|
||||
<div><strong
|
||||
>Price: </strong> ${object.price_room_services_set} ${object.pms_property_id.country_id.currency_id.symbol}</div>
|
||||
>Price: </strong> ${object.amount_total} ${object.pms_property_id.country_id.currency_id.symbol}</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -205,7 +208,7 @@
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a
|
||||
href="/my/folios/${object.folio_id.id}/precheckin?access_token=${object.folio_id.access_token}"
|
||||
href="/my/folios/${object.id}/precheckin?access_token=${object.access_token}"
|
||||
target="_blank"
|
||||
style="text-decoration: none; color: #FFFFFF; font-size: 2em; padding: 10px 20px 10px 20px;"
|
||||
>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<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="model_id" ref="pms.model_pms_folio" />
|
||||
<field
|
||||
name="subject"
|
||||
>Your reservation in ${object.pms_property_id.name} has been modified</field>
|
||||
@@ -106,7 +106,7 @@
|
||||
>
|
||||
<tr><td valign="top" style="font-size: 14px;">
|
||||
<table style="width:50%;">
|
||||
<tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div
|
||||
class="far fa-calendar-alt fa-2x"
|
||||
@@ -117,11 +117,9 @@
|
||||
style="margin: 16px 0px 16px 0px; font-size: 14px;"
|
||||
>
|
||||
<div><strong
|
||||
>From</strong> ${object.checkin} <strong
|
||||
>At</strong> ${object.arrival_hour}</div>
|
||||
>From</strong> ${object.first_checkin}</div>
|
||||
<div><strong
|
||||
>To</strong> ${object.checkout} <strong
|
||||
>At</strong> ${object.departure_hour}</div>
|
||||
>To</strong> ${object.last_checkout}</div>
|
||||
<div
|
||||
style="font-size:12px;color:#9e9e9e"
|
||||
><i><strong
|
||||
@@ -141,7 +139,12 @@
|
||||
<td style="vertical-align:top;">
|
||||
<br />
|
||||
<div><strong
|
||||
>Room: </strong> ${object.room_type_id.name}</div>
|
||||
>Rooms: </strong></div><div
|
||||
>
|
||||
% for reservation in object.reservation_ids:
|
||||
${reservation.room_type_id.name}<br
|
||||
/></div>
|
||||
% endfor
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -158,8 +161,8 @@
|
||||
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>
|
||||
<div><strong
|
||||
>Price: </strong> ${object.amount_total} ${object.pms_property_id.country_id.currency_id.symbol}</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -13,6 +13,7 @@ class MailComposeMessage(models.TransientModel):
|
||||
template = self.env["mail.template"].browse(self._context.get("template_id"))
|
||||
res.update(
|
||||
{
|
||||
"model": "pms.folio",
|
||||
"composition_mode": "comment",
|
||||
"attachment_ids": False,
|
||||
"template_id": template.id,
|
||||
|
||||
@@ -1278,30 +1278,8 @@ class PmsFolio(models.Model):
|
||||
for folio in folios:
|
||||
if folio.email and folio.create_date.date() == fields.Date.today():
|
||||
template = folio.pms_property_id.property_confirmed_template
|
||||
subject = template._render_field(
|
||||
"subject",
|
||||
[6, 0, folio.id],
|
||||
compute_lang=True,
|
||||
)[folio.id]
|
||||
body = template._render_field(
|
||||
"body_html",
|
||||
[6, 0, folio.id],
|
||||
compute_lang=True,
|
||||
)[folio.id]
|
||||
mail = (
|
||||
folio.env["mail.mail"]
|
||||
.sudo()
|
||||
.create(
|
||||
{
|
||||
"subject": subject,
|
||||
"body_html": body,
|
||||
"email_from": folio.pms_property_id.partner_id.email,
|
||||
"email_to": folio.email,
|
||||
}
|
||||
)
|
||||
)
|
||||
try:
|
||||
mail.send()
|
||||
template.send_mail(folio.id, force_send=True)
|
||||
except MailDeliveryException:
|
||||
self.env["ir.logging"].create(
|
||||
{
|
||||
@@ -1309,7 +1287,7 @@ class PmsFolio(models.Model):
|
||||
+ folio.email,
|
||||
"type": "server",
|
||||
"path": "pms/pms/models/pms_folio.py",
|
||||
"line": "1339",
|
||||
"line": "1281",
|
||||
"func": "send_confirmation_email",
|
||||
"message": "Confirmation Mail Delivery Failed",
|
||||
}
|
||||
@@ -1330,32 +1308,8 @@ class PmsFolio(models.Model):
|
||||
for folio in folios:
|
||||
if folio.email:
|
||||
template = folio.pms_property_id.property_modified_template
|
||||
subject = template._render_field(
|
||||
"subject",
|
||||
[6, 0, folio.id],
|
||||
compute_lang=True,
|
||||
post_process=True,
|
||||
)[folio.id]
|
||||
body = template._render_field(
|
||||
"body_html",
|
||||
[6, 0, folio.id],
|
||||
compute_lang=True,
|
||||
post_process=True,
|
||||
)[folio.id]
|
||||
mail = (
|
||||
folio.env["mail.mail"]
|
||||
.sudo()
|
||||
.create(
|
||||
{
|
||||
"subject": subject,
|
||||
"body_html": body,
|
||||
"email_from": folio.pms_property_id.partner_id.email,
|
||||
"email_to": folio.email,
|
||||
}
|
||||
)
|
||||
)
|
||||
try:
|
||||
mail.send()
|
||||
template.send_mail(folio.id, force_send=True)
|
||||
except MailDeliveryException:
|
||||
self.env["ir.logging"].create(
|
||||
{
|
||||
@@ -1363,7 +1317,7 @@ class PmsFolio(models.Model):
|
||||
+ folio.email,
|
||||
"type": "server",
|
||||
"path": "pms/pms/models/pms_folio.py",
|
||||
"line": "1391",
|
||||
"line": "1311",
|
||||
"func": "send_modification_email",
|
||||
"message": "Modification Mail Delivery Failed",
|
||||
}
|
||||
@@ -1388,32 +1342,8 @@ class PmsFolio(models.Model):
|
||||
template = (
|
||||
reservation.pms_property_id.property_canceled_template
|
||||
)
|
||||
subject = template._render_field(
|
||||
"subject",
|
||||
[6, 0, reservation.id],
|
||||
compute_lang=True,
|
||||
post_process=True,
|
||||
)[reservation.id]
|
||||
body = template._render_field(
|
||||
"body_html",
|
||||
[6, 0, reservation.id],
|
||||
compute_lang=True,
|
||||
post_process=True,
|
||||
)[reservation.id]
|
||||
mail = (
|
||||
folio.env["mail.mail"]
|
||||
.sudo()
|
||||
.create(
|
||||
{
|
||||
"subject": subject,
|
||||
"body_html": body,
|
||||
"email_from": folio.pms_property_id.partner_id.email,
|
||||
"email_to": reservation.email,
|
||||
}
|
||||
)
|
||||
)
|
||||
try:
|
||||
mail.send()
|
||||
template.send_mail(reservation.id, force_send=True)
|
||||
except MailDeliveryException:
|
||||
self.env["ir.logging"].create(
|
||||
{
|
||||
@@ -1421,13 +1351,82 @@ class PmsFolio(models.Model):
|
||||
+ reservation.email,
|
||||
"type": "server",
|
||||
"path": "pms/pms/models/pms_folio.py",
|
||||
"line": "1450",
|
||||
"line": "1345",
|
||||
"func": "send_cancelation_email",
|
||||
"message": "Cancellation Mail Delivery Failed",
|
||||
}
|
||||
)
|
||||
reservation.to_send_mail = False
|
||||
|
||||
def action_open_mail_composer(self):
|
||||
self.ensure_one()
|
||||
template = False
|
||||
pms_property = self.pms_property_id
|
||||
if (
|
||||
all(reservation.to_send_mail for reservation in self.reservation_ids)
|
||||
and not all(
|
||||
reservation.is_modified_reservation
|
||||
for reservation in self.reservation_ids
|
||||
)
|
||||
and all(
|
||||
reservation.state not in "cancel"
|
||||
for reservation in self.reservation_ids
|
||||
)
|
||||
):
|
||||
if pms_property.property_confirmed_template:
|
||||
template = pms_property.property_confirmed_template
|
||||
elif (
|
||||
any(reservation.to_send_mail for reservation in self.reservation_ids)
|
||||
and any(
|
||||
reservation.is_modified_reservation
|
||||
for reservation in self.reservation_ids
|
||||
)
|
||||
and all(
|
||||
reservation.state not in "cancel"
|
||||
for reservation in self.reservation_ids
|
||||
)
|
||||
):
|
||||
if pms_property.property_modified_template:
|
||||
template = pms_property.property_modified_template
|
||||
elif any(
|
||||
reservation.to_send_mail for reservation in self.reservation_ids
|
||||
) and any(
|
||||
reservation.state in "cancel" for reservation in self.reservation_ids
|
||||
):
|
||||
if pms_property.property_canceled_template:
|
||||
template = pms_property.property_canceled_template
|
||||
compose_form = self.env.ref(
|
||||
"mail.email_compose_message_wizard_form", raise_if_not_found=False
|
||||
)
|
||||
ctx = dict(
|
||||
model="pms.folio",
|
||||
default_model="pms.folio",
|
||||
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 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,
|
||||
}
|
||||
|
||||
def _message_post_after_hook(self, message, msg_vals):
|
||||
res = super(PmsFolio, self)._message_post_after_hook(message, msg_vals)
|
||||
for folio in self:
|
||||
for follower in folio.message_follower_ids:
|
||||
follower.unlink()
|
||||
return res
|
||||
|
||||
def action_view_invoice(self):
|
||||
invoices = self.mapped("move_ids")
|
||||
action = self.env["ir.actions.actions"]._for_xml_id(
|
||||
|
||||
@@ -1752,50 +1752,7 @@ class PmsReservation(models.Model):
|
||||
}
|
||||
|
||||
def action_open_mail_composer(self):
|
||||
self.ensure_one()
|
||||
template = False
|
||||
pms_property = self.pms_property_id
|
||||
if (
|
||||
self.to_send_mail
|
||||
and not self.is_modified_reservation
|
||||
and self.state not in "cancel"
|
||||
):
|
||||
if pms_property.property_confirmed_template:
|
||||
template = pms_property.property_confirmed_template
|
||||
elif (
|
||||
self.to_send_mail
|
||||
and self.is_modified_reservation
|
||||
and self.state not in "cancel"
|
||||
):
|
||||
if pms_property.property_modified_template:
|
||||
template = pms_property.property_modified_template
|
||||
elif self.to_send_mail and self.state in "cancel":
|
||||
if pms_property.property_canceled_template:
|
||||
template = pms_property.property_canceled_template
|
||||
compose_form = self.env.ref(
|
||||
"mail.email_compose_message_wizard_form", raise_if_not_found=False
|
||||
)
|
||||
ctx = dict(
|
||||
model="pms.folio",
|
||||
default_res_model="pms.folio",
|
||||
default_res_id=self.folio_id.id,
|
||||
template_id=template and template.id or False,
|
||||
composition_mode="comment",
|
||||
partner_ids=[self.partner_id.id],
|
||||
force_email=True,
|
||||
record_id=self.folio_id.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,
|
||||
}
|
||||
return self.folio_id.action_open_mail_composer()
|
||||
|
||||
def open_wizard_several_partners(self):
|
||||
ctx = dict(
|
||||
|
||||
@@ -47,19 +47,19 @@
|
||||
name="action_open_mail_composer"
|
||||
string="Send Confirmation Email "
|
||||
type="object"
|
||||
attrs="{'invisible':['|','|',('to_send_mail', '=', False),('is_modified_reservation', '=', True),('state', 'in', 'cancel')]}"
|
||||
attrs="{'invisible':['|','|','|',('to_send_mail', '=', False),('is_modified_reservation', '=', True),('state', 'in', 'cancel'),('reservation_type', 'in', 'out')]}"
|
||||
/>
|
||||
<button
|
||||
name="action_open_mail_composer"
|
||||
string="Send Modification Email "
|
||||
type="object"
|
||||
attrs="{'invisible':['|','|',('to_send_mail', '=', False), ('is_modified_reservation', '=', False), ('state', 'in', 'cancel')]}"
|
||||
attrs="{'invisible':['|','|','|',('to_send_mail', '=', False), ('is_modified_reservation', '=', False), ('state', 'in', 'cancel'),('reservation_type', 'in', 'out')]}"
|
||||
/>
|
||||
<button
|
||||
name="action_open_mail_composer"
|
||||
string="Send Cancellation Email "
|
||||
type="object"
|
||||
attrs="{'invisible':['|',('to_send_mail', '=', False), ('state', 'not in', 'cancel')]}"
|
||||
attrs="{'invisible':['|','|',('to_send_mail', '=', False), ('state', 'not in', 'cancel'),('reservation_type', 'in', 'out')]}"
|
||||
/>
|
||||
<field name="state" widget="statusbar" />
|
||||
<field name="to_send_mail" invisible="1" />
|
||||
@@ -1118,7 +1118,7 @@
|
||||
<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_model_id" ref="pms.model_pms_folio" />
|
||||
<field name="binding_view_types">form</field>
|
||||
<field
|
||||
name="context"
|
||||
@@ -1132,7 +1132,7 @@
|
||||
<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_model_id" ref="pms.model_pms_folio" />
|
||||
<field name="binding_view_types">form</field>
|
||||
<field
|
||||
name="context"
|
||||
|
||||
Reference in New Issue
Block a user