Repository navigation
[18.0][ADD] barcode_stock_product_multi_barcode - #22
antoniodavid wants to merge 1 commit into
Conversation
|
Thanks for the PR! Before reviewing it, could you add a description? A short summary of what the addon does and why it's needed, plus how to use or test it |
|
Thanks @szalatyzuzanna — I've added a description to the PR body: what the module does and why it is needed, how to use it, and what the tests cover (plus the Runboat link). |
rrebollo
left a comment
There was a problem hiding this comment.
Read against barcode_stock's preload and index build; the HOOT suite is green in CI and I did not repeat it locally. The ordering point is read from the code.
845edc3 to
8ff46d8
Compare
| indexes.barcodeToProductIds[code] = [ | ||
| ...(indexes.barcodeToProductIds[code] || []), | ||
| productId, | ||
| ]; |
There was a problem hiding this comment.
product_multi_barcode keeps a product's main barcode as a product.barcode row too (_compute_barcode = barcode_ids[:1].name), so this read returns it as well. Ran on 18.0 with one move and one alternate: the index ends with the same product twice for the main barcode, and getMoveCandidatesForBarcode() returns that move twice. The picking screen only reads candidates[0] and this fixture returns the alternates alone, so nothing is visibly wrong today.
| indexes.barcodeToProductIds[code] = [ | |
| ...(indexes.barcodeToProductIds[code] || []), | |
| productId, | |
| ]; | |
| const known = indexes.barcodeToProductIds[code] || []; | |
| if (!known.includes(productId)) { | |
| indexes.barcodeToProductIds[code] = [...known, productId]; | |
| } |
There was a problem hiding this comment.
Thanks for catching this! Nothing reads past candidates[0] today, but I'd rather keep the index free of duplicates before merging. @antoniodavid, could you apply this suggestion and add a test asserting the main barcode maps to the product only once?
|
This PR has the |
| indexes.barcodeToProductIds[code] = [ | ||
| ...(indexes.barcodeToProductIds[code] || []), | ||
| productId, | ||
| ]; |
There was a problem hiding this comment.
Thanks for catching this! Nothing reads past candidates[0] today, but I'd rather keep the index free of duplicates before merging. @antoniodavid, could you apply this suggestion and add a test asserting the main barcode maps to the product only once?
Bridge between
product_multi_barcode(OCA/stock-logistics-barcode) andbarcode_stock: in the Barcode app, scanning any of a product's alternate barcodes resolves to the same move as its main barcode.Why it is needed
product_multi_barcodelets a product hold several barcodes (its main one plus alternates), butbarcode_stockonly indexes the main barcode and the packagings when it preloads a picking. Scanning an alternate barcode is then rejected even though the product is on the move in that picking.What it does
product.barcoderecords of the products it contains and adds every alternate barcode to the scanner'sbarcodeToProductIdsindex, so a scan of any of them yields the same move candidates as the main barcode.product.barcode, the picking still loads and the scanner falls back to main barcodes and packagings.barcode_stockandproduct_multi_barcodeare installed (auto_install), and changes neither module.How to use
barcode_stockandproduct_multi_barcode; this module installs itself.@BinhexTeam T26645