Open tehkillerbee opened 1 year ago
I was expecting to be able to access substitute.pk etc. directly. Is there something I am missing?
This is expected. The pk
value here is for the BomItemSubstitute
instance, not the part:
Is there a different way to get hold of the BOM "depth" index directly using the API?
No, 'depth' is not stored or calculated for bills of materials
Is there a way to obtain a sorted BOM list from the API? Eg. if I want to sort by Assemblies or items with a stock quantity of 0?
You can see the available 'filtering' options here:
The 'ordering' fields are somewhat limited:
On an unrelated note. I was wondering if these scripts I have been working on can be useful in any way - perhaps as an "example" of how to use the API.
Certainly you could add something like this to our "examples" page:
https://docs.inventree.org/en/latest/api/python/examples/
The docs are managed on github too - you can raise a PR here - https://github.com/inventree/inventree-docs/pulls
This API has been most useful, so it would be nice to give back to the project somehow. :)
Much appreciated! InvenTree is very much community driven, so any support would be appreciated :)
Hello,
I have been using the InvenTree API to generate BOMs in a custom XLSX format. It seems the InvenTree web does not allow me to export specific fields from the BOM to XLSX and it seems easier to use the API directly. Then I can also format the text (color etc.)
These are the steps I have used so far:
The above steps handle all situations, except substitute parts, so I am now trying to handle that. For each
bom_item
, i get the list of substitutes (bom_item.substitutes
). This list does not contain a list of Parts as expected, but a list with a dict for each substitute part. I convert this to a Part by the following dict look-up:substitute.pk
etc. directly. Is there something I am missing?sub_part.assembly
On an unrelated note. I was wondering if these scripts I have been working on can be useful in any way - perhaps as an "example" of how to use the API. This API has been most useful, so it would be nice to give back to the project somehow. :)