Skip to content

Conversation

@TehDmitry
Copy link

@TehDmitry TehDmitry commented Sep 4, 2025

#9248, #9382 and partly #7574
inspired by #2349

vivaldi_Yn0jh0W0yL

edit matmair:
Closes #9248
Closes #7574

@netlify
Copy link

netlify bot commented Sep 4, 2025

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

Name Link
🔨 Latest commit e7d9867
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/68beec5f5f495b00082d3d85
😎 Deploy Preview https://deploy-preview-10268--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: 91 (🔴 down 4 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.

@SchrodingersGat
Copy link
Member

SchrodingersGat commented Sep 4, 2025

@TehDmitry this is an interesting idea, but your approach is very much hard-wired for "part" import. The importer works for many different models, and so the approach should be generic too.

I would suggest that to make this generic, we add a list of possible "Import ID" fields to the underlying import model class. So, for the "Part" class, you might add:

class Part(...):
    
    def import_id_fields(self):
        """Return a list of potential ID fields for import."""
        return ['pk', 'IPN', 'name']
       

If this method is not specified, then the importer just uses the 'pk' field (as a default).

The import process then matches the provided field values, to the "names" of the fields (which are translated already, so we don't need to replicate that).

Then, the import system exposes the available import field types for any "foreign key relation" to the frontend.

I like the frontend implementation, that's a clean way of handling this.

Overall, this is a really nice enhancement - we just need to make it generic!

@SchrodingersGat SchrodingersGat added enhancement This is an suggested enhancement or new feature api Relates to the API import / export Data importing, exporting and processing User Interface Related to the frontend / User Interface labels Sep 4, 2025
@SchrodingersGat SchrodingersGat added this to the 1.1.0 milestone Sep 4, 2025
@codecov
Copy link

codecov bot commented Sep 7, 2025

Codecov Report

❌ Patch coverage is 31.57895% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.19%. Comparing base (a47a022) to head (e7d9867).
⚠️ Report is 178 commits behind head on master.

❌ Your patch check has failed because the patch coverage (17.64%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.
❌ Your project check has failed because the head coverage (89.55%) is below the target coverage (90.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10268      +/-   ##
==========================================
- Coverage   87.40%   86.19%   -1.22%     
==========================================
  Files        1266     1266              
  Lines       56455    57830    +1375     
  Branches     2061     2064       +3     
==========================================
+ Hits        49345    49847     +502     
- Misses       6603     7475     +872     
- Partials      507      508       +1     
Flag Coverage Δ
backend 88.98% <42.85%> (-0.15%) ⬇️

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

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

commit=False,
)

for key in row.data:
Copy link
Member

Choose a reason for hiding this comment

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

Looks like you still have some hard-coded fields here - the "import_as" fields should not have to be called out by name.

@staticmethod
def import_as_fields():
"""Return a list of potential ID fields for import."""
return ['id', 'IPN', 'name']
Copy link
Member

Choose a reason for hiding this comment

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

Nice, this is a simple way to specify the import-as options

);
}

function ImporterPartImportAsSelect({
Copy link
Member

Choose a reason for hiding this comment

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

This should be ImporterImportAsSelect - it is not specific to importing parts, it should be generic across any type of import

@SchrodingersGat SchrodingersGat modified the milestones: 1.1.0, 1.2.0 Oct 28, 2025
@SchrodingersGat
Copy link
Member

@TehDmitry have you had any chance to review this further?

@Badokas
Copy link

Badokas commented Jan 1, 2026

Any updates on this? We need this functionality, maybe I can help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Relates to the API enhancement This is an suggested enhancement or new feature import / export Data importing, exporting and processing User Interface Related to the frontend / User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FR] Add IPN as matching field for BoM import [Importer] Natural Key Support

4 participants