feat: add restaurant reservation model and dashboard controller
This commit is contained in:
parent
e4fd895c5f
commit
e0192ad79e
@ -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
|
||||
|
||||
@ -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')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user