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:
@@ -1244,6 +1244,18 @@ try {
|
||||
await page.getByTestId('cancel-no-print').click()
|
||||
for (let i = 0; i < 20 && !mo?.items?.some(x => x.product_id === pB.id && x.status === 'cancelled'); i++) { await sleep(250); mo = await api('GET', `/api/orders/${oid}`, { token: boss }) }
|
||||
r.check(`${od} a line added, then cancelled (no ticket)`, mo.items.some(x => x.product_id === pB.id && x.status === 'cancelled'))
|
||||
// 6F.4: the order moved to another free table: its Moves tab shows the path, each line is marked
|
||||
{
|
||||
const busyNow = new Set((await api('GET', '/api/orders/', { token: boss })).map(o => o.table_id))
|
||||
const freeT = (await api('GET', '/api/tables/', { token: boss })).find(x => x.is_active !== false && !busyNow.has(x.id) && x.id !== otable.id)
|
||||
await api('POST', `/api/orders/${oid}/transfer`, { token: boss, body: { target_table_id: freeT.id } })
|
||||
await page.reload()
|
||||
await page.getByTestId('order-tab-moves').click()
|
||||
r.check(`${od} a transferred order: Moves shows the whole order's path (6F.4)`,
|
||||
await page.getByTestId('order-move').first().waitFor({ timeout: 8000 }).then(() => true).catch(() => false))
|
||||
await page.getByTestId('order-tab-order').click()
|
||||
r.check(`${od} …and each line says where it came from`, await page.getByTestId('line-moved').first().waitFor({ timeout: 8000 }).then(() => true).catch(() => false))
|
||||
}
|
||||
await page.screenshot({ path: path.join(OUT, 'manager-order.png'), fullPage: true })
|
||||
await page.getByTestId('order-close').click()
|
||||
const payFirst = await page.getByTestId('pay-dialog').waitFor({ timeout: 5000 }).then(() => true).catch(() => false)
|
||||
@@ -1437,6 +1449,8 @@ try {
|
||||
r.check(`${rp} Discounts opens`, await page.getByTestId('report-period').waitFor({ timeout: 8000 }).then(() => true).catch(() => false))
|
||||
await page.getByTestId('report-tab-price-changes').click()
|
||||
r.check(`${rp} Price changes opens (6F.3)`, await page.getByTestId('price-changes-count').waitFor({ timeout: 8000 }).then(() => true).catch(() => false))
|
||||
await opens('/reports/moves', 'moves-count', 'Moves (6F.4)')
|
||||
r.check(`${rp} Moves lists the order moved earlier`, await page.getByTestId('report-move').first().waitFor({ timeout: 8000 }).then(() => true).catch(() => false))
|
||||
await opens('/reports/technical', 'printing-total', 'Technical → Printing')
|
||||
await opens('/reports/prep-zones', 'report-period', 'Prep zones')
|
||||
await opens('/reports/expenses', 'expenses-total', 'Expenses')
|
||||
|
||||
@@ -23,7 +23,7 @@ const PAGES = [
|
||||
'management/approvals', 'management/schedule', 'management/prep-zones', 'management/pricing', 'management/pricing?tab=channels',
|
||||
'management/products', 'management/tables', 'management/tables?tab=floor', 'management/scenes', 'management/signage?tab=playlists', 'management/signage?tab=schedules', 'inventory/throwaways', 'notes',
|
||||
'reports/today', 'reports/store', 'devices', 'license', 'apps', 'settings?tab=operation',
|
||||
'settings?tab=security', 'settings?tab=identity', 'settings?tab=print-fonts', 'settings?tab=venue',
|
||||
'settings?tab=security', 'settings?tab=identity', 'settings?tab=print-fonts', 'settings?tab=venue', 'reports/moves',
|
||||
]
|
||||
const SHOTS = ['dashboard', 'tables', 'tables?view=qr', 'online-orders?tab=settings', 'crm/contacts', 'crm/customers', 'financials/expenses',
|
||||
'management/products', 'management/tables?tab=floor', 'management/pricing?tab=channels', 'financials/tabs', 'management/staff', 'settings?tab=operation']
|
||||
|
||||
@@ -342,6 +342,19 @@ try {
|
||||
await a.keyboard.press('Escape').catch(() => {})
|
||||
await setting(boss, 'orders.price_change_reason', 'false')
|
||||
await api('PUT', `/api/waiters/${maria.id}/permissions`, { token: boss, body: { keys: mariaKeys } })
|
||||
// 6F.4: the order moved to another table: the phone shows where it came from and the line's moves
|
||||
const busyNow = new Set((await api('GET', '/api/orders/', { token: boss })).map(o => o.table_id))
|
||||
const tq = (await api('GET', '/api/tables/', { token: boss })).find(x => x.is_active !== false && !busyNow.has(x.id) && x.id !== tp.id)
|
||||
await api('POST', `/api/orders/${op.id}/transfer`, { token: boss, body: { target_table_id: tq.id } })
|
||||
await a.goto(`${APP}/tables/${tq.id}`)
|
||||
r.check('6F.4: a moved order says where it came from', await shown(a, 'order-moved', 10_000)
|
||||
&& (await a.getByTestId('order-moved').textContent()).includes('→'))
|
||||
r.check('6F.4: …and its lines are marked as moved', await shown(a, 'item-moved', 5000))
|
||||
await a.locator('.order-item').first().click()
|
||||
await a.getByRole('button', { name: 'ACTIONS', exact: true }).last().click()
|
||||
await a.getByText('Move history').first().click({ timeout: 10_000 })
|
||||
r.check('6F.4: the line\'s move history on the phone', await shown(a, 'move-row', 8000))
|
||||
await a.keyboard.press('Escape').catch(() => {})
|
||||
await setting(boss, 'orders.close_with_unpaid', 'true')
|
||||
await api('POST', `/api/orders/${op.id}/close`, { token: boss })
|
||||
await setting(boss, 'orders.close_with_unpaid', 'false')
|
||||
|
||||
Reference in New Issue
Block a user