Files
bonaminandClaude Opus 5.5 72e175ab73 feat(backend,waiter,terminal,manager): +1 on a sent line and changing a line's quantity
Owner 2026-11-23 (plan 6F.5). Product flag one_more_enabled (off by default; product editor).
POST /api/orders/{id}/items/{item}/again: a new line like the old one (choices, removed, note,
course), priced now, sent to the kitchen like any new line. Waiter app and the counter's table
panel: +1 beside such lines; the first tap arms it, more taps count up, 'Send +N' sends, 4 s idle
disarms (no stray sends).
POST /api/orders/{id}/items/{item}/quantity: venue setting orders.quantity_change (off | add_only |
add_and_remove, default off), key ordering.items.change_quantity (owner, store manager; Alembic 0049
grants it); up only changes the line, down cuts a cancelled part ('quantity lowered', split_from_id)
and prints a cancellation only when asked (the dialog presets yes while the kitchen hasn't finished).
Waiter: 'Change quantity' in a line's actions (now -> new, -/+). cut_part() now shared with split.
GET /api/orders/{id} items carry the product's one_more_enabled / unit_type, deal ids, split_from_id,
cancel_reason.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 08:26:46 +02:00

31 lines
1.1 KiB
Python

"""One more and quantity changes (owner 2026-11-23, plan 6F.5).
- products.one_more_enabled (off: the owner turns it on per product).
- The key ordering.items.change_quantity for owners and store managers (the venue's setting
orders.quantity_change starts 'off').
Revision ID: 0049_one_more
Revises: 0048_order_moves
Create Date: 2026-11-23 18:00:00
"""
from alembic import op
import sqlalchemy as sa
revision = '0049_one_more'
down_revision = '0048_order_moves'
branch_labels = None
depends_on = None
def upgrade() -> None:
with op.batch_alter_table('products') as b:
b.add_column(sa.Column('one_more_enabled', sa.Boolean(), nullable=False, server_default='0'))
op.get_bind().execute(sa.text("insert or ignore into user_permissions (user_id, key) "
"select id, 'ordering.items.change_quantity' from users where role in ('owner', 'store_manager')"))
def downgrade() -> None:
op.get_bind().execute(sa.text("delete from user_permissions where key = 'ordering.items.change_quantity'"))
with op.batch_alter_table('products') as b:
b.drop_column('one_more_enabled')