Skip to content

Fix complete_sales_order_shipment task#11525

Open
SchrodingersGat wants to merge 6 commits intoinventree:masterfrom
SchrodingersGat:shipment-complete-process
Open

Fix complete_sales_order_shipment task#11525
SchrodingersGat wants to merge 6 commits intoinventree:masterfrom
SchrodingersGat:shipment-complete-process

Conversation

@SchrodingersGat
Copy link
Member

@SchrodingersGat SchrodingersGat commented Mar 14, 2026

  • Perform allocation before marking shipment as complete
  • Ensure task is not marked as complete before it is actually done

Overview

This PR addresses a shortfall of the existing Sales order shipment completion process. Specifically, the shipment is first marked as complete, and then the allocated items are processed (by the background worker). If the background process fails (as addressed in #11500) then the allocated items sit in "limbo" - the shipment has been marked as complete, and cannot be completed again - but the item allocations are not completed correctly.

Solution

Complete the items first, and then mark the shipment as shipped. This offloads the entire process to the background worker thread, and only marks the shipment as complete after all the tasks are actually done.

TODO

  • Refactor shipment completion into single "atomic" process
  • Ensure that the allocated items are completed before marking the shipment as complete
  • Implement foreground monitoring of background task - [API] Monitor task #11527
  • Playwright testing

References

- Perform allocation *before* marking shipment as complete
- Ensure task is not marked as complete before it is actually done
@netlify
Copy link

netlify bot commented Mar 14, 2026

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

Name Link
🔨 Latest commit 97256c1
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/69b6b189233c570008ac71a8

@SchrodingersGat SchrodingersGat added bug Identifies a bug which needs to be addressed order Related to purchase orders / sales orders labels Mar 14, 2026
@SchrodingersGat SchrodingersGat added this to the 1.3.0 milestone Mar 14, 2026
@codecov
Copy link

codecov bot commented Mar 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.09%. Comparing base (97aec82) to head (97256c1).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #11525   +/-   ##
=======================================
  Coverage   88.08%   88.09%           
=======================================
  Files        1296     1296           
  Lines       59182    59179    -3     
  Branches     1934     1934           
=======================================
- Hits        52133    52131    -2     
+ Misses       6569     6568    -1     
  Partials      480      480           
Flag Coverage Δ
backend 89.26% <100.00%> (+<0.01%) ⬆️

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Identifies a bug which needs to be addressed order Related to purchase orders / sales orders refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant