fix(stock): round whole-number components in partial disassembly by mihir-kandoi · Pull Request #61784 · frappe/erpnext · GitHub
Skip to content

fix(stock): round whole-number components in partial disassembly - #61784

Open
mihir-kandoi wants to merge 11 commits into
fix/disassembly-serial-reusefrom
fix/disassembly-whole-number-rounding
Open

mihir-kandoi wants to merge 11 commits into
fix/disassembly-serial-reusefrom
fix/disassembly-whole-number-rounding

Conversation

@mihir-kandoi

Copy link
Copy Markdown
Collaborator

Problem: A partial disassembly scaled each component by the share of the source it disassembled, so components with a whole-number UOM got fractional quantities. The fraction failed the whole-number check, and a rounded qty failed the "quantity derived from the source" check, so the entry could not be saved. Batch quantities were scaled the same way.

Fix: For whole-number UOMs, round down on the quantity disassembled so far and subtract what earlier disassemblies moved. The disassembly that completes the source takes the remainder, so the total never exceeds what was consumed. Batches are filled in order from what is left in each.

Steps to reproduce:

  1. Create a raw material and a finished good with stock UOM Nos (Must be Whole Number), and a BOM that turns 1134 raw materials into 1025 finished goods.
  2. Make a Manufacture entry for 1025.
  3. Create a Disassemble entry for 834 from it. The raw material row gets 922.69 and cannot be saved, and 922 or 923 fails the source quantity check.

With the fix, the rows are 922 and then 212 for the remaining 191.

Closes #61729

A partial disassembly scaled every component by the share of the source it
disassembled, so whole-number UOMs got fractional quantities that could not
be saved. Round these rows down on the qty disassembled so far and subtract
what earlier disassemblies moved; the one that completes the source takes
the remainder.
Batch qty was scaled from the source, which split whole-number items into
fractional batches and could not add up to a rounded row qty. Take the
source batches in order instead, skipping qty earlier disassemblies moved.
@mihir-kandoi
mihir-kandoi added this pull request to stack #61785 October 21, 2026 12:19
@mihir-kandoi mihir-kandoi self-assigned this Oct 21, 2026

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Partial Disassemble generates fractional quantities for whole-number UOMs

1 participant