feat: add piece_count and piece_size fields to BomItem for cut-to-length parts#12422
Open
amanjain57-gif wants to merge 1 commit into
Open
feat: add piece_count and piece_size fields to BomItem for cut-to-length parts#12422amanjain57-gif wants to merge 1 commit into
amanjain57-gif wants to merge 1 commit into
Conversation
…gth parts Manufacturing BOMs frequently require multiple pieces of a specific size cut from continuous stock (cables, tubing, structural profiles). Currently the only way to express "10 pieces of 250mm cable" is to enter the total length (2.5m) as quantity, which loses the piece-count information that purchasing and production need. This adds two optional fields to BomItem: - piece_count: number of discrete pieces required (default: 1) - piece_size: size/length of each piece (e.g. "250 mm") When piece_size is specified, the total quantity is auto-calculated as piece_count × piece_size, maintaining full backward compatibility (existing items effectively have piece_count=1 and empty piece_size). Changes: - Backend: new model fields, migration, updated recalculate_quantity() logic, hash_fields for BOM validation - API: serializer exposes piece_count and piece_size - Frontend: BOM form includes the new fields, BOM table shows them as optional columns Addresses inventree#10274
✅ Deploy Preview for inventree-web-pui-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.

Summary
Addresses #10274
Manufacturing BOMs frequently require multiple pieces of a specific size cut from continuous stock (cables, tubing,
structural profiles). Currently the only way to express "10 pieces of 250mm cable" is to enter the total length (2.5m)
as quantity, which loses the piece-count information that purchasing and production need.
Changes
Adds two optional fields to BomItem:
When
piece_sizeis specified, the total quantity is auto-calculated aspiece_count × piece_size, maintaining fullbackward compatibility (existing items effectively have piece_count=1 and empty piece_size).
Backend
recalculate_quantity()to compute total from piece_count × piece_size when piece_size is setAPI
piece_countandpiece_sizefieldsFrontend
Example
A BOM line for "10 pieces of 250mm aluminum profile" (part units: m):
This preserves the per-piece information for production while correctly computing total material requirement for
purchasing.