feat(waiter): where each line came from; QR lines marked, the QR message opens the table (platform-v2 step 4.8b)

- order_items.source (Alembic 0025): waiter | counter | qr | online, set by the server
  (orders.add_priced_items: the phone / manager 'waiter', the counter 'counter'; the QR
  menu's lines 'qr', online orders 'online'; a split line keeps its source); lines of
  existing online orders backfilled 'online'; in the order's item output.
- Waiter: lines the guests sent from the QR menu (or an online order) carry a "📱 QR" /
  "🌐 Online" mark; the qr_order message's banner has "Open the table", and in the bell's
  list the message opens it.
- Tests: source per channel, migration 0025, QR placement marks 'qr'; waiter e2e +1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 09:59:57 +02:00
co-authored by Claude Opus 5.5
parent 198f8ff571
commit 1e8271e370
15 changed files with 124 additions and 9 deletions
+4
View File
@@ -377,6 +377,8 @@ def get_order(order_id: int, db: Session = Depends(get_db), user: User = Depends
"price_adjustment": getattr(i, 'price_adjustment', 0.0) or 0.0,
"unit_type": i.unit_type,
"system_key": i.system_key, # the delivery fee line (phase 3S, S.5)
"source": i.source, # waiter | counter | qr | online (4.8)
"course_id": i.course_id,
}
def fmt_log(l):
@@ -711,6 +713,7 @@ def add_priced_items(order_id: int, body: AddItemsRequest, db: Session, user: Us
removed_ingredients=json.dumps(item_in.removed_ingredients) if item_in.removed_ingredients else None,
notes=item_in.notes,
course_id=item_in.course_id,
source=item_in.source or "waiter",
)
db.add(item)
db.flush()
@@ -1613,6 +1616,7 @@ def split_item(
# Create split-off item
new_item = OrderItem(
source=item.source,
order_id=order_id,
product_id=item.product_id,
added_by=item.added_by,
+1 -1
View File
@@ -271,7 +271,7 @@ def _items_in(lines, adjs):
return [OrderItemInput(
product_id=line.product.id, quantity=line.quantity,
selected_options=[SelectedOptionInput(**e) for e in line.entries] or None,
removed_ingredients=line.removed or None, notes=line.notes, price_adjustment=adj or None,
removed_ingredients=line.removed or None, notes=line.notes, price_adjustment=adj or None, source="counter",
) for line, adj in zip(lines, adjs)]