I am attempting to use the Part.isUsedIn() method to return a list of all BOM items for a given part.
However, it appears that this method is currently returning ALL bom items, not just those that represent the given part. I suspect that the keyword used to query for the BomItem via the API has changed, as I noticed the request in the web interface of InvenTree is using the uses param.
For now, I'm working around the issue by constructing the API request myself as follows:
from inventree.api import InvenTreeAPI
from inventree.part import BomItem, Part
INVENTREE_API = InvenTreeAPI(...)
part = Part(...)
used_in_bomitems = [
BomItem(INVENTREE_API, data=bomitem_data)
for bomitem_data in INVENTREE_API.get("bom/", params={"uses": part.pk})
]
I believe this can be resolved by changing these lines to use the uses kwarg instead of sub_part
I am attempting to use the
Part.isUsedIn()
method to return a list of all BOM items for a given part.However, it appears that this method is currently returning ALL bom items, not just those that represent the given part. I suspect that the keyword used to query for the
BomItem
via the API has changed, as I noticed the request in the web interface of InvenTree is using theuses
param.For now, I'm working around the issue by constructing the API request myself as follows:
I believe this can be resolved by changing these lines to use the
uses
kwarg instead ofsub_part