feat: ordering from the menu tablet at a table (platform-v2 step 6.6, D-30)

- tablet_orders (0034) + services/tablet_orders.py: venue rules (menu_tablet.ordering) with
  per-tablet overrides: kitchen or waiter confirms first, no open order open/refuse, limits
  (items per order, of one dish, time between orders)
- /api/menu-tablet: quote, order, order/{id}, bill (see + ask), requests accept/decline, ordering
- terminal: Add to the order (POS ProductDialog), cart, note, send, live status, the bill
- waiter: TabletRequests on the table page, tablet_order message theme with Open the table
- manager: Settings -> Menu tablets
- tests: test_tablet_orders.py, menu-tablet unit, menu_tablet.mjs e2e (the done-when)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 14:42:37 +02:00
co-authored by Claude Opus 5.5
parent c43dc8b55b
commit c1af7770cf
34 changed files with 1491 additions and 28 deletions
+30
View File
@@ -0,0 +1,30 @@
"""Orders from a menu tablet at a table (plan step 6.6, D-30).
Every order a tablet sends is a row: what was sent (`lines`, as the counter's lines by id,
services/pos_cart.py), its note, the total it was quoted at, and what happened:
waiting a waiter must confirm it first (the venue's or the tablet's setting)
sent on the table's order and in the kitchen (`order_id`)
declined a waiter declined it (`reason` for the guests)
The rows also give the time limit between two orders from one tablet.
"""
from sqlalchemy import JSON, Column, Float, ForeignKey, Integer, String, Text
from core.timeutil import UTCDateTime, utcnow
from database import Base
class TabletOrder(Base):
__tablename__ = "tablet_orders"
id = Column(Integer, primary_key=True, index=True)
device_id = Column(Integer, ForeignKey("devices.id", ondelete="SET NULL"), nullable=True, index=True)
table_id = Column(Integer, ForeignKey("tables.id", ondelete="SET NULL"), nullable=True, index=True)
lines = Column(JSON, nullable=False, default=list)
note = Column(Text, nullable=True)
total = Column(Float, nullable=False, default=0.0)
status = Column(String, nullable=False, default="waiting", index=True)
order_id = Column(Integer, ForeignKey("orders.id", ondelete="SET NULL"), nullable=True)
reason = Column(String, nullable=True)
decided_by_id = Column(Integer, ForeignKey("users.id", ondelete="SET NULL"), nullable=True)
decided_at = Column(UTCDateTime, nullable=True)
created_at = Column(UTCDateTime, default=utcnow, nullable=False, index=True)