table reservation field required apply

This commit is contained in:
Alaguraj0361 2026-02-07 11:48:15 +05:30
parent 2f9eef9536
commit 2358e2e0ff
5 changed files with 9 additions and 3 deletions

View File

@ -195,6 +195,12 @@ class TableReservationController(http.Controller):
if not start_time_str:
return request.render("dine360_reservation.reservation_page_template", {'error': 'Please select a time slot.'})
if not email:
return request.render("dine360_reservation.reservation_page_template", {
'error': 'Email is required.',
'post': post,
})
# Convert start_time to datetime object and localize to restaurant timezone (America/Toronto)
restaurant_tz = pytz.timezone('America/Toronto')
try:

View File

@ -11,7 +11,7 @@ class RestaurantReservation(models.Model):
name = fields.Char(string='Reservation Reference', required=True, copy=False, readonly=True, default=lambda self: _('New'))
customer_name = fields.Char(string='Customer Name', required=True)
phone = fields.Char(string='Phone Number', required=True)
email = fields.Char(string='Email')
email = fields.Char(string='Email', required=True)
num_people = fields.Integer(string='Number of People', default=1)
floor_id = fields.Many2one('restaurant.floor', string='Floor')

View File

@ -62,8 +62,8 @@
<input type="tel" name="phone" class="form-control form-control-lg border-0 shadow-sm" style="background: #f8f9fa; border-radius: 12px; color: #171422 !important; border: 1px solid #fecd4f !important;" placeholder="+1 (647) 000-0000" required="1" t-att-value="post.get('phone') if post else ''"/>
</div>
<div class="col-md-12">
<label class="form-label fw-bold">Email (Optional)</label>
<input type="email" name="email" class="form-control form-control-lg border-0 shadow-sm" style="background: #f8f9fa; border-radius: 12px; color: #171422 !important; border: 1px solid #fecd4f !important;" placeholder="john@example.com" t-att-value="post.get('email') if post else ''"/>
<label class="form-label fw-bold">Email</label>
<input type="email" name="email" class="form-control form-control-lg border-0 shadow-sm" style="background: #f8f9fa; border-radius: 12px; color: #171422 !important; border: 1px solid #fecd4f !important;" placeholder="john@example.com" required="1" t-att-value="post.get('email') if post else ''"/>
</div>
<div class="col-md-12">
<label class="form-label fw-bold">Number of Guests</label>