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:
@@ -98,10 +98,13 @@ def test_revert_payment_is_a_key_a_manager_can_approve(client, db, shop):
|
||||
|
||||
|
||||
def test_price_change_needs_only_the_key_no_venue_switch(client, shop, login):
|
||||
"""A sent line's price: ordering.prices.modify_sent since 6F.3 (modify alone is for the cart)."""
|
||||
o, item = shop["order"], shop["items"][0]
|
||||
url = f"/api/orders/{o.id}/items/{item.id}/price-adjust"
|
||||
assert err(client.patch(url, headers=shop["h"], json={"price_adjustment": -1})) == "access.override_possible"
|
||||
h = login(shop["new_waiter"](add=("ordering.prices.modify",)), client="waiter")
|
||||
assert err(client.patch(url, headers=h, json={"price_adjustment": -1})) == "access.override_possible"
|
||||
h = login(shop["new_waiter"](add=("ordering.prices.modify_sent",)), client="waiter")
|
||||
r = client.patch(url, headers=h, json={"price_adjustment": -1})
|
||||
assert r.status_code == 200, r.text
|
||||
|
||||
|
||||
Reference in New Issue
Block a user