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:
@@ -59,6 +59,8 @@ export function PriceEventList({ events }) {
|
||||
<span className="flex flex-wrap gap-x-3">
|
||||
{(ev.modifier_name || ev.deal_name) && <span className="font-semibold">{ev.modifier_name || ev.deal_name}</span>}
|
||||
{ev.applied_by_username && <span className="text-ink-3">{t('orders.history.by', { name: ev.applied_by_username })}</span>}
|
||||
{ev.approved_by_username && <span className="text-ink-3">{t('orders.history.approvedBy', { name: ev.approved_by_username })}</span>}
|
||||
{ev.stage && <span className="text-ink-3">{t(`orders.history.stage.${ev.stage}`)}</span>}
|
||||
{ev.delta_amount != null && (
|
||||
<span className={cx('font-semibold tabular-nums', ev.delta_amount < 0 ? 'text-success-ink' : 'text-danger-ink')}>
|
||||
{formatMoney(ev.delta_amount, { signDisplay: 'exceptZero' })}
|
||||
|
||||
@@ -15,7 +15,7 @@ import { Pill } from '../overview/parts'
|
||||
import { lineAmount, lineDetails, nameOf, 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' }
|
||||
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 }) {
|
||||
const { t } = useTranslation('manager')
|
||||
@@ -79,6 +79,12 @@ export default function OrderLines({ order, open, priceEvents, onPay, onChanged
|
||||
<span aria-hidden="true">↳</span>
|
||||
<span>{ev.modifier_name || ev.deal_name || t(`overview.order.event.${ev.event_type}`)}</span>
|
||||
{ev.delta_amount != null && <span className="font-semibold">{formatMoney(ev.delta_amount, { signDisplay: 'exceptZero' })}</span>}
|
||||
{ev.event_type === 'manual_price' && (
|
||||
<span className="text-ink-3" data-testid="line-price-change">
|
||||
{formatMoney(ev.price_before)} → {formatMoney(ev.price_after)}
|
||||
{ev.applied_by_username && ` · ${ev.applied_by_username}`}{ev.waiter_note && ` · ${ev.waiter_note}`}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user