feat: sales points, offerings and prices per sales point (platform-v2 phase 3S, step S.1)

- core/sales_points.py: in_store, in_store_takeaway, qr_table, online_takeaway,
  online_delivery, online_preorder (+ old channel names mapped).
- Alembic 0017: orders.sales_point (backfilled), products.sold_at (from digital_visible),
  digital_price/digital_discount -> item price modifiers for the QR menu and online,
  order_channel conditions -> sales points; drops the three digital columns.
- Every order records its sales point; the pricing engine's channel is it; items not sold
  there are refused (order.not_sold_here, pos.line_invalid not_sold_here).
- POS menu: only what the counter sells, prices per counter sales point; the screen shows
  the order type's products and prices. Waiter app asks for in-person products.
- Cloud snapshot: products sold by the customer apps, priced by the engine.
- Manager: product "Where it's sold" tab; pricing condition shows sales points.
- Products API, catalogue export/import carry sold_at.
- Tests: test_sales_points.py (8, incl. the migration), access +1, terminal +1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 11:00:40 +02:00
co-authored by Claude Opus 5.5
parent f2182dcb37
commit 1b468fe44b
30 changed files with 700 additions and 156 deletions
+11
View File
@@ -173,3 +173,14 @@ test('refunds: picking items, quantities, total, method, approval (3.3e)', async
assert.equal(needsApproval(items, pickAll(items)), false)
assert.equal(needsApproval([{ ...coffee, mine: false }], { 1: 1 }), true)
})
test('sales points at the counter: what is sold and at which price (phase 3S)', async () => {
const { forSalesPoint, salesPointFor } = await import('../src/apps/pos/logic/cart.js')
assert.equal(salesPointFor('takeaway'), 'in_store_takeaway')
assert.equal(salesPointFor('here'), 'in_store')
const cola = { id: 1, price: 3.5, prices: { in_store: 3.5, in_store_takeaway: 2.5 }, sold_at: ['in_store', 'in_store_takeaway'] }
const soup = { id: 2, price: 6, prices: { in_store: 6, in_store_takeaway: 6 }, sold_at: ['in_store'] }
const old = { id: 3, price: 4 }
assert.deepEqual(forSalesPoint([cola, soup, old], 'in_store_takeaway').map(p => [p.id, p.price]), [[1, 2.5], [3, 4]])
assert.deepEqual(forSalesPoint([cola, soup, old], 'in_store').map(p => [p.id, p.price]), [[1, 3.5], [2, 6], [3, 4]])
})