mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add python example for deleting a part (#4703)
* Add python example for deleting a part * Ignore PRs which are just docs from release notes
This commit is contained in:
parent
5fcab2aec3
commit
608f96c723
1
.github/release.yml
vendored
1
.github/release.yml
vendored
@ -4,6 +4,7 @@ changelog:
|
|||||||
exclude:
|
exclude:
|
||||||
labels:
|
labels:
|
||||||
- translation
|
- translation
|
||||||
|
- documentation
|
||||||
categories:
|
categories:
|
||||||
- title: Breaking Changes
|
- title: Breaking Changes
|
||||||
labels:
|
labels:
|
||||||
|
@ -188,6 +188,18 @@ loc = StockLocation(api, pk=12)
|
|||||||
item.transferStock(loc, quantity=50)
|
item.transferStock(loc, quantity=50)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Delete a Part
|
||||||
|
|
||||||
|
To delete a [Part instance](../../part/part.md), first in needs to be marked as *inactive* (otherwise it will throw an error):
|
||||||
|
|
||||||
|
```python
|
||||||
|
from inventree.part import Part
|
||||||
|
|
||||||
|
part = Part(api, pk=10)
|
||||||
|
part.save(data={'active': False})
|
||||||
|
part.delete()
|
||||||
|
```
|
||||||
|
|
||||||
### Bulk Delete
|
### Bulk Delete
|
||||||
|
|
||||||
Some database models support bulk delete operations, where multiple database entries can be deleted in a single API query.
|
Some database models support bulk delete operations, where multiple database entries can be deleted in a single API query.
|
||||||
|
Loading…
Reference in New Issue
Block a user