Alaguraj0361 42abb214ac fix(dashboard): resolve 500 internal server error on production server
- Add SafeStats fallback wrapper to prevent QWeb KeyError exceptions
- Safely resolve dictionary keys with .get() across all dashboard templates
- Add support for production SaaS master database 'dine360db'
- Add route mapping for '/dashboard' alongside '/'
- Remove invalid tracking attribute from restaurant.table is_occupied field
2026-10-12 12:42:32 +05:30

36 lines
1.3 KiB
Python

from odoo import models, fields, api
class RestaurantTable(models.Model):
_inherit = 'restaurant.table'
is_occupied = fields.Boolean(string='Is Occupied', default=False)
is_reservation_enabled = fields.Boolean(string='Enabled for Reservation', default=True)
min_party_size = fields.Integer(string='Min Party Size', default=1)
max_party_size = fields.Integer(string='Max Party Size', default=1)
zone = fields.Char(string='Zone/Section', help="e.g. Window Side, Garden, VIP Section")
reservation_slot_duration = fields.Selection([
('0.5', '30 Minutes'),
('1.0', '1 Hour'),
('1.5', '1.5 Hours'),
('2.0', '2 Hours'),
('3.0', '3 Hours'),
], string='Slot Duration', default='1.0', required=True)
@api.onchange('seats')
def _onchange_seats_for_reservation(self):
for record in self:
if record.seats == 6:
record.min_party_size = 4
record.max_party_size = 6
elif record.seats == 4:
record.min_party_size = 2
record.max_party_size = 4
else:
record.min_party_size = 1
record.max_party_size = record.seats or 1
def action_toggle_occupied(self):
for table in self:
table.is_occupied = not table.is_occupied
return True