feat: combined waiter delta KOT slip printing#129
Draft
anwar-shihab wants to merge 3 commits into
Draft
Conversation
Add room-level waiter printing on URY Printer Settings and print one combined URY KOT slip per order save with delta items only, including cancellations. Print format remains site-managed on URY KOT doctype. Co-authored-by: Cursor <cursoragent@cursor.com>
Enrich combined waiter slip items with display_mode, old_qty, and new_qty so existing order changes render as old -> new (including full cancel to 0), while first-time additions keep a single quantity. Ship the URY Waiter Order Slip app print format and a migration patch so existing sites receive the updated template on bench migrate. Sites can still customize the Print Format or select another format per room printer. Co-authored-by: Cursor <cursoragent@cursor.com>
6044174 to
f929b3d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds room-level waiter printing for dine-in orders. Each time an order is saved and KOTs are generated via
kot_execute, the system prints one combined waiter slip containing only the delta items from that save (new/changed quantities + cancellations). The slip is not a full POS Invoice copy, does not include prices, and is not split by production unit.Waiter slips now show old -> new quantity for existing items (including full cancel to
0), and a single quantity for first-time additions.Kitchen KOT printing remains unchanged — still one slip per production unit on
URY KOT.on_submit.Problem
Waiters need a single, readable slip per order update showing what changed since the last save. Previously there was no dedicated waiter print path that:
Solution Overview
Quantity Display Behaviour
3)3 -> 5)10 -> 7)10 -> 0)Implementation Details
1. Custom fields —
URY Printer Settingscustom_waiter_printcustom_waiter_print_formatExported via
hooks.pyfixtures. After merge, runbench migrateon each site.2. Module —
ury_waiter_print.pybuild_combined_kot_doc(kot_names)kot_executecallwaiterfrom the linked POS Invoicekot_itemsvia_aggregate_kot_items():New Order,Order Modified): aggregate by(item, comments), sumquantityPartially cancelled,Cancelled): aggregate by(item, comments), sumcancelled_qty_enrich_item_display_fields()withdisplay_mode,old_qty,new_qtyURY KOTdocument (not saved to DB)print_combined_waiter_order_slip(invoice_id, kot_names, restaurant_table)URY Table.is_take_away)restaurant_roomon tablecustom_waiter_print = 1in that roomkot_itemsdoc_typemust beURY KOTprint_by_server("URY KOT", kot_names[0], printer, format, doc=combined_doc, no_letterhead=1)idx)3. Changes —
ury_kot_generate.pycreate_kot_doc()/create_cancel_kot_doc()return the created KOT nameprocess_items_for_kot()/process_items_for_cancel_kot()collect and return lists of KOT nameskot_execute(), callsprint_combined_waiter_order_slip()once with all created KOT namesImportant: Waiter print is triggered from
kot_executeonly — not fromURY KOT.on_submit. KOT reprint (ury_kot_reprint) is unaffected.4. Print format — app default + site customizable
URY Waiter Order SlipJSON (doc_type = URY KOT, iteratesdoc.kot_items, no pricing)old_qty -> new_qtywhendisplay_mode == "old_new", otherwise singlequantityfix_waiter_order_slip_print_formatupdates existing site formats onbench migrateBehaviour Matrix
Files Changed
ury/fixtures/custom_field.jsoncustom_waiter_print,custom_waiter_print_formatury/hooks.pyury/ury/api/ury_waiter_print.pyury/ury/api/ury_kot_generate.pykot_executeury/ury/api/test_ury_waiter_print.pyury/ury/print_format/ury_waiter_order_slip/ury_waiter_order_slip.jsonury/patches/v2_0/fix_waiter_order_slip_print_format.pyury/patches.txtTest Plan
Automated tests
Verified on
ury.localhost: 18 tests, all passing.test_build_combined_kot_doc_merges_multiple_kotstest_build_combined_kot_doc_aggregates_same_itemtest_build_combined_kot_doc_includes_cancel_linestest_first_time_add_shows_single_quantitytest_existing_item_increase_shows_old_newtest_existing_item_partial_cancel_shows_old_newtest_full_cancel_shows_old_to_zerotest_prints_combined_kot_for_dine_inURY KOTwith combined doctest_skips_when_combined_items_emptytest_skips_takeaway_tablestest_skips_without_restaurant_tabletest_skips_when_no_waiter_printerstest_skips_when_printer_format_not_settest_skips_when_format_missingtest_skips_when_format_wrong_doctypePOS Invoiceformattest_kot_execute_prints_once_with_all_created_kotstest_kot_reprint_does_not_call_waiter_printtest_waiter_format_excludes_pricing_sectionsManual verification
bench --site <site> migrate— custom fields + print format patch appliedDeployment Notes
bench --site <site> migrate— syncs custom fields and waiter print format templateURY Printer Settings(optionally customize Print Format)Out of Scope
URY KOT.on_submit