* feat: add piece_count and piece_size fields to BomItem for cut-to-length 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 #10274 * refactor: simplify to single piece_count field per reviewer feedback Remove the piece_size field entirely. The existing quantity field already represents the per-piece size/length, so piece_count multiplied by quantity gives the total material requirement. Example: quantity=200mm, piece_count=10 → total 2m of wire in 10 pieces. Changes: - Remove piece_size model field, serializer field, and frontend column/form - Update migration to only add piece_count - Update get_required_quantity() to multiply by piece_count - Restore original recalculate_quantity() without piece_size logic * test/docs: add unit tests and documentation for piece_count field * style: replace ambiguous × with x to fix RUF002 lint error * Address review feedback: api_version bump, changelog, style fix - Bump INVENTREE_API_VERSION to 531 with entry for piece_count field - Add CHANGELOG.md entry under Unreleased > Added - Fix RUF001: replace ambiguous × with x in serializers.py help_text * fix: align piece_count migration help_text with model (RUF001) The 0153 AddField recorded help_text with a Unicode multiplication sign (×), while the model field uses plain 'x' after the RUF001 fix. This mismatch made makemigrations --check flag an unstaged 0154_alter_bomitem_piece_count migration, failing the DB test CI jobs. Update the original migration's help_text (and docstring) to plain 'x' so the field definition matches the model, keeping a single clean migration instead of add-then-alter. * fix: use set_quantity() in piece_count tests BomItem.quantity is a derived field, recalculated from raw_amount on every save() via recalculate_quantity(). Setting item.quantity directly was overwritten back to the fixture value on save, so the tests computed against quantity=3 and failed. Use set_quantity() (which sets raw_amount) to match how quantity is meant to be updated. * ci: re-trigger CI to confirm Firefox E2E failures are transient --------- Co-authored-by: Aman Jain <jainamn@amazon.com>
InvenTree
Open Source Inventory Management System
View Demo · Documentation · Report Bug · Request Feature
🌟 About the Project
InvenTree is an open-source Inventory Management System which provides powerful low-level stock control and part tracking. The core of the InvenTree system is a Python/Django database backend which provides an admin interface (web-based) and a REST API for interaction with external interfaces and applications. A powerful plugin system provides support for custom applications and extensions.
Check out our website for more details.
🧭 Roadmap
Want to see what we are working on? Check out the roadmap tag and horizon milestone.
🛠️ Integration
InvenTree is designed to be extensible, and provides multiple options for integration with external applications or addition of custom plugins:
👾 Tech Stack
Server
Database
DevOps
🧰 Deployment / Getting Started
There are several options to deploy InvenTree.
Docker
·
·
Bare Metal
Single line install - read the docs for supported distros and details about the function:
wget -qO install.sh https://get.inventree.org && bash install.sh
Refer to the getting started guide for a full set of installation and setup instructions.
📱 Mobile App
InvenTree is supported by a companion mobile app which allows users access to stock control information and functionality.
🔒 Code of Conduct & Security Policy
The InvenTree project team is committed to providing a safe and welcoming environment for all users. Please read our Code of Conduct for more information.
InvenTree is following industry best practices for security. Our security policy is included in this repo. We provide dedicated security pages on our documentation site.
👋 Contributing
Contributions are welcomed and encouraged. Please help to make this project even better! Refer to the contribution page.
📜 Translation
Native language translation of the InvenTree web application is community contributed via crowdin. Contributions are welcomed and encouraged.
💸 Sponsor
If you use InvenTree and find it to be useful, please consider sponsoring the project.
💎 Acknowledgements
We want to acknowledge PartKeepr as a valuable predecessor and inspiration. Find a full list of used third-party libraries in the license information dialog of your instance.
❤️ Support
This project is supported by the following sponsors:
With ongoing resources provided by:
⚠️ License
Distributed under the MIT License. See LICENSE.txt for more information.
















