-
Notifications
You must be signed in to change notification settings - Fork 660
Pos Awesome v15 Fixed #485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
defendicon
wants to merge
1,310
commits into
ucraft-com:develop
Choose a base branch
from
defendicon:develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+102,811
−17,253
Conversation
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
- Added 5s timeout to fetchItemDetails in ItemsSelector.vue to prevent blocking when network is unresponsive - Handled timeout error by aborting the request and falling back to cached item data - Updated update_items_details to skip retry logic on timeout to avoid infinite loops and errors - Fixes issue where adding items would hang and error out when internet is disconnected but browser reports online status
- Remove redundant `frappe.db.exists` check in `get_items_from_barcode`. - Rely on `frappe.get_cached_doc` to handle non-existent items via `DoesNotExistError`. - Saves one DB query per barcode scan operation.
Refactor `ItemsTable.vue` to use memoized versions of `formatFloat`, `formatCurrency`, and `isNegative` for better rendering performance in the virtual scroll list. - Implemented `memoizedFormatFloat` and `memoizedFormatCurrency` computed properties that return a function backed by a non-reactive cache. - Implemented `memoizedIsNegative` to perform a fast numeric check. - Added `formatCache` initialization in `created()` to avoid reactivity loops. - Added watchers to clear the cache when currency or profile settings change. - Replaced template usages of formatting functions with memoized versions. - Removed unused imports and variables.
feat: Memoize formatting functions in ItemsTable
…mode fix: add timeout to item details fetch to prevent hanging in offline mode
This commit refactors the pricing engine to evaluate both pricing (rate/discount) and free item rules in a single pass over the candidate rules. Previously, `applyLocalPricingRules` and `computeFreeItems` were called separately, causing redundant work: - Collecting candidates from the index (map lookups) - Filtering candidates (date, party, currency, etc.) - Sorting candidates Now, `evaluatePricingRules` performs these steps once and splits the rules into pricing and free item buckets for execution. `applyLocalPricingRules` and `computeFreeItems` are retained as wrappers for backward compatibility but delegate to the unified function. Impact: - Reduces iteration overhead for every item in the cart. - Avoids double-sorting of rules. - Improves performance especially when many items or rules are present. Verified with unit tests in `pricingEngine.spec.js`.
fix: Combine pricing rule evaluation for unified path of execution.
Pre-compute a search index string for each item in the store to optimize filtering performance. Updated `ItemsSelector.vue` to use the pre-computed index, reducing overhead during search input.
fix: Optimize item search with pre-computed index
- Added `:aria-label="__('Decrease quantity')"` to the minus button.
- Added `:aria-label="__('Increase quantity')"` to the plus button.
- Added `:aria-label="__('Remove item')"` to the delete button.
- Added `:aria-label="__('Previous unit of measure')"` to the left UOM arrow.
- Added `:aria-label="__('Next unit of measure')"` to the right UOM arrow.
This improves accessibility for screen reader users by providing descriptive labels for icon-only buttons. No visual changes.
feat: add aria-labels to ItemsTable buttons
- Switch Vite build to ES module format with code splitting enabled. - Introduce `loader.js` to dynamically import the main bundle, bypassing Frappe's synchronous script injection limitations. - Update `posapp.js` to wait for the async module initialization before starting the Vue app. - Update `hooks.py` to include `loader.js` instead of the UMD bundle. - Add robust error handling for async loading sequence.
- Update `vite.config.js` to disable CSS code splitting (`cssCodeSplit: false`). - Enforce explicit output filename for assets (`posawesome.[ext]`) to ensure the CSS file matches the path expected by `hooks.py`. - This resolves CSS 404 errors caused by hashed filenames when switching to ES module builds.
- Re-enable local item filtering in `ItemsSelector.vue` when the search query has 3 or more characters. - This provides immediate UI feedback while the backend search (if needed) runs asynchronously. - Utilizes the `_search_index` property for efficient filtering, with a robust fallback for items missing the index. - Preserves the performance benefits of using the store as the source of truth while ensuring the user experience matches previous behavior.
feat: Enable Code Splitting and Async Loading
Moves `searchCache`, `barcodeIndex`, `itemCache`, `lastInvoiceRateCache` (in ItemsSelector) and `qtyLengthCache` (in ItemsTable) from `data()` to `created()` to avoid Vue reactivity overhead. This optimization significantly reduces the cost of initializing these components and performing lookups, as Vue no longer needs to create deep proxies or observers for these potentially large Map objects. Note: `expandedCache` in `ItemsTable.vue` was intentionally kept in `data()` to preserve reactivity for UI state updates.
feat: optimize reactive overhead for large caches
Sets the `base` in `vite.config.js` to `/assets/posawesome/dist/js/` to ensure that dynamically imported chunks are loaded from the correct path instead of the root domain. This resolves 404 errors for code-splitted files.
fix: set correct base path for vite build assets
This change optimizes the ItemsSelector component by memoizing the `format_currency` and `format_number` functions. These functions are called frequently within the `RecycleScroller` and `v-data-table-virtual` templates, causing significant CPU overhead during list rendering and scrolling. The optimization involves: 1. Initializing a non-reactive `formatCache` Map in `created()`. 2. Creating `memoizedFormatCurrency` and `memoizedFormatNumber` computed properties that return memoized versions of the format functions. 3. Updating the template to use these memoized functions. 4. Clearing the cache when currency changes or the component is destroyed. This should improve scrolling performance and reduce frame drops in the item selector list.
Correctly handles the race between the item details fetch request and the timeout promise. - Clears the timeout timer immediately if the request completes (success or failure) to prevent delayed rejections. - Catches the rejection of the aborted request promise if the timeout wins, preventing unhandled promise rejections in the browser console.
fix: race condition and unhandled rejections in item details fetch
feat: Memoize currency and number formatting in ItemsSelector
- In `ItemsSelector.vue`, skip redundant local filtering when the search term matches the store's active search term. - In `ItemsTable.vue`, utilize the pre-computed `_search_index` property on items for faster filtering instead of traversing the object tree.
fix: Optimize items search and filtering
feat: Optimize Pos App Performance to Enhance Speed.
FEAT feat(a11y): add aria-labels to ItemsTable buttons feat: Add configurable return validity controls for POS invoices feat: Add denomination buttons to Payments component feat: Add smart denomination buttons to Payments component feat: Enable code splitting and async module loading feat: Enable Code Splitting and Async Loading feat: Implement and fix inline cart editing feat: Memoize currency and number formatting in ItemsSelector feat: Memoize formatting functions in ItemsTable feat: optimize reactive overhead for large caches feat: Restore auto-search for queries >= 3 characters feat: Show customer last invoice rates in item selector feat: intelligent quick cash buttons with smart tender suggestions feat: allow per-item override for negative stock validation feat: clear items table inputs on click, revert on empty blur feat: implement periodic item sync and network usage tracking feat(pos): Implement and fix inline cart editing feat: Optimize Pos App Performance to Enhance Speed. FIX fix(ItemsSelector): resolve race condition in fetchItemDetails fix: Allow item-level override for negative stock blocking fix: Allow pricing rules on UOM-priced items fix: Avoid closing payments while recomputing totals and reset additi… fix: Combine pricing rule evaluation for unified path of execution. fix: Dark Mode UI issues across POS components fix: Ensure CSS is bundled correctly during code splitting fix: Implement and Fix Inline Cart Editing fix: Make editable Boxes and Clear item inputs on click, revert on em… fix: Optimize item search with pre-computed index fix: Optimize items search and filtering fix: Periodic Item Synchronization and Network Usage Monitoring fix: Preserve offline invoice timestamps during sync fix: Refactor Server Usage gadget and fix dark mode text visibility fix: Respect item-level negative stock settings fix: Strengthen offline cache schema metadata fix: Sync pricing rule totals to invoice snapshot before draft creation fix: Handle UOM barcode pricing fallback fix: add timeout to item details fetch to prevent hanging in offline … fix: prevent item add hanging when internet is unstable fix: race condition and unhandled rejections in item details fetch fix: set correct base path for vite build assets fix: overlapping items in POS card view PERF perf: Combine pricing rule evaluation into a single pass perf: Optimize items search and filtering perf: memoize format_currency and format_number in ItemsSelector perf: memoize formatting functions in ItemsTable perf: move large caches to created hook in ItemsSelector and ItemsTable perf: Optimize item barcode search performance perf: optimize item search performance CHORE chore: fix asset path for code-splitted chunks OTHER Add POS Profile return validity settings Add return validity controls for POS invoices Add toggle for last invoice rate display Align last invoice rate display with upstream Avoid closing payments while recomputing totals Avoid resetting additional discount when applying pricing rules Deduplicate offline connection warnings Fix Dark Mode UI issues in Menu, ItemsSelector, Returns, and Payments Fix negative stock checks when blocking beyond available Fix overlapping items in POS card view Fix service worker registration path Fix: Sync pricing rule totals to invoice snapshot before draft creation Fix: service worker registration path Fix barcode UOM pricing base rate duplication Handle UOM barcode pricing fallback Highlight expired return invoices Improve offline schema versioning Keep additional discount visible after payment refresh Make last invoice rate setting a switch Preserve additional discounts when pricing rules not returned Preserve offline invoice timestamps during sync Refactor ServerUsageGadget and fix dark mode text colors Respect item-level negative stock settings Show UOM on last invoice rate chips Show customer last invoice rates in item selector Smart Tender Suggestions for POS Payments Throttle repeated offline warning notification Allow pricing rules to update UOM-priced items
Release 15.12.0 — December 17, 2025 ### ✨ Features - add aria-labels to ItemsTable buttons - Add configurable return validity controls for POS invoices - Add denomination buttons to Payments component - Add denomination buttons to Payments component - Add smart denomination buttons to Payments component - allow per-item override for negative stock validation - clear items table inputs on click, revert on empty blur - Enable Code Splitting and Async Loading - Enable code splitting and async module loading - Implement and fix inline cart editing - implement periodic item sync and network usage tracking - implement periodic item sync and network usage tracking - intelligent quick cash buttons with smart tender suggestions - Memoize currency and number formatting in ItemsSelector - Memoize formatting functions in ItemsTable - Optimize Pos App Performance to Enhance Speed. - optimize reactive overhead for large caches - Restore auto-search for queries >= 3 characters - Show customer last invoice rates in item selector - add aria-labels to ItemsTable buttons (a11y) - Implement and fix inline cart editing (pos) - Implement and fix inline cart editing (pos) - Implement and fix inline cart editing (pos) _Total: 23 changes_ ### 🐞 Bug Fixes - add timeout to item details fetch to prevent hanging in offline mode - Allow item-level override for negative stock blocking - Allow pricing rules on UOM-priced items - Avoid closing payments while recomputing totals and reset additional discount - Combine pricing rule evaluation for unified path of execution. - Dark Mode UI issues across POS components - Ensure CSS is bundled correctly during code splitting - Handle UOM barcode pricing fallback - Implement and Fix Inline Cart Editing - Make editable Boxes and Clear item inputs on click, revert on empty blur. - Optimize item search with pre-computed index - Optimize items search and filtering - overlapping items in POS card view - Periodic Item Synchronization and Network Usage Monitoring - Preserve offline invoice timestamps during sync - prevent item add hanging when internet is unstable - race condition and unhandled rejections in item details fetch - Refactor Server Usage gadget and fix dark mode text visibility - Respect item-level negative stock settings - set correct base path for vite build assets - Strengthen offline cache schema metadata - Sync pricing rule totals to invoice snapshot before draft creation - resolve race condition in fetchItemDetails (ItemsSelector) _Total: 23 changes_ ### ⚡ Performance - Combine pricing rule evaluation into a single pass - memoize format_currency and format_number in ItemsSelector - memoize formatting functions in ItemsTable - move large caches to created hook in ItemsSelector and ItemsTable - Optimize items search and filtering _Total: 5 changes_ ### 🧰 Maintenance - fix asset path for code-splitted chunks _Total: 1 changes_ — Changelog auto-generated by semantic-release. Thanks to all contributors! 🙌
Removes the redundant `validate_cart_items` API call in the checkout flow when synchronous submission is used. The backend `submit_invoice` method already performs validation, so the pre-check added unnecessary latency. - Modifies `Payments.vue` to skip the pre-check unless background submission is enabled. - Updates error handling to parse and display stock errors returned directly from the submission endpoint. - Reduces checkout latency by eliminating one blocking network request.
perf: optimize checkout stock validation latency
- Refactor `search_invoices_for_return` to eliminate O(N) N+1 queries by implementing bulk fetching (Eager Loading) for invoices, items, and payments. This reduces DB queries from ~200+ per request to ~5 constant queries for a page of 100 invoices. - Optimize `submit_invoice` by replacing `frappe.get_doc` with `frappe.db.get_value` for Payment Entry lookups, reducing overhead during credit redemption. - Add performance journal entry.
The frontend `validate_cart_items` call in `Payments.vue` is redundant because the backend `submit_invoice` API already performs synchronous stock validation (`_validate_stock_on_invoice`) before enqueuing any background jobs or submitting the invoice. Removing this extra network call reduces checkout latency by one round-trip (approx 200-500ms depending on network) without compromising data integrity, as the backend remains the source of truth for stock validation. Note that non-blocking stock warnings (for allowed negative stock) are suppressed in the background submission flow, aligning it with the synchronous flow behavior.
perf: Optimize invoice search and submission for checkout speed
perf: remove redundant stock validation on checkout
💡 What: - Frontend: `get_invoice_items` payload now explicitly includes `is_stock_item`. - Backend: `_collect_stock_errors` pre-fetches global "Stock Settings" -> "allow_negative_stock" once instead of inside the loop. - Backend: `_allow_negative_stock` now accepts the pre-fetched global setting. 🎯 Why: - Previous implementation performed 2N DB/Cache lookups for a cart of N items during validation (1 for `is_stock_item` check, 1 for `allow_negative_stock` check). - With large carts (e.g., 50+ items), this added significant latency to the validation step before payment. 📊 Impact: - Reduces DB/Cache queries for stock validation from O(N) to O(1). - Expected validation latency reduction of ~20-50ms per 50 items (depending on network/cache speed).
perf: Optimize stock validation checks during invoice submission
Normalize non-original return item handling for POS invoices
perf: avoid forced re-renders in payments screen
perf: cache normalized payment amounts during checkout
Disable auto-print when opening print preview in new tab
Add container-aware resize handling to ItemsSelector
Keep additional discount fields from clearing on focus/blur
…ainer-aware-resize-handling-to-itemsselector.vue Revert "Add container-aware resize handling to ItemsSelector"
…ettings perf: Background sync refresh all modified items, add scheduler and settings
updates from Stage develop
Release 15.17.0 — January 5, 2026 ### ✨ Features - Add arrow-key navigation and highlighting to item selector _Total: 1 changes_ ### 🐞 Bug Fixes - Optimize invoice stock validation performance _Total: 1 changes_ ### ⚡ Performance - avoid forced payment re-renders - avoid forced re-renders in payments screen - Background sync refresh all modified items, add scheduler and settings - cache normalized payment amounts - cache normalized payment amounts during checkout - optimize checkout by removing redundant stock validation - optimize checkout stock validation latency - Optimize invoice search and submission for checkout speed - Optimize invoice search and submission for checkout speed - Optimize stock validation checks during invoice submission - Optimize stock validation checks during invoice submission - Optimize stock validation with bulk query - remove redundant stock validation on checkout - remove redundant stock validation on checkout _Total: 14 changes_ — Changelog auto-generated by semantic-release. Thanks to all contributors! 🙌
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.
Several Bugs Fixed Include
Edit Rate Fixed
Edit Discount Fixed
Partial Payment Fixed
Additional Discount Fixed
Show Customer Ledger Aside Date Field
Please Highlight any bugs and process so more bugs can be fixed.