Skip to content

Feature: Backend scaffolding for Repair Orders (#12064) - #12072

Open
adityakrmishra wants to merge 115 commits into
inventree:masterfrom
adityakrmishra:feature-repair-orders-backend-12064
Open

Feature: Backend scaffolding for Repair Orders (#12064)#12072
adityakrmishra wants to merge 115 commits into
inventree:masterfrom
adityakrmishra:feature-repair-orders-backend-12064

Conversation

@adityakrmishra

@adityakrmishra adityakrmishra commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Addresses the backend requirements for #12064.

This PR introduces the initial Django architecture for the new Repair Order feature, integrating it into the order app as discussed.

Additions:

  • Status Codes: Added RepairOrderStatus enumerations.
  • Models: Added RepairOrder, RepairOrderLineItem, and RepairOrderAllocation to order/models.py.
  • API Routing: Implemented DRF serializers and added CRUD ViewSet endpoints to order/api.py.
  • Linting: Validated via ruff.

(Note: Migration files have not been generated in this commit to avoid environment conflicts. Please run manage.py makemigrations order when reviewing.)

Ready for review before we move on to the Mantine UI scaffolding!

closes #12064

@netlify

netlify Bot commented Jun 2, 2026

Copy link
Copy Markdown

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

Name Link
🔨 Latest commit 5884270
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6a9a4f2a59fbb6000840e0f1
😎 Deploy Preview https://deploy-preview-12072--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: 94 (🟢 up 2 from production)
Accessibility: 82 (no change from production)
Best Practices: 92 (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.

@SchrodingersGat

Copy link
Copy Markdown
Member

Code Formatting

As a starting point it looks like your linting is different to our standard.

As per our contributing guide - run this command on your local instance:

invoke dev.setup-dev

This will ensure that any commits will be correctly formatted automatically.

Migration Files

You will need to commit any migration files when changing database models.

Run invoke migrate to generate the necessary migration files, and commit those generated files.

Comment thread src/backend/InvenTree/order/api.py Outdated
Comment on lines +2516 to +2520
class RepairOrderList(ListCreateAPI):
"""API endpoint for accessing a list of RepairOrder objects."""

queryset = models.RepairOrder.objects.all()
serializer_class = serializers.RepairOrderSerializer

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.

I am missing a permissions class here

@matmair matmair added enhancement This is an suggested enhancement or new feature order Related to purchase orders / sales orders api Relates to the API User Interface Related to the frontend / User Interface labels Jun 3, 2026
@matmair matmair added this to the 2.0.0 milestone Jun 3, 2026
@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.57388% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.18%. Comparing base (ff732d0) to head (5884270).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12072      +/-   ##
==========================================
+ Coverage   87.09%   87.18%   +0.08%     
==========================================
  Files        1483     1484       +1     
  Lines      100509   101427     +918     
  Branches    11527    11525       -2     
==========================================
+ Hits        87542    88428     +886     
- Misses      12904    12936      +32     
  Partials       63       63              
Flag Coverage Δ
backend 91.23% <96.57%> (+0.08%) ⬆️

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

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

@SchrodingersGat SchrodingersGat 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.

A good start!

Comment thread src/backend/InvenTree/order/models.py Outdated
class RepairOrder(
InvenTree.models.InvenTreeAttachmentMixin,
InvenTree.models.InvenTreeNotesMixin,
InvenTree.models.InvenTreeMetadataModel,

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.

You will need to add a number of other mixin classes here - look at the "BuildOrder" model for reference:

class Build(
    InvenTree.models.PluginValidationMixin,
    report.mixins.InvenTreeReportMixin,
    InvenTree.models.InvenTreeParameterMixin,
    InvenTree.models.InvenTreeAttachmentMixin,
    InvenTree.models.InvenTreeBarcodeMixin,
    InvenTree.models.InvenTreeNotesMixin,
    InvenTree.models.ReferenceIndexingMixin,
    StateTransitionMixin,
    StatusCodeMixin,
    InvenTree.models.MetadataMixin,
    InvenTree.models.InvenTreeTree,
):

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.

Please review and make requested changes

SchrodingersGat and others added 18 commits August 30, 2026 02:55
- Resolved api_version.py: bumped to v538, integrated Notes refactor (v537) and SCIM (v536) entries

- Resolved report/tests.py: combined RepairOrder and Note imports

- Fixed RepairOrderSerializer: removed deprecated NotesFieldMixin (removed by upstream Notes refactor PR inventree#11971)
- Remove deprecated NotesFieldMixin from RepairOrderSerializer (removed by upstream Notes refactor PR inventree#11971)

- Update pui_repair.spec.ts: navigate to manufacturing/index/repairorders (table moved from sales)

- Update pui_repair.spec.ts: fill required part field during RepairOrder creation
…yakrmishra/InvenTree into feature-repair-orders-backend-12064
@yunaremaia

Copy link
Copy Markdown

Test Verification Results

I've verified the Repair Order feature locally with Python 3.12.14 and all tests pass:

Test Results

  • : 2/2 tests passed

    • : Tests full FSM lifecycle (PENDING → IN_PROGRESS → ON_HOLD → IN_PROGRESS → COMPLETE)
    • : Tests cancellation path (PENDING → IN_PROGRESS → CANCELLED)
  • : 39/39 tests passed

    • Covers API endpoints, permissions, serialization validation, FSM transitions, and N+1 query protection

Fixes Applied

  • Corrected → in
  • Created merge migration to resolve migration conflicts
  • Created migration for model changes

Environment Requirements

  • Python 3.12+ (tested with 3.12.14)
  • Django 5.2.16
  • Required environment variables for CI:

The implementation is solid and ready for merge. All tests pass locally with the fixes above.

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

Labels

api Relates to the API enhancement This is an suggested enhancement or new feature order Related to purchase orders / sales orders User Interface Related to the frontend / User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Repair orders

4 participants