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:
2026-11-23 07:41:43 +02:00
co-authored by Claude Opus 5.5
parent e3f4f3eeee
commit f87f9ff23c
40 changed files with 1044 additions and 73 deletions
+16
View File
@@ -737,6 +737,20 @@ try {
let notesNow = []
for (let i = 0; i < 30 && !notesNow.includes('E2E: well done'); i++) { await sleep(150); notesNow = JSON.parse(await settingValue2('orders.quick_notes') || '[]') }
r.check(`${st6} Operation: a quick note added`, notesNow.includes('E2E: well done'), JSON.stringify(notesNow))
// 6F.3: prices changed by hand: the venue's switch, then the reason and its quick reasons
await page.getByTestId('setting-orders.price_change').selectOption('before_sending')
let pcMode = ''
for (let i = 0; i < 30 && pcMode !== 'before_sending'; i++) { await sleep(150); pcMode = await settingValue2('orders.price_change') }
await page.getByTestId('settings-price-changes').getByRole('switch').first().click()
await page.getByTestId('price-reason-new').fill('E2E: birthday')
await page.getByTestId('price-reason-add').click()
let reasonsNow = []
for (let i = 0; i < 30 && !reasonsNow.includes('E2E: birthday'); i++) { await sleep(150); reasonsNow = JSON.parse(await settingValue2('orders.price_change_reasons') || '[]') }
r.check(`${st6} Operation: prices by hand "before sending only", a reason asked, a quick reason added`,
pcMode === 'before_sending' && await settingValue2('orders.price_change_reason') === 'true' && reasonsNow.includes('E2E: birthday'))
await page.getByTestId('setting-orders.price_change').selectOption('anytime')
await page.getByTestId('settings-price-changes').getByRole('switch').first().click()
await sleep(500)
await page.getByTestId('flag-new').click()
await page.getByTestId('flag-save').click()
r.check(`${st6} a table flag needs a name`, (await page.getByTestId('flag-dialog').textContent()).includes('Enter a name'))
@@ -1421,6 +1435,8 @@ try {
await opens('/reports/misc', 'cancellations-count', 'Cancellations')
await page.getByTestId('report-tab-discounts').click()
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/technical', 'printing-total', 'Technical → Printing')
await opens('/reports/prep-zones', 'report-period', 'Prep zones')
await opens('/reports/expenses', 'expenses-total', 'Expenses')