forked from alaguraj/odoo-testing-addons
table reservation mail configuration updated
This commit is contained in:
parent
19527c1673
commit
214cd34671
@ -269,9 +269,10 @@ class TableReservationController(http.Controller):
|
||||
'state': 'confirmed' # Direct confirmation from website
|
||||
})
|
||||
|
||||
# Send Email
|
||||
# Send Emails
|
||||
try:
|
||||
mail_values = {
|
||||
# 1. Notify the Company
|
||||
admin_mail_values = {
|
||||
'subject': f"New Table Reservation: {customer_name}",
|
||||
'body_html': f"""
|
||||
<p>A new table reservation has been submitted successfully.</p>
|
||||
@ -284,11 +285,39 @@ class TableReservationController(http.Controller):
|
||||
</ul>
|
||||
""",
|
||||
'email_to': 'alaguraj0361@gmail.com',
|
||||
'email_from': 'alaguraj0361@gmail.com',
|
||||
'reply_to': email,
|
||||
}
|
||||
mail = request.env['mail.mail'].sudo().create(mail_values)
|
||||
mail.send()
|
||||
except Exception:
|
||||
pass
|
||||
admin_mail = request.env['mail.mail'].sudo().create(admin_mail_values)
|
||||
admin_mail.send()
|
||||
|
||||
# 2. Notify the Customer
|
||||
customer_mail_values = {
|
||||
'subject': f"Reservation Confirmation - Chennora",
|
||||
'body_html': f"""
|
||||
<p>Dear {customer_name},</p>
|
||||
<p>Your table reservation has been confirmed successfully!</p>
|
||||
<p><b>Reservation Details:</b></p>
|
||||
<ul>
|
||||
<li><b>Number of Guests:</b> {num_people}</li>
|
||||
<li><b>Time:</b> {start_time_str}</li>
|
||||
</ul>
|
||||
<p>If you have any questions or need to make changes, please reply to this email.</p>
|
||||
<br>
|
||||
<p>We look forward to seeing you!</p>
|
||||
<p>Thank you,<br>Chennora</p>
|
||||
""",
|
||||
'email_to': email,
|
||||
'email_from': 'alaguraj0361@gmail.com',
|
||||
'reply_to': 'alaguraj0361@gmail.com',
|
||||
}
|
||||
customer_mail = request.env['mail.mail'].sudo().create(customer_mail_values)
|
||||
customer_mail.send()
|
||||
|
||||
except Exception as e:
|
||||
import logging
|
||||
_logger = logging.getLogger(__name__)
|
||||
_logger.error("Failed to send reservation emails: %s", str(e))
|
||||
|
||||
return request.render("dine360_reservation.reservation_success_template", {
|
||||
'reservation': reservation,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user