Repository navigation
Feature: Backend scaffolding for Repair Orders (#12064) - #12072
adityakrmishra wants to merge 159 commits into
Conversation
👷 Deploy request for inventree-web-pui-preview pending review.Visit the deploys page to approve it
|
Code FormattingAs 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-devThis will ensure that any commits will be correctly formatted automatically. Migration FilesYou will need to commit any migration files when changing database models. Run |
| class RepairOrderList(ListCreateAPI): | ||
| """API endpoint for accessing a list of RepairOrder objects.""" | ||
|
|
||
| queryset = models.RepairOrder.objects.all() | ||
| serializer_class = serializers.RepairOrderSerializer |
There was a problem hiding this comment.
I am missing a permissions class here
…ff --preview formatting
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #12072 +/- ##
==========================================
+ Coverage 90.45% 90.58% +0.12%
==========================================
Files 909 909
Lines 84391 85654 +1263
Branches 4336 4320 -16
==========================================
+ Hits 76335 77587 +1252
- Misses 7036 7053 +17
+ Partials 1020 1014 -6
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…yml to fix SonarCloud
| class RepairOrder( | ||
| InvenTree.models.InvenTreeAttachmentMixin, | ||
| InvenTree.models.InvenTreeNotesMixin, | ||
| InvenTree.models.InvenTreeMetadataModel, |
There was a problem hiding this comment.
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,
):There was a problem hiding this comment.
Please review and make requested changes
|
Hi @SchrodingersGat, Thanks for pointing me to I checked the logs for the remaining failure in
Playwright fails with a strict mode error because |
|
@adityakrmishra you can either use the Playwright tools or the report attached to the run (with traces) to check which exact match would work to pass this too |
You can instead use |
- Reject allocation of stock which is not in stock (e.g. quarantined, delivered to a customer, or installed in another item). This is also checked when stock is consumed on completion, so stock which became unavailable after allocation blocks completion instead of being consumed. - Reject serialized stock: StockItem.take_stock() cannot remove serialized items, so such an allocation prevented the order from being completed. - Skip serialized stock in auto-allocation, and filter it out of the allocation form. - Document the allocation rules.
|
I found two stock allocation issues in the current branch and opened a fix against it: adityakrmishra#1
The fix rejects both at allocation time (and re-checks on completion, with a full rollback), skips serialized stock in auto-allocate, and adds two regression tests. No model or migration changes. Actually supporting serialized replacement parts still needs a decision on where the consumed item should go (e.g. a |
Serialized stock is no longer rejected. As for a build order, a serialized item allocated to a repair order is marked as consumed by the order when it is completed, instead of being reduced in quantity. - Add StockItem.consumed_by_repair, excluded from in-stock stock - Mark serialized items as consumed (and clear the location) on completion - Serialized allocations must have a quantity of 1 - Auto-allocation includes serialized stock again (whole items only) - Clear consumed_by_repair when an item is returned to stock - Expose the field in the stock API, serializer and admin - Show the consuming repair order on the stock item page - Update tests and docs
…stock Repair orders: consume serialized stock, and only allow available stock to be allocated
…r stock migration 0132
|
@SchrodingersGat @matmair synced with master and bumped api_version to v582 in f979b44. The only two failures look like unrelated flakes (Postgres hit 0.75s on |
…ders-backend-12064
…repair-orders-backend-12064
- source location (take_from) - priority - project_code - completed_by
|
@SchrodingersGat merged master in 358cd76 and fixed a query count failure in All four DB suites and Chromium 1-4 are green now. The two Firefox failures look unrelated ( |
Addresses the backend requirements for #12064.
This PR introduces the initial Django architecture for the new Repair Order feature, integrating it into the
orderapp as discussed.Additions:
RepairOrderStatusenumerations.RepairOrder,RepairOrderLineItem, andRepairOrderAllocationtoorder/models.py.order/api.py.ruff.(Note: Migration files have not been generated in this commit to avoid environment conflicts. Please run
manage.py makemigrations orderwhen reviewing.)Ready for review before we move on to the Mantine UI scaffolding!
closes #12064