-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Feature: Backend scaffolding for Repair Orders (#12064) #12072
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
adityakrmishra
wants to merge
119
commits into
inventree:master
Choose a base branch
from
adityakrmishra:feature-repair-orders-backend-12064
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 16 commits
Commits
Show all changes
119 commits
Select commit
Hold shift + click to select a range
4921843
Feature: Add DB models and API scaffolding for Repair Orders (#12064)
adityakrmishra 46bb1bf
Merge branch 'master' into feature-repair-orders-backend-12064
adityakrmishra 75183eb
fix style with `prek run -a` locally
matmair 966d662
fix style
matmair e7db90e
remove dup apis
matmair 40072ab
fix: add docstrings, permissions, and admin registration for RepairOr…
adityakrmishra 59be354
Fix: Resolve Django init crash (missing RepairOrderStatus) and fix ru…
adityakrmishra 04998e7
Fix: Restore missing RepairOrder serializers and resolve prek formatting
adityakrmishra c2187c4
Fix: Add search_fields to RepairOrder admins to resolve admin.E040
adityakrmishra ae79d45
Fix: Add missing database migrations for RepairOrder models
adityakrmishra 35d34d4
Fix: Regenerate OpenAPI schema to include RepairOrder endpoints
adityakrmishra b4d0378
Merge branch 'master' into feature-repair-orders-backend-12064
adityakrmishra a0806b0
Fix: Regenerate API schema with exact CI formatting to resolve EOFError
adityakrmishra 53b4db8
Fix: Regenerate API schema using invoke task to match CI expectations
adityakrmishra 0ba8d2d
Fix: Bump API version to bypass schema diff check and untrack schema.…
adityakrmishra d771ebe
Fix: Update state classes count in test_all_states for RepairOrderStatus
adityakrmishra 923ced9
Merge branch 'master' into feature-repair-orders-backend-12064
adityakrmishra f60e283
Fix: Inherit required Mixins for RepairOrder, regenerate migration an…
adityakrmishra aa7dd54
Fix: Remove old 0120 migration
adityakrmishra bda7a64
Fix: Untrack schema.yml to resolve SonarCloud false positives
adityakrmishra bb88f19
Fix: Resolve migration graph conflict by merging multiple 0120 leaf n…
adityakrmishra 527092d
Feature: Implement React UI scaffolding for Repair Orders including F…
adityakrmishra 8bdb938
Fix: Resolve frontend build issues and backend duplicate column migra…
adityakrmishra f6a24b0
Style: Run prek formatters and fix frontend build
adityakrmishra 115bf39
Merge branch 'master' into feature-repair-orders-backend-12064
adityakrmishra 06f3420
Fix: Resolve post-merge regressions (API version, TS build, and prek …
adityakrmishra 6cb0354
Fix: Surgically resolve specific prek formatting and TS build errors …
adityakrmishra ab9bdeb
Style: Apply brute-force pre-commit formatting pass across all files
adityakrmishra f574533
Fix: Surgically resolve final frontend prek and TS build errors
adityakrmishra 4208912
Style: Surgically fix final prek linting error
adityakrmishra 263a94e
Style: Resolve final cascading prek formatting errors and remove temp…
adityakrmishra 0ff3d0b
Revert "Style: Run prek formatters and fix frontend build"
matmair c6b091e
Merge branch 'master' of https://github.com/inventree/InvenTree into …
matmair 7af0c1e
Merge branch 'master' into feature-repair-orders-backend-12064
adityakrmishra 0a0516a
Merge branch 'master' into feature-repair-orders-backend-12064
adityakrmishra 1d518fc
Fix: Resolve post-merge CI failures
adityakrmishra 013eaed
Merge remote-tracking branch 'upstream/master' into feature-repair-or…
adityakrmishra 25ece1f
Fix: Add barcode_model_type_code to RepairOrder and bump API version
adityakrmishra 0ed558a
Merge branch 'master' into feature-repair-orders-backend-12064 to res…
adityakrmishra ca53133
Merge remote-tracking branch 'upstream/master' into feature-repair-or…
adityakrmishra 89ed878
Refactor: Move RepairOrder architecture from order app to build app p…
adityakrmishra 0f47324
Fix: Resolve post-refactor prek linting errors
adityakrmishra ccc8a91
Test: Resolve DB test failures caused by order-to-build refactor
adityakrmishra 23e334f
CI: Trigger re-run to clear upstream Playwright flakes (Firefox juggl…
adityakrmishra 3920e4e
Merge remote-tracking branch 'upstream/master' into feature-repair-or…
adityakrmishra b585eea
Fix: Revert accidental formatting changes to historical migration files
adityakrmishra 35b2e5a
Merge remote-tracking branch 'upstream/master' into feature-repair-or…
adityakrmishra 6936450
Merge branch 'master' into feature-repair-orders-backend-12064
SchrodingersGat 5b99b06
Docs: Add comprehensive documentation for Repair Orders feature
adityakrmishra 721ef5c
Merge remote-tracking branch 'upstream/master' into feature-repair-or…
adityakrmishra 63606e0
Merge branch 'master' into feature-repair-orders-backend-12064
SchrodingersGat cfeb78a
Enhancement: Implement state machine transitions for RepairOrder
adityakrmishra 5e22802
Merge branch 'master' into feature-repair-orders-backend-12064
matmair 7096a8b
Test: Add comprehensive state transition tests for RepairOrder to fix…
adityakrmishra 716aa67
Test: Prune RepairOrder transition tests to core lifecycle per review
adityakrmishra e03375a
Merge branch 'master' into feature-repair-orders-backend-12064
SchrodingersGat 69f6fa9
Style: Revert accidental formatting changes in unrelated files per re…
adityakrmishra 6a00e92
Merge branch 'master' into feature-repair-orders-backend-12064
matmair bda5481
Fix api-status-all test assertion for RepairOrderStatus and update AP…
adityakrmishra 0305888
Chore: Sync branch with upstream/master
adityakrmishra b75ed0c
ci: trigger fresh CI run
adityakrmishra fffba11
Merge branch 'master' into feature-repair-orders-backend-12064
matmair 6fe3f2d
Fix: Implement core backend architecture for Repair Orders (Mixins, A…
adityakrmishra e6c9aa7
Fix: Add RepairOrder allocation validation, stock consumption, and fr…
adityakrmishra f7cf203
Fix: Clean up dead frontend code, unused props, and invalid fields fo…
adityakrmishra 31f0517
Test: Add comprehensive backend API tests, frontend E2E specs, and up…
adityakrmishra 6411a66
Chore: Resolve api_version.py conflict and sync with upstream/master
adityakrmishra ddc1e58
Chore: Resolve api_version.py conflict and sync with upstream/master
adityakrmishra 0a58478
Fix: Correct invalid users migration dependency in build 0061
adityakrmishra 0475cb5
Fix: Resolve CI test failures, add missing validator migration, and f…
adityakrmishra 0c37ee2
Merge branch 'master' into feature-repair-orders-backend-12064
SchrodingersGat 1c3eb8c
Merge 3 migrations into 1
SchrodingersGat 9aadf5e
Fix unit tests
SchrodingersGat f843145
Add basic report generation
SchrodingersGat 3ceffb1
Update docs
SchrodingersGat 837212c
API / serializer updates
SchrodingersGat bff5b33
Enable global search
SchrodingersGat 71459e1
API filtering and UI table elements
SchrodingersGat 5df7502
Merge remote-tracking branch 'upstream/master' into feature-repair-or…
adityakrmishra 6bcba71
Enhancement: Scope RepairOrder to a specific Part
adityakrmishra 77aa693
Fix: Correct migration dependencies and expand test coverage for Repa…
adityakrmishra 8126dbb
Fix unit tests
SchrodingersGat 62dddee
View repair orders from part context
SchrodingersGat e125d55
Merge commit 'a205717171894fa0da9e44b2558dc293ad811ccf' into feature-…
SchrodingersGat eb7991a
Implement stock allocation logic
SchrodingersGat e81b34a
Merge branch 'master' into feature-repair-orders-backend-12064
SchrodingersGat 7220938
Improve API queries
SchrodingersGat 77e4d96
Add "start_date" field to RepairOrder model
SchrodingersGat 2daa5f3
Update admin fields
SchrodingersGat b3fc802
Enable filter by part variant
SchrodingersGat 529beed
Move table to Manufacturing
SchrodingersGat 4e8dd42
Fix API endpoints
SchrodingersGat 4c54363
Make "part' a required field
SchrodingersGat 1db97a7
Add dashboard widgets
SchrodingersGat 26323af
Update form fields
SchrodingersGat 9e58920
Additional regression test
SchrodingersGat 396aed5
Merge upstream/master and resolve api_version/report conflicts
adityakrmishra 10fa4a7
Fix: Update tests and frontend E2E specs for required part field
adityakrmishra db65138
Merge branch 'feature-repair-orders-backend-12064' of github.com:adit…
SchrodingersGat 87439be
Fix clash of migration files
SchrodingersGat f423fbb
Update notes support
SchrodingersGat 41a1709
Merge branch 'master' into feature-repair-orders-backend-12064
SchrodingersGat b51d13e
Update docs
SchrodingersGat 3748c92
Merge branch 'master' into feature-repair-orders-backend-12064
SchrodingersGat 8cc588d
Merge branch 'master' into feature-repair-orders-backend-12064
matmair 4ca07ba
Merge branch 'master' of github.com:inventree/InvenTree into feature-…
SchrodingersGat bca585d
Fix frontend URLs
SchrodingersGat 4f0e13f
Merge branch 'feature-repair-orders-backend-12064' of github.com:adit…
SchrodingersGat 7299f64
Updated part reference and unit tests
SchrodingersGat 32f9042
Add tags support for RepairOrder API / UI
SchrodingersGat 1bb33c2
Fix: Resolve PostgreSQL query timing and enable frontend repair order…
adityakrmishra d7af8d6
Fix: Update frontend E2E tests to handle required fields and UI changes
adityakrmishra e21f43d
Merge master and resolve API version conflict
adityakrmishra 652650a
Merge branch 'feature-repair-orders-backend-12064' of github.com:adit…
SchrodingersGat 5884270
Merge commit 'ff732d01aa35c8b2b6c52631f188516ceba31b83' into feature-…
SchrodingersGat 7951336
Merge branch 'master' into feature-repair-orders-backend-12064
SchrodingersGat 99c1c43
Fix: Resolve upstream merge conflicts (v543 API bump) and stabilize r…
adityakrmishra 8ab4502
Merge branch 'feature-repair-orders-backend-12064' of https://github.…
adityakrmishra 895a25d
Merge commit '5ffd777f5d9f7f36607bd8715997a4e69653308e' into feature-…
SchrodingersGat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2513,6 +2513,89 @@ def item_link(self, item): | |
| return construct_absolute_url(item.get_absolute_url()) | ||
|
|
||
|
|
||
| class RepairOrderList(ListCreateAPI): | ||
| """API endpoint for accessing a list of RepairOrder objects.""" | ||
|
|
||
| queryset = models.RepairOrder.objects.all() | ||
| serializer_class = serializers.RepairOrderSerializer | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am missing a permissions class here |
||
|
|
||
|
|
||
| class RepairOrderDetail(RetrieveUpdateDestroyAPI): | ||
| """API endpoint for detail view of a single RepairOrder object.""" | ||
|
|
||
| queryset = models.RepairOrder.objects.all() | ||
| serializer_class = serializers.RepairOrderSerializer | ||
|
|
||
|
|
||
| class RepairOrderLineItemList(ListCreateAPI): | ||
| """API endpoint for accessing a list of RepairOrderLineItem objects.""" | ||
|
|
||
| queryset = models.RepairOrderLineItem.objects.all() | ||
| serializer_class = serializers.RepairOrderLineItemSerializer | ||
|
|
||
|
|
||
| class RepairOrderLineItemDetail(RetrieveUpdateDestroyAPI): | ||
| """API endpoint for detail view of a single RepairOrderLineItem object.""" | ||
|
|
||
| queryset = models.RepairOrderLineItem.objects.all() | ||
| serializer_class = serializers.RepairOrderLineItemSerializer | ||
|
|
||
|
|
||
| class RepairOrderAllocationList(ListCreateAPI): | ||
| """API endpoint for accessing a list of RepairOrderAllocation objects.""" | ||
|
|
||
| queryset = models.RepairOrderAllocation.objects.all() | ||
| serializer_class = serializers.RepairOrderAllocationSerializer | ||
|
|
||
|
|
||
| class RepairOrderAllocationDetail(RetrieveUpdateDestroyAPI): | ||
| """API endpoint for detail view of a single RepairOrderAllocation object.""" | ||
|
|
||
| queryset = models.RepairOrderAllocation.objects.all() | ||
| serializer_class = serializers.RepairOrderAllocationSerializer | ||
|
|
||
|
|
||
| repair_order_api_urls = [ | ||
| path( | ||
| '<int:pk>/', | ||
| include([ | ||
| path('', RepairOrderDetail.as_view(), name='api-repair-order-detail') | ||
| ]), | ||
| ), | ||
| path('', RepairOrderList.as_view(), name='api-repair-order-list'), | ||
| ] | ||
|
|
||
| repair_order_line_api_urls = [ | ||
| path( | ||
| '<int:pk>/', | ||
| include([ | ||
| path( | ||
| '', | ||
| RepairOrderLineItemDetail.as_view(), | ||
| name='api-repair-order-line-detail', | ||
| ) | ||
| ]), | ||
| ), | ||
| path('', RepairOrderLineItemList.as_view(), name='api-repair-order-line-list'), | ||
| ] | ||
|
|
||
| repair_order_allocation_api_urls = [ | ||
| path( | ||
| '<int:pk>/', | ||
| include([ | ||
| path( | ||
| '', | ||
| RepairOrderAllocationDetail.as_view(), | ||
| name='api-repair-order-allocation-detail', | ||
| ) | ||
| ]), | ||
| ), | ||
| path( | ||
| '', RepairOrderAllocationList.as_view(), name='api-repair-order-allocation-list' | ||
| ), | ||
| ] | ||
|
|
||
|
|
||
| order_api_urls = [ | ||
| # API endpoints for purchase orders | ||
| path( | ||
|
|
@@ -2901,4 +2984,8 @@ def item_link(self, item): | |
| OrderCalendarExport(), | ||
| name='api-po-so-calendar', | ||
| ), | ||
| # Repair Order endpoints | ||
| path('repair/', include(repair_order_api_urls)), | ||
| path('repair-line/', include(repair_order_line_api_urls)), | ||
| path('repair-allocation/', include(repair_order_allocation_api_urls)), | ||
| ] | ||
216 changes: 216 additions & 0 deletions
216
.../InvenTree/order/migrations/0120_repairorder_repairorderlineitem_repairorderallocation.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,216 @@ | ||
| # Generated by Django 5.2.13 on 2026-06-04 02:30 | ||
|
|
||
| import django.db.models.deletion | ||
| from django.db import migrations, models | ||
|
|
||
| import InvenTree.fields | ||
| import InvenTree.models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ('company', '0077_delete_manufacturerpartparameter'), | ||
| ('order', '0119_transferorderlineitem_line_int'), | ||
| ('part', '0146_auto_20251203_1241'), | ||
| ('stock', '0116_alter_stockitem_link'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.CreateModel( | ||
| name='RepairOrder', | ||
| fields=[ | ||
| ( | ||
| 'id', | ||
| models.AutoField( | ||
| auto_created=True, | ||
| primary_key=True, | ||
| serialize=False, | ||
| verbose_name='ID', | ||
| ), | ||
| ), | ||
| ( | ||
| 'metadata', | ||
| models.JSONField( | ||
| blank=True, | ||
| help_text='JSON metadata field, for use by external plugins', | ||
| null=True, | ||
| verbose_name='Plugin Metadata', | ||
| ), | ||
| ), | ||
| ( | ||
| 'notes', | ||
| InvenTree.fields.InvenTreeNotesField( | ||
| blank=True, | ||
| help_text='Markdown notes (optional)', | ||
| max_length=50000, | ||
| null=True, | ||
| verbose_name='Notes', | ||
| ), | ||
| ), | ||
| ( | ||
| 'reference', | ||
| models.CharField( | ||
| help_text='Repair Order Reference', | ||
| max_length=100, | ||
| unique=True, | ||
| verbose_name='Reference', | ||
| ), | ||
| ), | ||
| ( | ||
| 'description', | ||
| models.CharField( | ||
| help_text='Repair order description', | ||
| max_length=250, | ||
| verbose_name='Description', | ||
| ), | ||
| ), | ||
| ( | ||
| 'symptoms', | ||
| models.TextField( | ||
| blank=True, | ||
| help_text='Reported symptoms or issues', | ||
| verbose_name='Symptoms', | ||
| ), | ||
| ), | ||
| ( | ||
| 'status', | ||
| models.IntegerField( | ||
| choices=[ | ||
| (10, 'Pending'), | ||
| (20, 'In Progress'), | ||
| (25, 'On Hold'), | ||
| (30, 'Complete'), | ||
| (40, 'Cancelled'), | ||
| ], | ||
| default=10, | ||
| help_text='Repair order status', | ||
| verbose_name='Status', | ||
| ), | ||
| ), | ||
| ( | ||
| 'customer', | ||
| models.ForeignKey( | ||
| blank=True, | ||
| help_text='Customer reference', | ||
| limit_choices_to={'is_customer': True}, | ||
| null=True, | ||
| on_delete=django.db.models.deletion.SET_NULL, | ||
| related_name='repair_orders', | ||
| to='company.company', | ||
| verbose_name='Customer', | ||
| ), | ||
| ), | ||
| ], | ||
| options={'verbose_name': 'Repair Order'}, | ||
| bases=( | ||
| InvenTree.models.InvenTreeAttachmentMixin, | ||
| InvenTree.models.InvenTreePermissionCheckMixin, | ||
| InvenTree.models.ContentTypeMixin, | ||
| InvenTree.models.PluginValidationMixin, | ||
| models.Model, | ||
| ), | ||
| ), | ||
| migrations.CreateModel( | ||
| name='RepairOrderLineItem', | ||
| fields=[ | ||
| ( | ||
| 'id', | ||
| models.AutoField( | ||
| auto_created=True, | ||
| primary_key=True, | ||
| serialize=False, | ||
| verbose_name='ID', | ||
| ), | ||
| ), | ||
| ( | ||
| 'metadata', | ||
| models.JSONField( | ||
| blank=True, | ||
| help_text='JSON metadata field, for use by external plugins', | ||
| null=True, | ||
| verbose_name='Plugin Metadata', | ||
| ), | ||
| ), | ||
| ( | ||
| 'order', | ||
| models.ForeignKey( | ||
| on_delete=django.db.models.deletion.CASCADE, | ||
| related_name='lines', | ||
| to='order.repairorder', | ||
| verbose_name='Repair Order', | ||
| ), | ||
| ), | ||
| ( | ||
| 'part', | ||
| models.ForeignKey( | ||
| blank=True, | ||
| help_text='Part to be consumed for repair', | ||
| null=True, | ||
| on_delete=django.db.models.deletion.SET_NULL, | ||
| related_name='repair_order_line_items', | ||
| to='part.part', | ||
| verbose_name='Part', | ||
| ), | ||
| ), | ||
| ( | ||
| 'quantity', | ||
| models.DecimalField( | ||
| decimal_places=5, | ||
| default=1, | ||
| help_text='Item quantity required for repair', | ||
| max_digits=15, | ||
| verbose_name='Quantity', | ||
| ), | ||
| ), | ||
| ], | ||
| options={'verbose_name': 'Repair Order Line Item'}, | ||
| bases=( | ||
| InvenTree.models.ContentTypeMixin, | ||
| InvenTree.models.PluginValidationMixin, | ||
| models.Model, | ||
| ), | ||
| ), | ||
| migrations.CreateModel( | ||
| name='RepairOrderAllocation', | ||
| fields=[ | ||
| ( | ||
| 'id', | ||
| models.AutoField( | ||
| auto_created=True, | ||
| primary_key=True, | ||
| serialize=False, | ||
| verbose_name='ID', | ||
| ), | ||
| ), | ||
| ( | ||
| 'line', | ||
| models.ForeignKey( | ||
| on_delete=django.db.models.deletion.CASCADE, | ||
| related_name='allocations', | ||
| to='order.repairorderlineitem', | ||
| verbose_name='Line Item', | ||
| ), | ||
| ), | ||
| ( | ||
| 'item', | ||
| models.ForeignKey( | ||
| on_delete=django.db.models.deletion.CASCADE, | ||
| related_name='repair_order_allocations', | ||
| to='stock.stockitem', | ||
| verbose_name='Stock Item', | ||
| ), | ||
| ), | ||
| ( | ||
| 'quantity', | ||
| models.DecimalField( | ||
| decimal_places=5, | ||
| default=1, | ||
| help_text='Allocated stock quantity', | ||
| max_digits=15, | ||
| verbose_name='Quantity', | ||
| ), | ||
| ), | ||
| ], | ||
| options={'verbose_name': 'Repair Order Allocation'}, | ||
| ), | ||
| ] |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.