Repository navigation
Description
Please verify that this bug has NOT been raised before.
- I checked and didn't find a similar issue
Describe the bug*
Trying to import a BOM to an assembly part from a csv file. I have all the parts added to the inventory, with the manufacturer part number as "Part". All rows show "Incorrect type. Expected pk value, received str."
Steps to Reproduce
-
Create a part, assembly type.
-
Click the "Import BOM Data" icon.
-
Select csv file (attached for reference) and Submit.
SmartPrintCoreH7x_BOM.csv -
Map the "Manufacturer_Part_Number" column to Component, and the "Qty" column to Quantity.

-
Click Accept Column Mapping
All entries in the Component column are marked incorrect.
Expected behaviour
I expect the BOM import to work with this csv file.
Deployment Method
- Docker
- Package
- Bare metal
- Other - added info in Steps to Reproduce
Version Information
InvenTree-Version: 0.18.0 dev
Django Version: 4.2.19
Commit Hash: 06961c6
Commit Date: 2025-03-07
Commit Branch: master
Database: mysql
Debug-Mode: False
Deployed using Docker: False
Platform: Linux-6.8.0-52-generic-x86_64-with-glibc2.35
Installer: GIT
Active plugins: [{"name":"InvenTreeBarcode","slug":"inventreebarcode","version":"2.1.0"},{"name":"InvenTreeCoreNotificationsPlugin","slug":"inventreecorenotificationsplugin","version":"1.0.0"},{"name":"InvenTreeCurrencyExchange","slug":"inventreecurrencyexchange","version":"1.0.0"},{"name":"InvenTreeLabel","slug":"inventreelabel","version":"1.1.0"},{"name":"InvenTreeLabelMachine","slug":"inventreelabelmachine","version":"1.0.0"},{"name":"InvenTreeLabelSheet","slug":"inventreelabelsheet","version":"1.0.0"},{"name":"DigiKeyPlugin","slug":"digikeyplugin","version":"1.0.0"},{"name":"LCSCPlugin","slug":"lcscplugin","version":"1.0.0"},{"name":"MouserPlugin","slug":"mouserplugin","version":"1.0.0"},{"name":"TMEPlugin","slug":"tmeplugin","version":"1.0.0"}]
Please verify if you can reproduce this bug on the demo site.
- I can reproduce this bug on the demo site.

Activity
SchrodingersGat commentedon Mar 26, 2025
You cannot import based on MPN - the only mapping to an internal part is the "PK" (primary key / unique ID) for the part instance.
There are some outstanding issues regarding adding support for import via "natural key lookup":
However none of these have received any developer attention.
galmiklos commentedon Mar 26, 2025
It works with 0.17.7, I can import the same BOM. I thought I could expect the same in the dev release, too.
Most of the parts are not created in this instance of inventree, so there are only a few good hits, but those are marked "not matching part found". The existing parts are matched to the MPNs in the BOM.
SchrodingersGat commentedon Mar 26, 2025
@galmiklos the importer in stable is a completely different workflow and we have not yet been able to get natural key support working in the new implementation. There are a number of large architectural differences, overall the new importer is a much better solution but not all the features are ported yet
gunstr commentedon Mar 27, 2025
@galmiklos I have always used IPN for BoM import lookup why I'm in the same situation as you. As a workatound I have created a Python script using the Python Module where I add an
Inventree pkcolumn to each BoM csv file, then the import works as a charm.If you are more familiar with excel the same can be achieved by exporting all your parts to an excel table and use vlookup to populate a pk column in your BoM.
As @SchrodingersGat mention the
Inventree pkis currently the only implemented matching field why there is no way around than to add the same into your BoMs.galmiklos commentedon Mar 30, 2025
Thank you for the advice, for now I went back to the stable release, and imported my BOM. I am not closing this issue, in case you want to keep it to keep track of this "feature request", but of course, I consider it solved from my point of view.
Thanks again!
ius commentedon Apr 12, 2025
A workaround for those using the InvenTree Kicad plugin: assuming all schematic parts are InvenTree sourced (ie. the InvenTree property contains the part PK) you can use a cli oneliner to generate a CSV file compatible with the BOM importer:
github-actions commentedon Jun 12, 2025
This issue seems stale. Please react to show this is still important.
galmiklos commentedon Jun 15, 2025
Yes, it is important, I would like to be able to import parts without having to know the PKs, just as it works now in the current stable release. I just kept this issue open, in case you needed it for tracking this "feature request", but of course, please feel free to close it, I don't have any immediate expectation.
Thank you!