Skip to content

Import update - #10188

Merged
SchrodingersGat merged 26 commits into
inventree:masterfrom
SchrodingersGat:import-update
Aug 20, 2025
Merged

SchrodingersGat merged 26 commits into
inventree:masterfrom
SchrodingersGat:import-update

Conversation

@SchrodingersGat

@SchrodingersGat SchrodingersGat commented Aug 18, 2025 •

Copy link
Copy Markdown
Member

Tasks

  • Update documentation
  • Playwright testing
  • Increased code coverage for data import framework
  • Updated API testing and code coverage

@SchrodingersGat SchrodingersGat added this to the 1.0.0 milestone Aug 18, 2025
@SchrodingersGat SchrodingersGat added the import / export Data importing, exporting and processing label Aug 18, 2025
@netlify

netlify Bot commented Aug 18, 2025 •

Copy link
Copy Markdown

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

Name Link
🔨 Latest commit 9993f41
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/68a5516136f26d0008351b80
😎 Deploy Preview https://deploy-preview-10188--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: 97 (🟢 up 3 from production)
Accessibility: 81 (no change from production)
Best Practices: 100 (no change from production)
SEO: 78 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Aug 18, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.34%. Comparing base (e44008f) to head (9993f41).
⚠️ Report is 294 commits behind head on master.

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              
Flag Coverage Δ
backend 89.05% <84.61%> (+0.15%) ⬆️

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

Components Coverage Δ
Backend Apps 91.64% <84.41%> (+0.19%) ⬆️
Backend General 93.64% <ø> (ø)
Frontend 70.05% <ø> (-0.02%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@matmair matmair added the enhancement This is an suggested enhancement or new feature label Aug 19, 2025

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

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?

@SchrodingersGat

Copy link
Copy Markdown
Member Author

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?

This extra testing has been added back in now btw :)

@SchrodingersGat
SchrodingersGat merged commit 885ec81 into inventree:master Aug 20, 2025
@SchrodingersGat
SchrodingersGat deleted the import-update branch August 20, 2025 05:34
daniil4udo pushed a commit to daniil4udo/InvenTree that referenced this pull request Aug 26, 2025
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement This is an suggested enhancement or new feature import / export Data importing, exporting and processing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Importer] Update existing records

3 participants