feat(backend,waiter,manager): prices changed by hand are on the record
Owner 2026-11-23 (plan 6F.3). services/price_changes.py: the venue's switch orders.price_change (off | before_sending | anytime, default anytime as before), orders.price_change_reason and its quick reasons; keys ordering.prices.modify (the cart), new modify_sent (a sent or served line) and view_changes (who sees them). Every by-hand price (waiter cart, a sent line, the counter's % discount) writes a manual_price PriceEventLog row (before, after, quantity, who, approving manager, stage, reason) plus a PRICE_CHANGED audit row; before, the sent-line change overwrote the price with no record. Alembic 0047: event columns; modify_sent for everyone holding modify (and the venues' role overrides), view_changes for owners and store managers. Waiter: the reason picker when the venue asks, a sent line's price on modify_sent and the venue's switch, the line's price history. Manager: Settings -> Operation 'Prices changed by hand', the changes on the order's lines and history, Reports -> Cancellations, discounts and price changes (+ export). Counter: no discount when the venue turned price changes off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -30,9 +30,9 @@ export default function CartLine({ line, priced, product, canDiscount, onQty, on
|
||||
<IconButton size="sm" variant="secondary" label={t('pos.more')} onClick={() => onQty(line.quantity + step)}><Plus size={16} /></IconButton>
|
||||
{priced && line.quantity !== 1 && <span className="text-caption text-ink-3">{t('pos.each', { price: formatMoney(priced.unit_price) })}</span>}
|
||||
<span className="flex-1" />
|
||||
<Select size="sm" value={String(line.discount_pct ?? 0)} onChange={e => onDiscount(Number(e.target.value))} aria-label={t('pos.discount')}
|
||||
{canDiscount !== null && <Select size="sm" value={String(line.discount_pct ?? 0)} onChange={e => onDiscount(Number(e.target.value))} aria-label={t('pos.discount')}
|
||||
title={canDiscount ? undefined : t('pos.discountNeedsApproval')} data-testid="line-discount" className="w-36"
|
||||
options={DISCOUNTS.map(d => ({ value: String(d), label: d ? `−${d}%` : t('pos.noDiscount') }))} />
|
||||
options={DISCOUNTS.map(d => ({ value: String(d), label: d ? `−${d}%` : t('pos.noDiscount') }))} />}
|
||||
</div>
|
||||
{priced?.discount ? <span className="text-label text-success-ink">{t('pos.discountLine', { pct: priced.discount_pct, amount: formatMoney(priced.discount) })}</span> : null}
|
||||
</div>
|
||||
|
||||
@@ -62,7 +62,9 @@ function Counter({ menu, t }) {
|
||||
const [tableCart, setTableCart] = useState([])
|
||||
const [dialog, setDialog] = useState(null) // product
|
||||
const tables = useTables()
|
||||
const canDiscount = useCan('ordering.prices.modify')
|
||||
// a discount is a price changed in the cart (6F.3): none when the venue turned that off
|
||||
const mayDiscount = useCan('ordering.prices.modify')
|
||||
const canDiscount = menu.settings.price_change === 'off' ? null : mayDiscount // null: no discount at all
|
||||
const toast = useToast()
|
||||
const onlineModule = useModule('connect_orders')
|
||||
const handlesOnline = useCan('connect_orders.manage')
|
||||
|
||||
Reference in New Issue
Block a user