Skip to content

[bug] Count transfer order allocations when validating build items - #13287

Merged
SchrodingersGat merged 1 commit into
inventree:masterfrom
arjunkotwal-del:fix-build-item-transfer-allocation
Nov 14, 2026
Merged

SchrodingersGat merged 1 commit into
inventree:masterfrom
arjunkotwal-del:fix-build-item-transfer-allocation

Conversation

@arjunkotwal-del

Copy link
Copy Markdown
Contributor

BuildItem.check_allocated_quantity() summed build and sales order allocations but not transfer order allocations, so stock that was fully allocated to an open transfer order could be allocated again to a build order via the API (POST /api/build/item/).

Include transfer_order_allocation_count() in the check, matching StockItem.allocation_count() and bulk_allocation_count().

Fixes #13286

BuildItem.check_allocated_quantity() summed build and sales order
allocations but not transfer order allocations, so stock that was
fully allocated to an open transfer order could be allocated again to
a build order via the API (POST /api/build/item/).

Include transfer_order_allocation_count() in the check, matching
StockItem.allocation_count() and bulk_allocation_count().

Fixes inventree#13286
@netlify

netlify Bot commented Nov 14, 2026

Copy link
Copy Markdown

👷 Deploy request for inventree-web-pui-preview pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 0c613ec

@SchrodingersGat SchrodingersGat added bug Identifies a bug which needs to be addressed build Build orders backport Apply this label to a PR to enable auto-backport action backport-to-1.7.x Apply this label to backport a PR to the 1.7.x branch labels Nov 14, 2026
@SchrodingersGat SchrodingersGat added this to the 1.8.0 milestone Nov 14, 2026
@SchrodingersGat

Copy link
Copy Markdown
Member

@arjunkotwal-del thanks for submitting a quick fix for this :)

@arjunkotwal-del

Copy link
Copy Markdown
Contributor Author

thanks for the quick review

@codecov

codecov Bot commented Nov 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.27%. Comparing base (19dfb81) to head (0c613ec).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #13287   +/-   ##
=======================================
  Coverage   90.26%   90.27%           
=======================================
  Files         884      884           
  Lines       82521    82530    +9     
  Branches     4264     4264           
=======================================
+ Hits        74491    74504   +13     
+ Misses       7021     7017    -4     
  Partials     1009     1009           
Flag Coverage Δ
backend 93.82% <100.00%> (+<0.01%) ⬆️

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

Components Coverage Δ
Backend Apps 94.30% <100.00%> (+<0.01%) ⬆️
Backend General 95.36% <ø> (ø)
Frontend 77.35% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SchrodingersGat
SchrodingersGat merged commit 3572714 into inventree:master Nov 14, 2026
47 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
✅ 1.7.x

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

SchrodingersGat pushed a commit that referenced this pull request Nov 15, 2026
…13287) (#13289)

BuildItem.check_allocated_quantity() summed build and sales order
allocations but not transfer order allocations, so stock that was
fully allocated to an open transfer order could be allocated again to
a build order via the API (POST /api/build/item/).

Include transfer_order_allocation_count() in the check, matching
StockItem.allocation_count() and bulk_allocation_count().

Fixes #13286

(cherry picked from commit 3572714)

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

Labels

backport Apply this label to a PR to enable auto-backport action backport-to-1.7.x Apply this label to backport a PR to the 1.7.x branch bug Identifies a bug which needs to be addressed build Build orders

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stock already allocated to a transfer order can be allocated again to a build order

2 participants