feat: Add RepairOrder feature (#12064)#12396
Open
stevenmini2019 wants to merge 1 commit into
Open
Conversation
Implement the Repair Order feature as described in GitHub issue inventree#12064. - Add RepairOrder model extending Order base class with customer, item, part, serial, and description fields - Add RepairOrderLine model for tracking parts consumed in repairs - Add status codes (Pending, In Progress, On Hold, Complete, Cancelled) - Add API endpoints: /api/order/repair/ and /api/order/repair-line/ - Add serializers with full CRUD support - Add status transition endpoints (issue, hold, complete, cancel) - Add admin classes for Django admin interface - Add system settings for reference pattern and editing completed orders - Add repair_order ruleset for user permissions - Add comprehensive API tests References inventree#12064 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
✅ Deploy Preview for inventree-web-pui-preview canceled.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the Repair Order feature requested in #12064. Adds a new RepairOrder type that tracks repair work performed for a customer against a stock item, part, or serial-numbered unit.
Backend only
This PR implements the backend MVP. Frontend UI and stock consumption workflow are deferred to follow-up PRs to keep this change reviewable.
Changes
RepairOrderandRepairOrderLineto theorderapp.RepairOrderextends theOrderbase class (uses statuses, references, barcode, notes, metadata, reports, tags).RepairOrderLineextendsOrderLineItemfor parts/stock consumed during the repair.RepairOrderStatuswithPENDING,IN_PROGRESS,ON_HOLD,COMPLETE,CANCELLED, plusRepairOrderStatusGroups.RepairOrderEvents(repairorder.issued,repairorder.completed,repairorder.cancelled,repairorder.hold).validate_repair_order_reference,validate_repair_order_reference_pattern,generate_next_repair_order_reference.RepairOrder(/api/order/repair/) andRepairOrderLine(/api/order/repair-line/); plus status transition endpoints (/cancel/,/hold/,/issue/,/complete/) on each RepairOrder.line_items,completed_lines,overdue) and optional detail fields for customer / item / part.RepairOrderandRepairOrderLine.REPAIRORDER_ENABLED,REPAIRORDER_REFERENCE_PATTERN(defaultREP-{ref:04d}),REPAIRORDER_EDIT_COMPLETED_ORDERS.repair_orderruleset inusers/ruleset.pyand OAuth2 scope entry inusers/oauth2_scopes.py.0121_repair_order_and_repair_order_line.py(depends onorder.0120,company.0080,part.0151,stock.0123,common.0046,users.0015).RepairOrderTestsandRepairOrderLineTestsinorder/test_api.pycovering options endpoint, model validation, create/list/update API, status transitions, and line item creation/validation/filtering.References #12064
Test plan
python InvenTree/manage.py makemigrations order --checkreports no missing migrationspython InvenTree/manage.py checkpassespython InvenTree/manage.py test order.test_api.RepairOrderTests order.test_api.RepairOrderLineTests --noinputpassesREP-0001default referenceNotes
Orderbase class rather than introducing a parallel model, mirroring theReturnOrder/TransferOrderpattern.🤖 Generated with Claude Code