fix(pos): honor scanned barcode UOM in item selection dialog#311
Open
NotAbdelrahmanelsayed wants to merge 2 commits into
Open
fix(pos): honor scanned barcode UOM in item selection dialog#311NotAbdelrahmanelsayed wants to merge 2 commits into
NotAbdelrahmanelsayed wants to merge 2 commits into
Conversation
When a barcode is tied to a non-stock UOM (e.g. a barcode keyed to "Nos" on a gram-stocked item), search_by_barcode resolves item.uom to that UOM, but ItemSelectionDialog defaulted the UOM radio to the stock UOM whenever there was more than one possible UOM. barcode_uoms isn't carried on the search_by_barcode response, so its single-barcode auto-select never fired either, and the scan landed on the stock UOM instead of the barcode's UOM. Prefer an explicitly resolved UOM when defaulting the selection: resolved_uom -> scanned barcode UOM (item.uom != stock_uom) -> a sole barcode UOM -> stock UOM. No behaviour change when item.uom is absent or equals the stock UOM. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…dialog-selection # Conflicts: # POS/src/components/sale/ItemSelectionDialog.vue
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.
Problem
When a barcode is tied to a UOM that differs from the item's stock UOM — e.g. a barcode keyed to Nos on an item stocked in grams — scanning it adds the item in the stock UOM, not the barcode's UOM.
search_by_barcodealready resolves this correctly: it setsitem.uomfromItem Barcode.uomand returns the rightconversion_factor. But when the scan opens the UOM dialog (scanner mode without auto-add),ItemSelectionDialog.loadOptions()defaulted the selected option tooptions[0](the stock UOM) whenever there was more than one UOM. Its single-barcode auto-select couldn't help either, becausesearch_by_barcodedoesn't populatebarcode_uomson its response — so the dialog always landed on the stock UOM.Fix
When defaulting the UOM selection, prefer an explicitly resolved UOM:
resolved_uom(weighted/priced barcodes) → scanned barcode UOM (item.uomwhen it differs fromstock_uom) → a solebarcode_uomsentry → stock UOM.No behaviour change when
item.uomis absent or equals the stock UOM (normal grid taps, single-UOM items), so existing flows are unaffected.Test plan
resolved_uom) → unchanged.🤖 Generated with Claude Code