URY POS Restructuring and User Room Management - #247
Open
swafa-as wants to merge 26 commits into
Open
Conversation
Extract the 3-step POS Profile lookup (profile_user -> captain -> branch fallback) into a reusable _resolve_pos_profile(user, branch) helper. Callers updated: - getPosProfile(): replaced inline 24-line block with one-liner - get_allowed_profiles(): direct call instead of full getPosProfile() - getInvoiceForCashier(): direct call instead of full getPosProfile() - pos_extend.overrided_past_order_list(): same - ury_kot_display.kot_list(): same - ury_kot_display.served_kot_list(): same
…and before submit
…captains instead of applicable_for_users
…rom URY Restaurant link fields
swafa-as
force-pushed
the
pos-user-branch-restructuring
branch
from
July 23, 2026 15:11
c91dfd3 to
e6fb875
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.
1. Overview
This PR restructures the POS architecture of the URY application. It deprecates the previous sub-cashier closing model, enables multiple POS profiles per branch, decouples room assignment from individual branch users to the POS Profile itself, implements branch-level atomic order counters, and decouples production units from specific POS profiles.
2. Key Changes
Schema & Metadata Customizations (Fixtures)
custom_reset_order_number_daily(Check, defaults to 1)custom_order_counter(Int, defaults to 0, hidden)custom_aggregator_order_counter(Int, defaults to 0, hidden)custom_last_reset_date(Date, hidden)custom_enable_multiple_cashierand its multi-cashier configuration section. Added:custom_captains(Table:POS Profile Captain)custom_rooms(Table MultiSelect:URY Room)custom_captain_access_to_other_profiles(Check)custom_cashier_access_to_other_profiles(Check)custom_captain_accessible_profiles(Table MultiSelect:POS Profile)custom_cashier_accessible_profiles(Table MultiSelect:POS Profile)roomfield as room mappings move toPOS Profile.pos_profilefield and makingbranchmandatory (reqd=1andread_only=0).Sub POS Closing,Sub POS Closing Payment,Sub POS Invoicesare marked as deprecated in their doctype definitions.Backend Python Logic
_resolve_pos_profile(user, branch)that resolves profiles for cashiers (viaapplicable_for_users) and captains (viacustom_captains), falling back to the first profile on the branch.get_allowed_profiles(user, branch)to build a list of visible profiles for a user based on captain/cashier accessibility configurations.getBranchRoomandgetRoomto retrieve active rooms from the user's resolvedPOS Profilecustom rooms.getPosProfile()to resolve profile names using the new helper, returning a simplified dict without the deprecated cashier/owner/room-matching logic.getInvoiceForCashierandgetPosInvoice) to the list ofallowed_profilesusing SQLINconditions rather than the generic branch scope.POS Closing EntryandPOS Opening Entry.on_submitevent onPOS Closing Entryto invoke counter reset logic.set_cashier_roomto retrieve assigned rooms from the targetPOS Profile.on_submitlogic: if all other POS sessions for the branch are closed, resets the branch order counters.Branchdoctype.overrided_past_order_list()queries to the active profile'scustom_rooms.Frontend Integration
multiple_cashierorowneris missing from the API response.Data Migration Patch
reset_order_number_dailyconfigurations from profiles to branches.applicable_for_userschild table on POS Profiles withcustom_enable_multiple_cashier=1.URY User.roomtoPOS Profile.custom_rooms.branchandwarehouseare set on existingURY Production Unitrecords beforepos_profileis deleted.3. Test Coverage and Verification
test_room_resolution- Verifies that rooms are fetched from the POS Profile instead of the deprecated branch user settings.test_order_counter_increments- Confirms atomic branch counters increment correctly on new invoice inserts and store values as string format.test_cashier_owner_assignment- Checks cashier user and owner synchronization on the submitted invoice.test_pos_closing_resets_counter- Confirms counters are only reset when all sessions are closed andcustom_reset_order_number_dailyis enabled.test_allowed_profiles- Asserts correct profile list is resolved based on access configurations.