Skip to content

Change order custom status via api#11982

Open
johnluetke wants to merge 4 commits into
inventree:masterfrom
johnluetke:feature/change-order-custom-status-via-api
Open

Change order custom status via api#11982
johnluetke wants to merge 4 commits into
inventree:masterfrom
johnluetke:feature/change-order-custom-status-via-api

Conversation

@johnluetke
Copy link
Copy Markdown

Fixes #11927

As discussed in the issue, an order's custom status key can be updated via the API.

Validation has been added to ensure that the custom_status_key value is aligned to the current logical state of the order.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 21, 2026

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

Name Link
🔨 Latest commit b1a0243
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6a109bfa029547000835f5e1
😎 Deploy Preview https://deploy-preview-11982--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: 93 (no change from production)
Accessibility: 82 (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
🤖 Make changes Run an agent on this branch

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

@johnluetke johnluetke force-pushed the feature/change-order-custom-status-via-api branch from 8c299e9 to 37783d2 Compare May 21, 2026 21:39
@SchrodingersGat SchrodingersGat added this to the 1.4.0 milestone May 21, 2026
@SchrodingersGat SchrodingersGat added the api Relates to the API label May 21, 2026
@SchrodingersGat
Copy link
Copy Markdown
Member

@johnluetke nice clean implementation :)

Copy link
Copy Markdown
Member

@matmair matmair left a comment

Choose a reason for hiding this comment

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

Looks good;
there are a few formatting things, those could be fixed with pre-commit or prek; I will submit them shortly

# can be set directly, but must be valid for the current order status
status_custom_key = serializers.IntegerField(
label=_('Custom Status Key'),
help_text=_('Update order status to a custom value for this logical value'),
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.

With this set we loose dynamic choice enumeration in the schema description; @SchrodingersGat is that acceptable or should we patch the schema generation mechanism

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I've been trying to familiarize myself with how this works, but don't quite understand how it broke. It seems like the schema now thinks that the status and custom_status_key fields are more tightly coupled now?

If you can point me in the right direction, I can see if my solution can be implemented in a way that doesn't change this.

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.

@matmair what would you propose as an alternative?

@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 98.14815% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.24%. Comparing base (27ca083) to head (b1a0243).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #11982   +/-   ##
=======================================
  Coverage   91.23%   91.24%           
=======================================
  Files         971      971           
  Lines       51103    51149   +46     
=======================================
+ Hits        46626    46670   +44     
- Misses       4477     4479    +2     
Flag Coverage Δ
backend 90.27% <98.14%> (+<0.01%) ⬆️

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

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

johnluetke and others added 4 commits May 22, 2026 11:09
Refactor `custom_status_key` to be writable via the API and validate that the proposed value is valid for the current order status
@johnluetke johnluetke force-pushed the feature/change-order-custom-status-via-api branch from 423a9bf to b1a0243 Compare May 22, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Relates to the API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PurchaseOrder PATCH accepts status_custom_key, but does not persist valid custom status

3 participants