Skip to content

Build order consume - #8191

Merged
SchrodingersGat merged 84 commits into
inventree:masterfrom
SchrodingersGat:build-order-consume
Aug 19, 2025
Merged

SchrodingersGat merged 84 commits into
inventree:masterfrom
SchrodingersGat:build-order-consume

Conversation

@SchrodingersGat

@SchrodingersGat SchrodingersGat commented Sep 26, 2024 •

Copy link
Copy Markdown
Member

This is a large(ish) feature branch which allows stock to be consumed by a build order before the build order is complete.

This allows more complex (and useful) workflows, where the build might take some significant time, but the stock is consumed at the start. e.g. a batch of PCBs are loaded, but then require a lot of testing, etc.

Currently, the allocated stock must "languish" in the build order, and this makes tracking of real stock quantities difficult.

Given that this feature might take a while to integrate and test, I am targetting it (for now at least) against 1.0.0. This will not be implemented in the legacy user interface.

Tasks

  • Update documenation around new workflows
  • User interface updates
  • Playwright testing
  • Updated unit testing
  • Ensure partial allocation vs partial consumption works well
  • Add dummy data to the demo dataset - Add partially consumed stock demo-dataset#95
  • Ensure that the "REQUIRED" counts still make sense (take "consumed" into account)
  • Check that the "required" counts are correct in the API (unit testing)
  • Ensure table filters work correctly for the build-line table

@SchrodingersGat SchrodingersGat added this to the 1.0.0 milestone Sep 26, 2024
@SchrodingersGat
SchrodingersGat marked this pull request as draft September 26, 2024 10:37
@netlify

netlify Bot commented Sep 26, 2024 •

Copy link
Copy Markdown

✅ Deploy Preview for inventree-web-pui-preview ready!

Name Link
🔨 Latest commit e0da640
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/68a404487de65d0008d1a123
😎 Deploy Preview https://deploy-preview-8191--inventree-web-pui-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 97 (no change from production)
Accessibility: 81 (no change from production)
Best Practices: 100 (no change from production)
SEO: 78 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Sep 26, 2024 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.32653% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.12%. Comparing base (698249e) to head (e0da640).
⚠️ Report is 300 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8191      +/-   ##
==========================================
- Coverage   87.14%   87.12%   -0.03%     
==========================================
  Files        1258     1259       +1     
  Lines       55966    56269     +303     
  Branches     2078     2072       -6     
==========================================
+ Hits        48773    49024     +251     
- Misses       6682     6735      +53     
+ Partials      511      510       -1     
Flag Coverage Δ
backend 88.84% <91.32%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Backend Apps 91.36% <91.28%> (-0.08%) ⬇️
Backend General 93.55% <ø> (-0.09%) ⬇️
Frontend 70.07% <ø> (+0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@matmair matmair left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice addition!

@SchrodingersGat
SchrodingersGat marked this pull request as ready for review August 17, 2025 05:34
@SchrodingersGat SchrodingersGat changed the title [WIP] Build order consume Build order consume Aug 17, 2025
@SchrodingersGat SchrodingersGat added enhancement This is an suggested enhancement or new feature User Interface Related to the frontend / User Interface api Relates to the API labels Aug 17, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request implements the ability to consume stock items against build orders before the build order is completed, allowing for more flexible workflows where stock is consumed at the start while the build may take significant time to finish.

Key changes:

  • Adds stock consumption functionality for build orders with new API endpoints and UI components
  • Updates part requirements calculation to account for consumed stock quantities
  • Enhances build line allocation and consumption tracking with visual progress indicators

Reviewed Changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
Frontend tests Updates test timeouts and adds consumption workflow tests
BuildLineTable.tsx Adds consumption functionality, filters, and progress indicators
BuildAllocatedStockTable.tsx Integrates stock consumption actions and forms
BuildForms.tsx Implements new consumption forms for build items and lines
API/Backend models Adds consumed field to BuildLine model and consumption endpoints
Documentation Updates allocation documentation with consumption workflows

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/frontend/src/forms/BuildForms.tsx Resolved
Comment thread src/backend/InvenTree/build/test_api.py Resolved
@SchrodingersGat
SchrodingersGat merged commit 49cc5fb into inventree:master Aug 19, 2025
@SchrodingersGat
SchrodingersGat deleted the build-order-consume branch August 19, 2025 07:03
daniil4udo pushed a commit to daniil4udo/InvenTree that referenced this pull request Aug 26, 2025
* Adds "consumed" field to BuildLine model

* Expose new field to serializer

* Add "consumed" column to BuildLineTable

* Boolean column tweaks

* Increase consumed count when completing allocation

* Add comment

* Update migration

* Add serializer for consuming build items

* Improve build-line sub-table

* Refactor BuildItem.complete_allocation method

- Allow optional quantity to be specified
- Adjust the allocated quantity when consuming

* Perform consumption

* Add "BuildConsume" API endpoint

* Implement frontend form

* Fixes for serializer

* Enhance front-end form

* Fix rendering of BuildLineTable

* Further improve rendering

* Bump API version

* Update API description

* Add option to consume by specifying a list of BuildLine objects

* Add form to consume stock via BuildLine reference

* Fix api_version

* Fix backup colors

* Fix typo

* Fix migrations

* Fix build forms

* Forms fixes

* Fix formatting

* Fixes for BuildLineTable

* Account for consumed stock in requirements calculation

* Reduce API requirements for BuildLineTable

* Docs updates

* Updated playwright testing

* Update src/frontend/src/forms/BuildForms.tsx

Co-authored-by: Copilot <[email protected]>

* Update src/frontend/src/tables/build/BuildLineTable.tsx

Co-authored-by: Copilot <[email protected]>

* Add unit test for filters

* Add functional tests

* Tweak query count

* Increase max query time for testing

* adjust unit test again

* Prevent consumption of "tracked" items

* Adjust playwright tests

* Fix table

* Fix rendering

---------

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Relates to the API build Build orders enhancement This is an suggested enhancement or new feature feature User Interface Related to the frontend / User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants