feat: add restaurant reservation model and dashboard controller

This commit is contained in:
Alaguraj0361 2026-10-06 11:51:06 +05:30
parent e4fd895c5f
commit e0192ad79e
2 changed files with 11 additions and 0 deletions

View File

@ -558,6 +558,8 @@ class Dine360DashboardController(http.Controller):
'occasion': occasion,
'special_requests': special_requests,
'state': 'confirmed',
'is_admin_override': True,
'override_reason': 'Dashboard Booking',
}
if table_id:
vals['table_id'] = table_id

View File

@ -103,6 +103,15 @@ class RestaurantReservation(models.Model):
if overlap:
raise ValidationError(_('One or more tables are already reserved for the selected time slot.'))
def _float_to_time_str(self, time_float):
hours = int(time_float or 0)
minutes = int(((time_float or 0) - hours) * 60)
ampm = "am" if hours < 12 else "pm"
display_hours = hours if hours <= 12 else hours - 12
if display_hours == 0:
display_hours = 12
return f"{display_hours}:{minutes:02d}{ampm}"
@api.constrains('start_time', 'end_time', 'is_admin_override')
def _check_opening_hours(self):
restaurant_tz = pytz.timezone('America/Toronto')