Skip to content

help on using fieldNames & fieldInfo #248

Open
@turist79

Description

@turist79

Hi

just making myself familiar with the API.
i am able to connect to my Inventree server (running in docker on other machine) using dedicated user with only "view" rights to all except Admin.
i can list all stock items with names and locations.
But somehow this simple thing from the documentation does not work in any way:

from inventree.api import InvenTreeAPI
from inventree.part import Part
from inventree.stock import StockItem

SERVER_ADDRESS = 'https://inventree.xxx'
MY_USERNAME = 'python_view'
MY_PASSWORD = 'yyy'

api = InvenTreeAPI(SERVER_ADDRESS, username=MY_USERNAME, password=MY_PASSWORD)

fields = Part.fieldNames(api)
for field in fields:
    print(field, '->', Part.fieldInfo(field, api))

it does not crash - just does not yield any result. i dont get why would be that, i have checked the source code - there is defenetely corresponding method for that in base inventree object.

PS: this is the right and only way to see the full ist of fields & properties of the obects or is there some documentation on that topic as well?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions