[IMP]pms: added link to portal in invitation template

This commit is contained in:
braisab
2021-10-14 14:03:16 +02:00
parent d5302160e6
commit b3d57a11b8
4 changed files with 25 additions and 31 deletions

View File

@@ -619,7 +619,6 @@ class PortalPrecheckin(CustomerPortal):
checkin_partner = request.env["pms.checkin.partner"].browse(
int(kw["checkin_partner_id"])
)
url = kw.get("url_access_token")
firstname = kw["firstname"]
email = kw["email"]
checkin_partner.send_portal_invitation_email(url, firstname, email)
checkin_partner.send_portal_invitation_email(firstname, email)

View File

@@ -6,7 +6,7 @@
<field name="model_id" ref="pms.model_pms_checkin_partner" />
<field
name="subject"
>${object.pms_property_id.company_id.name} has confirmed your reservation in ${object.pms_property_id.name}</field>
>Hi ${object.firstname}, do your check-in now in ${object.pms_property_id.name}</field>
<field
name="email_from"
>${object.pms_property_id.partner_id.email | safe}</field>
@@ -28,24 +28,22 @@
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">
<p>
<a
href="${object.url}"
target="_blank"
style="text-decoration: none; color: #FFFFFF; font-size: 2em; padding: 10px 20px 10px 20px;"
>
<div
style="padding: 0.5em; background-color: #45C2B1; border-color: #45C2B1; border-width: 2px;border-style:solid; border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-style: solid;-webkit-border-radius: 10; -moz-border-radius: 10; border-radius: 10px;font-size: 12px;"
>Check-in
</div>
<center><img
src="https://www.aldahotels.es/firma/email/llegada/check-in.png"
alt="Hacer check-in"
width="80px"
height="80px"
href="${object.url}"
/></center></a>
</p>
<a
href="/my/precheckin/${object.id}?access_token=${object.access_token}"
target="_blank"
style="text-decoration: none; color: #FFFFFF; font-size: 2em; padding: 10px 20px 10px 20px;"
>
<div
style="padding: 0.5em; background-color: #45C2B1; border-color: #45C2B1; border-width: 2px;border-style:solid; border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-style: solid;-webkit-border-radius: 10; -moz-border-radius: 10; border-radius: 10px;font-size: 12px;"
>Check-in
</div>
<center><img
src="https://www.aldahotels.es/firma/email/llegada/check-in.png"
alt="Hacer check-in"
width="80px"
height="80px"
href="${object.url}"
/></center></a>
</td>
</tr>
</table>

View File

@@ -767,26 +767,30 @@ class PmsCheckinPartner(models.Model):
values.update({"document_expedition_date": document_expedition_date})
checkin_partner.sudo().write(values)
def send_portal_invitation_email(self, url, firstname=None, email=None):
def send_portal_invitation_email(self, invitation_firstname=None, email=None):
subject = (
"Hi "
+ firstname
+ invitation_firstname
+ ", do your check-in now in "
+ self.sudo().pms_property_id.name
)
template = self.sudo().env.ref(
"pms.precheckin_invitation_email", raise_if_not_found=False
)
body = template._render_field(
"body_html", [6, 0, self.id], compute_lang=True, post_process=True
)[self.id]
invitation_mail = (
self.env["mail.mail"]
.sudo()
.create(
{
"subject": subject,
"body_html": template.body_html,
"body_html": body,
"email_from": self.pms_property_id.partner_id.email,
"email_to": email,
}
)
)
invitation_mail.send()

View File

@@ -27,19 +27,12 @@ odoo.define("pms.SendInvitationData", function (require) {
.parent()
.find("input[name=invitation_email]")
.val();
var urlAccessToken = $(ev.currentTarget)
.parent()
.parent()
.parent()
.find("a[name=url_acess_token]")
.attr("href");
this._rpc({
route: "/my/precheckin/send_invitation",
params: {
checkin_partner_id: checkinPartnerId,
firstname: firstname,
email: email,
url_access_token: urlAccessToken,
},
});
},