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
@@ -0,0 +1,47 @@
"""Orders from a menu tablet at a table (plan step 6.6, D-30, models/tablet_order.py).
Revision ID: 0034_tablet_orders
Revises: 0033_menu_translations
Create Date: 2026-11-18 16:00:00
"""
from alembic import op
import sqlalchemy as sa
from core.timeutil import UTCDateTime
revision = '0034_tablet_orders'
down_revision = '0033_menu_translations'
branch_labels = None
depends_on = None
def upgrade() -> None:
op.create_table(
'tablet_orders',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('device_id', sa.Integer(), nullable=True),
sa.Column('table_id', sa.Integer(), nullable=True),
sa.Column('lines', sa.JSON(), nullable=False),
sa.Column('note', sa.Text(), nullable=True),
sa.Column('total', sa.Float(), nullable=False),
sa.Column('status', sa.String(), nullable=False),
sa.Column('order_id', sa.Integer(), nullable=True),
sa.Column('reason', sa.String(), nullable=True),
sa.Column('decided_by_id', sa.Integer(), nullable=True),
sa.Column('decided_at', UTCDateTime(), nullable=True),
sa.Column('created_at', UTCDateTime(), nullable=False),
sa.ForeignKeyConstraint(['decided_by_id'], ['users.id'], ondelete='SET NULL'),
sa.ForeignKeyConstraint(['device_id'], ['devices.id'], ondelete='SET NULL'),
sa.ForeignKeyConstraint(['order_id'], ['orders.id'], ondelete='SET NULL'),
sa.ForeignKeyConstraint(['table_id'], ['tables.id'], ondelete='SET NULL'),
sa.PrimaryKeyConstraint('id'),
)
with op.batch_alter_table('tablet_orders', schema=None) as batch_op:
batch_op.create_index(batch_op.f('ix_tablet_orders_created_at'), ['created_at'], unique=False)
batch_op.create_index(batch_op.f('ix_tablet_orders_device_id'), ['device_id'], unique=False)
batch_op.create_index(batch_op.f('ix_tablet_orders_id'), ['id'], unique=False)
batch_op.create_index(batch_op.f('ix_tablet_orders_status'), ['status'], unique=False)
batch_op.create_index(batch_op.f('ix_tablet_orders_table_id'), ['table_id'], unique=False)
def downgrade() -> None:
op.drop_table('tablet_orders')