diff --git a/addons/dine360_reservation/controllers/main.py b/addons/dine360_reservation/controllers/main.py index 54185fa..6f05992 100644 --- a/addons/dine360_reservation/controllers/main.py +++ b/addons/dine360_reservation/controllers/main.py @@ -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"""

A new table reservation has been submitted successfully.

@@ -284,11 +285,39 @@ class TableReservationController(http.Controller): """, '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""" +

Dear {customer_name},

+

Your table reservation has been confirmed successfully!

+

Reservation Details:

+ +

If you have any questions or need to make changes, please reply to this email.

+
+

We look forward to seeing you!

+

Thank you,
Chennora

+ """, + '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,