inventree / inventree-python

Python library for communication with inventree via API
https://docs.inventree.org/en/latest/api/python/python/
MIT License
26 stars 34 forks source link

Update Database via inventree-python #50

Closed lookme2 closed 3 years ago

lookme2 commented 3 years ago

I would like to remove parts from my database via the python module. I don't see a way of doing that. Am I missing something?

eeintech commented 3 years ago

@lookme2 Have you tried the following sequence?

part = Part(api, 1)
part._data['active'] = False
part.save()
part.delete()

(replace 1 with your part PK)

EDIT: The user who is deleting the part also needs to have the delete permission for the Part model, see: https://inventree.readthedocs.io/en/latest/admin/permissions/

lookme2 commented 3 years ago

@eeintech thanks. I'll give that a try.