Add payments email

This commit is contained in:
oscar alvarez 2023-10-23 12:48:23 -05:00
parent ae920fa216
commit 0f2ded09f4
8 changed files with 119 additions and 5 deletions

View File

@ -568,6 +568,7 @@ class Booking(Workflow, ModelSQL, ModelView):
_set_paid_charges(folio)
record.save()
cls.send_email_payments([booking])
@classmethod
@ModelView.button
@ -1244,8 +1245,10 @@ class Booking(Workflow, ModelSQL, ModelView):
return
email = self.party.email
template = getattr(config, name)
print("enviando el correo....", name)
if not template:
return
print("enviando el correo12....", name)
template.subject = f'{template.subject} No. {self.number}'
if email:
Template.send(template, self, email, attach=True)
@ -1276,6 +1279,13 @@ class Booking(Workflow, ModelSQL, ModelView):
if booking.state == 'confirmed':
booking.send_email('customer_experience')
@classmethod
@ModelView.button
def send_email_payments(cls, records):
print("> > > ", records)
for booking in records:
booking.send_email('payments_email')
class BookingReport(Report):
__name__ = 'hotel.booking'

View File

@ -97,6 +97,8 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.model.button" id="booking_cancel_button">
<field name="name">cancel</field>
<field name="string">Cancel</field>
<field name="confirm">Are you sure you want to cancel the booking?</field>
<field name="model" search="[('model', '=', 'hotel.booking')]"/>
</record>
<record model="ir.model.button-res.group" id="booking_cancel_button_group_hotel">
@ -123,6 +125,8 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.model.button" id="booking_no_show_button">
<field name="name">no_show</field>
<field name="string">No Show</field>
<field name="confirm">Are you sure you want to change to "Not Show" the booking?</field>
<field name="model" search="[('model', '=', 'hotel.booking')]"/>
</record>
<record model="ir.model.button-res.group" id="booking_no_show_button_group_hotel">
@ -385,5 +389,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="model">hotel.booking,-1</field>
<field name="action" ref="wizard_booking_update_taxes"/>
</record>
</data>
</tryton>

View File

@ -25,7 +25,7 @@ class Configuration(ModelSQL, ModelView):
('sequence_type', '=',
Id('hotel',
'sequence_type_hotel')),
], required=True)
])
hotel_service_sequence = fields.Many2One('ir.sequence', 'Service Sequence',
domain=[
('company', 'in',
@ -71,6 +71,7 @@ class Configuration(ModelSQL, ModelView):
help='In days')
booking_email = fields.Many2One('email.template', 'Booking Email')
check_in_email = fields.Many2One('email.template', 'Check-In Email')
payments_email = fields.Many2One('email.template', 'Payments Email')
customer_experience_email = fields.Many2One('email.template',
'Customer Experience Email')
storage_by_default = fields.Many2One('stock.location', 'Storage By Default',

97
data/payments.html Normal file
View File

@ -0,0 +1,97 @@
<html>
<head>
<style>
body {
font-family: Helvetica, sans-serif;
padding-right: 30px;
padding-left: 30px;
}
p {
margin-top: 5px;
margin-bottom: 5px;
}
</style>
</head>
<body>
<div style="text-align: center;">
<img alt="image_logo" src="{{record.company.logo_link}}" />
</div>
<br />
<p>Estimado cliente</p>
<p><b>{{record.party.rec_name}}</b></p>
<br />
<p>
Nuestro hotel {{record.company.party.name}} ha recibido un nuevo pago! a
continuación encontrará el detalle de la transacción:
</p>
<br />
<table class="default">
<tr>
<td style="background-color: black; height: 20px; min-width: 150px;" />
<td style="background-color: black; height: 20px; min-width: 150px;" />
</tr>
{% for pay in record.payments %}
<tr>
<td style="padding-left: 3px;">Fecha:</td>
<td style="text-align: right; padding-right: 3px;">{{pay.date}}</td>
</tr>
<tr>
<td style="padding-left: 3px;">Medio de Pago:</td>
<td style="text-align: right; padding-right: 3px;">
{{pay.statement.journal.name}}
</td>
</tr>
<tr>
<td style="padding-left: 3px;">Valor del Pago:</td>
<td style="text-align: right; padding-right: 3px;">
{{ "{:,.2f}".format(pay.amount)}}
</td>
</tr>
<tr>
<td style="padding-left: 3px;">No. Voucher:</td>
<td style="text-align: right; padding-right: 3px;">{{pay.number}}</td>
</tr>
<tr>
<td style="background-color: darkseagreen; height: 10px;" />
<td style="background-color: darkseagreen; height: 10px;" />
</tr>
{% endfor %}
</table>
<br />
<p><b>Información Relevante / Relevant Information</b></p>
<p>
{{record.company.party.commercial_name}} tiene aprobados los protocolos de
bioseguridad por la autoridad local.
</p>
<br />
<p>Atentamente / Best regards,</p>
<p>
<b
>Servicio al Cliente / Service Customer |
{{record.company.party.commercial_name}}</b
>
</p>
<p />
<p>{{record.company.party.addresses[0].street}}</p>
<p>{{record.company.party.city_name}}</p>
<p>Teléfono {{record.company.party.phone}}</p>
<p>Cel. {{record.company.party.mobile}}</p>
<p>
<a href="{{record.company.party.website}}">
{{record.company.party.website}}
</a>
</p>
<div style="margin-top: 30px; margin-bottom: 10px;">
<img
alt="Software for hotels"
src="https://res.cloudinary.com/presik-com/image/upload/v1661200297/banner_emails_jumq4s.png"
/>
</div>
<p style="text-align: center;">
<a href="https://www.presik.com" style="color: #554400ff;">
Powered by presik.com
</a>
</p>
</body>
</html>

View File

@ -1,5 +1,4 @@
import requests
import json
from trytond.pool import Pool
from trytond.model import ModelView, fields

View File

@ -1,5 +1,5 @@
[tryton]
version=6.0.111
version=6.0.112
depends:
party
company

View File

@ -34,6 +34,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="booking_email"/>
<label name="check_in_email"/>
<field name="check_in_email"/>
<label name="payments_email"/>
<field name="payments_email"/>
<label name="customer_experience_email"/>
<field name="customer_experience_email"/>
<label name="accounting_revenue"/>
@ -44,8 +46,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="space_booking"/>
<label name="charge_sequence"/>
<field name="charge_sequence"/>
<label name="token_siat"/>
<field name="token_siat"/>
<field name="default_charges" colspan="2"/>
<field name="children_policies" colspan="2"/>
<label name="token_siat"/>
<field name="token_siat"/>
</form>