Repository navigation
Import update - #10188
Import update#10188
Conversation
✅ Deploy Preview for inventree-web-pui-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #10188 +/- ##
==========================================
+ Coverage 87.21% 87.34% +0.12%
==========================================
Files 1259 1260 +1
Lines 56173 56233 +60
Branches 2070 2070
==========================================
+ Hits 48991 49115 +124
+ Misses 6673 6609 -64
Partials 509 509
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds the ability to update existing records using the data import framework. The update enables users to import CSV files containing record IDs and modified data to update existing database records rather than only creating new ones.
- Introduces an "Update Existing Records" toggle option for import sessions
- Adds special handling for ID field mapping and validation during updates
- Updates the import UI to support the new update workflow with proper field mapping
Reviewed Changes
Copilot reviewed 12 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/frontend/src/forms/ImporterForms.tsx | Adds update_records field configuration and modelType parameter to form fields |
| src/backend/InvenTree/importer/models.py | Implements core update logic with ID field handling and record validation |
| src/backend/InvenTree/importer/serializers.py | Exposes update_records field in API serializer |
| src/frontend/tests/pui_importing.spec.ts | Updates test to cover the new update workflow with BOM items |
| src/frontend/src/components/importer/ImportDataSelector.tsx | Prevents editing of ID field in import data selector |
| src/frontend/src/components/importer/ImporterColumnSelector.tsx | Adds aria-label for accessibility |
| src/frontend/src/tables/settings/ImportSessionTable.tsx | Enables update option in admin import session creation |
| src/frontend/src/tables/purchasing/PurchaseOrderLineItemTable.tsx | Refactors to use new dataImporterSessionFields API |
| src/frontend/src/tables/bom/BomTable.tsx | Refactors to use new dataImporterSessionFields API |
| src/backend/InvenTree/importer/migrations/0005_dataimportsession_update_records.py | Database migration to add update_records field |
| src/backend/InvenTree/InvenTree/api_version.py | Bumps API version for new functionality |
| docs/docs/settings/import.md | Documents the new update workflow process |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
matmair
left a comment
There was a problem hiding this comment.
This looks great! I see there is a todo regarding testing that was closed; will this receive further backend unit tests for updating records or would that something for a future PR?
- Ensure page does not exceed available records
This extra testing has been added back in now btw :) |
* Add field to "update" existing records * Ensure the ID is first * Prevent editing of "ID" field * Extract db instance * Bump API version * Prevent edit of "id" field * Refactoring * Enhanced playwright tests for data importing * Update docs * Update src/backend/InvenTree/importer/models.py Co-authored-by: Copilot <[email protected]> * Update src/frontend/src/forms/ImporterForms.tsx Co-authored-by: Copilot <[email protected]> * Fix silly AI mistake * Fix for table pagination - Ensure page does not exceed available records * Bug fix for playwright test * Add end-to-end API testing * Fix unit tests * Adjust table page logic * Ensure sensible page size * Simplify playwright test * Simplify test again * Tweak unit test - Importing has invalidated the BOM? * Adjust playwright tests * Further playwright fixes --------- Co-authored-by: Copilot <[email protected]>

Tasks