Skip to content

[refactor] Build allocation endpoints - #12361

Merged
SchrodingersGat merged 41 commits into
inventree:masterfrom
SchrodingersGat:build-consume-refactor
Jul 24, 2026
Merged

SchrodingersGat merged 41 commits into
inventree:masterfrom
SchrodingersGat:build-consume-refactor

Conversation

@SchrodingersGat

@SchrodingersGat SchrodingersGat commented Jul 12, 2026 •

Copy link
Copy Markdown
Member

Benchmarks

Unit tests were added to benchmark against a high level of line items (100 items per API test). Counted the number of database hits for each API call.

Endpoint Before After
/build/:id/auto-allocate 920 125
/build/:id/allocate 1,617 23
/build/:id/complete 157 159
/build:/id/finish 4,200 217

Tasks

  • Ensure bulk operations work on all DB backends
  • Check that the "creation date" of any split items is honored (should it match "parent"?)

@SchrodingersGat
SchrodingersGat requested a review from matmair as a code owner July 12, 2026 10:56
@netlify

netlify Bot commented Jul 12, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for inventree-web-pui-preview canceled.

Name Link
🔨 Latest commit 218d6de
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6a6328b93d20bd000727f3bf

@SchrodingersGat SchrodingersGat added api Relates to the API build Build orders refactor labels Jul 12, 2026
@SchrodingersGat SchrodingersGat added this to the 1.5.0 milestone Jul 12, 2026
@codecov

codecov Bot commented Jul 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.26049% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.65%. Comparing base (ea68eaf) to head (218d6de).

❌ Your project check has failed because the head coverage (85.68%) is below the target coverage (90.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12361      +/-   ##
==========================================
- Coverage   86.86%   83.65%   -3.22%     
==========================================
  Files        1442     1442              
  Lines       95245   101490    +6245     
  Branches    11101    11104       +3     
==========================================
+ Hits        82735    84898    +2163     
- Misses      12445    16527    +4082     
  Partials       65       65              
Flag Coverage Δ
backend 91.16% <97.93%> (+0.04%) ⬆️

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

Components Coverage Δ
Backend Apps 85.68% <94.08%> (-6.95%) ⬇️
Backend General 93.53% <ø> (ø)
Frontend 79.73% <ø> (+0.18%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SchrodingersGat
SchrodingersGat merged commit 145ef21 into inventree:master Jul 24, 2026
56 of 59 checks passed
@SchrodingersGat
SchrodingersGat deleted the build-consume-refactor branch July 24, 2026 09:48
Lowkey-wizard added a commit to EQUA-AI/InvenTree that referenced this pull request Aug 7, 2026
Upstream inventree#12361/inventree#12478 route all build-allocation validation through the
new StockItem.bulk_allocation_count() and persist via bulk_create, which
bypasses BuildItem.clean(). Add the job-kit domain as the fourth
accumulator so builds cannot consume maintenance-reserved stock, and
teach can_delete() to refuse cleanly on job-kit rows (PROTECT FK)
instead of raising ProtectedError.

Co-Authored-By: Claude Fable 5 <[email protected]>
@SchrodingersGat SchrodingersGat mentioned this pull request Aug 7, 2026
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 refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant