- services/day_auto.py: a minute loop (venue time, offline) opens the day when the opening
hours start (or at business_day.auto_open_time) and closes it when they end (or at
auto_close_time); 'alert' only tells the managers. Offsets before / after, one day across
the break or one per span, spans past midnight belong to the day they start, a day closed
by hand isn't reopened in the same span, a restart catches up the open (until the business
date changes for 'time') and alerts a missed close instead of doing it late.
- The close runs only when no order of the day is unclosed (Q-10): otherwise a sticky alert
and a new try every 15 minutes. A locked / expired license turns the open into an alert.
- Sticky notifications: notifications.resolved_at + core.notifications.resolve(); the
alerts resolve when the day opens / closes (by hand or by itself).
- services/business_days.py: the one open / close path (the routes and the loop); days opened
or closed by the system have no opener / closer and opened_auto / closed_auto (Alembic 0052).
- Manager: Settings -> Operation "Opening and closing the day"; the bell's action buttons
("Open now", "Go to the overview"); Reports -> Days marks days opened / closed by itself.
Plan platform-v2 6F.8.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
74 lines
9.0 KiB
Python
74 lines
9.0 KiB
Python
"""Module manifest — see core/modules/model.py and APPS_PLATFORM §4."""
|
|
from core.modules.model import Module, Mount, Perm, SettingDef
|
|
|
|
MODULE = Module(
|
|
key='ordering',
|
|
kind='feature',
|
|
name='Ordering',
|
|
description='Orders, payments, business day, shifts, cash and kitchen printing.',
|
|
depends=('catalog',),
|
|
permissions=(
|
|
Perm('ordering.orders.open', 'Open orders and add items', roles=('owner', 'store_manager', 'barista', 'barman', 'waiter')),
|
|
Perm('ordering.orders.close', 'Take payments and close orders', roles=('owner', 'store_manager', 'barista', 'barman', 'waiter')),
|
|
Perm('ordering.orders.cancel', 'Cancel items already sent', roles=('owner', 'store_manager'), overridable=True),
|
|
Perm('ordering.prices.modify', "Change an item's price before it is sent", roles=('owner',), overridable=True),
|
|
Perm('ordering.prices.modify_sent', "Change the price of an item already sent or served", roles=('owner',), overridable=True),
|
|
Perm('ordering.items.change_quantity', "Change a sent line's quantity (no new ticket)", roles=('owner', 'store_manager'), overridable=True),
|
|
Perm('ordering.prices.view_changes', 'See the prices changed by hand (who, when, why)', roles=('owner', 'store_manager')),
|
|
Perm('ordering.refunds', 'Refund payments from other shifts', roles=('owner', 'store_manager'), overridable=True),
|
|
Perm('ordering.payments.revert', 'Turn paid items back to unpaid', roles=('owner', 'store_manager'), overridable=True),
|
|
Perm('ordering.payments.split_amount', 'Split a bill by amount (equal parts or a ratio)', roles=('owner', 'store_manager', 'barista', 'barman', 'waiter'), overridable=True),
|
|
Perm('ordering.business_day.manage', 'Open and close the business day', roles=('owner', 'store_manager', 'staff_manager')),
|
|
),
|
|
settings=(
|
|
SettingDef('business_day.force_close_allowed', 'true', 'Allow force-closing business day with open tables', type='bool'),
|
|
SettingDef('business_day.auto_open', 'off', "The day opens by itself (6F.8): 'off' | 'schedule' (at the opening hours) | 'time' (every day at business_day.auto_open_time) | 'alert' (at the opening hours, only tell the managers)", type='enum', choices=('off', 'schedule', 'time', 'alert')),
|
|
SettingDef('business_day.auto_close', 'off', "The day closes by itself (6F.8): 'off' | 'schedule' | 'time' | 'alert'. Closes only when every order of the day is closed; otherwise the managers are alerted and it tries again every 15 minutes.", type='enum', choices=('off', 'schedule', 'time', 'alert')),
|
|
SettingDef('business_day.auto_open_time', '09:00', "HH:MM venue time, for business_day.auto_open = 'time' (6F.8).", type='str'),
|
|
SettingDef('business_day.auto_close_time', '23:30', "HH:MM venue time, for business_day.auto_close = 'time' (6F.8).", type='str'),
|
|
SettingDef('business_day.auto_ignore_break', 'true', "A day's opening spans count as one (first opening to last closing); 'false' = the break between spans closes the day and the next span opens a new one (6F.8).", type='bool'),
|
|
SettingDef('business_day.auto_open_offset_min', '0', 'Open this many minutes before the opening hours start (6F.8, 0-720).', type='int'),
|
|
SettingDef('business_day.auto_close_offset_min', '0', 'Close this many minutes after the opening hours end (6F.8, 0-720).', type='int'),
|
|
SettingDef('business_day.rollover_hour', '6', 'Hour (0-23, venue time) before which a newly opened business day counts as the previous date. Default 6.', type='int'),
|
|
SettingDef('orders.auto_close_on_full_payment', 'false', "Automatically close the table order when all items have been paid: 'true' | 'false'", type='bool'),
|
|
SettingDef('orders.close_with_unpaid', 'false', "Allow closing an order that still has unpaid items (they are written off as unpaid): 'true' | 'false'. When 'false', closing asks for the payment first (plan step 4.8).", type='bool'),
|
|
SettingDef('orders.bypass_kds_serve', 'false', "Skip KDS pending/serve flow — new orders and items are immediately marked as served: 'true' | 'false'", type='bool'),
|
|
SettingDef('orders.quantity_change', 'off', "Changing a sent line's quantity without sending it again (6F.5): 'off' | 'add_only' | 'add_and_remove' (lowering cancels the difference; also needs ordering.orders.cancel). Who may: ordering.items.change_quantity.", type='enum', choices=('off', 'add_only', 'add_and_remove')),
|
|
SettingDef('orders.price_change', 'anytime', "Changing a line's price by hand (6F.3): 'off' | 'before_sending' (only in the cart) | 'anytime' (also a sent or served line). Who may: the keys ordering.prices.modify / modify_sent.", type='enum', choices=('off', 'before_sending', 'anytime')),
|
|
SettingDef('orders.price_change_reason', 'false', "A price changed by hand needs a reason: 'true' | 'false' (6F.3).", type='bool'),
|
|
SettingDef('orders.price_change_reasons', '[]', 'JSON array of quick reasons offered when a price is changed by hand (6F.3); [] = the built-in ones.', type='json'),
|
|
SettingDef('orders.courses', '[]', 'JSON array of course objects [{id, name, color}] defining available courses', type='json'),
|
|
SettingDef('orders.courses_enabled', 'false', "Enable per-item course assignment when ordering: 'true' | 'false'", type='bool'),
|
|
SettingDef('orders.quick_notes', '["Χωρίς αλάτι","Βγάλτε γρήγορα","Αλλεργία!","Κόψτε σε μικρά κομμάτια","Έξτρα χαρτοπετσέτες"]', 'JSON array of quick-note strings shown in the waiter note tab', type='json'),
|
|
SettingDef('payments.split_amount', 'off', "Splitting a bill by amount (6F.6), each level with the ones before: 'off' | 'two_equal' (half and half) | 'two_custom' (two parts in any ratio) | 'multiple_equal' (2 to payments.split_max_parts equal parts). Who may: ordering.payments.split_amount.", type='enum', choices=('off', 'two_equal', 'two_custom', 'multiple_equal')),
|
|
SettingDef('payments.split_max_parts', '10', 'The most equal parts a bill can be split into (6F.6, 2-50).', type='int'),
|
|
SettingDef('payments.card_enabled', 'false', "Allow waiters to record card payments (in addition to cash): 'true' | 'false'", type='bool'),
|
|
SettingDef('print.alert_after_failures', '2', 'Tell managers when a kitchen/bar ticket has failed to print this many times and is still retrying (0 = never; they are always told when a ticket is finally given up).', type='int'),
|
|
SettingDef('print.beep_on_ticket', 'true', "Play beep when a kitchen ticket prints: 'true' | 'false'", type='bool'),
|
|
SettingDef('print.beep_pattern', 'double', "Beep pattern: 'single' | 'double' | 'triple' | 'long' | 'custom:n1:n2:n3'", type='str'),
|
|
SettingDef('print.divider_style', 'dash', 'Divider character used between sections: dash, equals, star, or empty', type='str'),
|
|
SettingDef('print.dot_style', 'dot_space:0:0', 'Dot-leader style for item lines: STYLE:SIZE:BOLD where STYLE is dot_space|dot|dash_space|underscore, SIZE is ESC ! base byte (0/16/32/48), BOLD 0|1', type='str'),
|
|
SettingDef('print.font_extra', '0:0:0', 'Font for extra/option lines (+ marker): SIZE:BOLD:CAPS', type='str'),
|
|
SettingDef('print.font_ingredient', '0:0:0', 'Font for removed ingredient lines (- marker): SIZE:BOLD:CAPS', type='str'),
|
|
SettingDef('print.font_item_name', '16:1:0', 'Font for item name lines: SIZE:BOLD:CAPS', type='str'),
|
|
SettingDef('print.font_item_note', '0:0:0', 'Font for per-item note lines: SIZE:BOLD:CAPS', type='str'),
|
|
SettingDef('print.font_meta', '0:0:0', 'Font for table/waiter/time header block: SIZE:BOLD:CAPS', type='str'),
|
|
SettingDef('print.font_order_note', '0:1:0', 'Font for order-level notes: SIZE:BOLD:CAPS', type='str'),
|
|
SettingDef('print.font_order_number', '48:1:0', 'Font for order number header: SIZE:BOLD:CAPS', type='str'),
|
|
SettingDef('print.font_pref', '0:0:0', 'Font for preference choice lines (> marker): SIZE:BOLD:CAPS', type='str'),
|
|
SettingDef('print.font_quick', '0:0:0', 'Font for quick option lines (* marker): SIZE:BOLD:CAPS', type='str'),
|
|
SettingDef('print.ticket_mode', 'detailed', "Kitchen ticket layout mode: 'detailed' or 'compact'", type='str'),
|
|
SettingDef('shifts.hide_revenue_from_waiters', 'false', "Hide ΕΙΣΠΡΑΞΗ and ΠΑΡΑΔ. ΠΟΣΟ stats from waiters in Shift Overview: 'true' | 'false'", type='bool'),
|
|
SettingDef('shifts.waiter_self_end', 'true', 'Allow waiters to end their own shifts without manager action', type='bool'),
|
|
SettingDef('shifts.waiter_self_start', 'true', 'Allow waiters to start their own shifts without manager action', type='bool'),
|
|
SettingDef('flags.display_mode', 'both', "How table flags show on the waiter's table cards: 'both' | 'emoji' | 'color'.", type='str'),
|
|
),
|
|
routers=(
|
|
Mount('routers.orders', '/api/orders'),
|
|
Mount('routers.business_day', '/api/business-day'),
|
|
Mount('routers.shifts', '/api/shifts'),
|
|
Mount('routers.flags', '/api/flags'),
|
|
Mount('routers.print_problems', '/api/print-problems'), # 6.10
|
|
),
|
|
)
|