feat(backend,waiter,manager): moves between tables and orders on the record

Owner 2026-11-23 (plan 6F.4). services/moves.py: every table transfer, lines moved and orders merged
is an order_moves row with its lines (order_move_items: line, quantity then); OrderItem.split_from_id
links a split part to its line, so a part carries the moves made before the split; combining moves
the removed lines' moves to the kept one. Alembic 0048: the tables, the column, and a backfill from
the audit notes written before (note='backfill'). A split part now also keeps the line's price change,
kitchen state, course, cost and names (it used to restart as pending at the menu price).
GET /api/orders/{id}/moves (the order's path, each line's); GET /api/reports/moves (+ export).
Waiter: a moved order's banner (T2 -> T5), moved lines marked, a line's Move history. Manager: the
order's Moves tab, each moved line's path, Reports -> Moves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 08:03:11 +02:00
co-authored by Claude Opus 5.5
parent f87f9ff23c
commit 0a353c5f97
27 changed files with 903 additions and 18 deletions
@@ -12,12 +12,12 @@ import { parseNumber, useFormat, useTranslation } from '@xenia/i18n'
import { Button, Dialog, EmptyState, Field, Input, cx } from '@xenia/ui'
import client from '../../api/client'
import { Pill } from '../overview/parts'
import { lineAmount, lineDetails, nameOf, selectable, selectedAmount, shownLines, toggleSelected, unitOf } from './orderLogic'
import { lineAmount, lineDetails, nameOf, pathText, selectable, selectedAmount, shownLines, toggleSelected, unitOf } from './orderLogic'
const STATUS_TONE = { paid: 'success', cancelled: 'danger', tabbed: 'info', closed: 'warning' }
const EVENT_TONE = { waiter_discount: 'text-accent-ink', free_item_added: 'text-success-ink', modifier_applied: 'text-info-ink', manual_price: 'text-warning-ink' }
export default function OrderLines({ order, open, priceEvents, onPay, onChanged }) {
export default function OrderLines({ order, open, priceEvents, moves = {}, onPay, onChanged }) {
const { t } = useTranslation('manager')
const { formatMoney, formatTime } = useFormat()
const canDiscount = useCan('pricing.discounts.apply')
@@ -70,6 +70,11 @@ export default function OrderLines({ order, open, priceEvents, onPay, onChanged
{d.choices.length > 0 && <div className="text-caption text-ink-2">{d.choices.join(', ')}</div>}
{d.removed.length > 0 && <div className="text-caption text-ink-2">{t('orders.lines.without', { list: d.removed.join(', ') })}</div>}
{d.note && <div className="text-caption text-warning-ink">{d.note}</div>}
{moves[item.id]?.length > 0 && (
<div className="text-caption text-info-ink" data-testid="line-moved">
↪ {t('orders.moves.linePath', { path: pathText(moves[item.id]) })}
</div>
)}
<div className="text-caption text-ink-3">
{t('orders.lines.added', { time: formatTime(item.added_at), name: item.added_by_name ?? '' })}
{item.paid_by_name && ` · ${t('orders.lines.paidBy', { name: item.paid_by_name })}`}