Skip to content

[IMP] barcode_stock: avoid duplicate lines on rapid double scans - #34

Open
luisDIXMIT wants to merge 1 commit into
OCA:18.0from
dixmit:18.0-imp-barcode_stock
Open

luisDIXMIT wants to merge 1 commit into
OCA:18.0from
dixmit:18.0-imp-barcode_stock

Conversation

@luisDIXMIT

Copy link
Copy Markdown

addSerialLine and addLine looked for an existing line before awaiting
the product's lots and pushed the new one after it, so two quick scans
of the same product could both pass the check. Fetch the lots first,
so the check and the push run with no await in between.

The quantity test now passes a product with its tracking, as a real
scan does, since addLine reads it before looking up the line.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @szalatyzuzanna,
some modules you are maintaining are being modified, check this out!

@szalatyzuzanna szalatyzuzanna left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Fetching the lots before the lookup is the right fix. Two small things before approving: a test for that case (inline), and the commit. It fixes a bug, so [FIX] fits better than [IMP].


test("an internal transfer line adds up scans and an edited quantity", async () => {
const screen = Object.create(InternalTransferScreen.prototype);
const product = {id: 7, tracking: "none"};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test for the double scan itself, with a lot and with a serial?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants