Spaces:
Running
Running
AI Assistant
feat: add advanced filtering, sorting, and balance calculations for customers and products api endpoints
17a7cdf Download delete_zero_items.py from amer003100/ERP_Sysyem: direct link, hf CLI and curl.
- Browser
- Download file 304 Bytes
-
https://huggingface.co/spaces/amer003100/ERP_Sysyem/resolve/main/delete_zero_items.py
- Command line
-
hf download hf://spaces/amer003100/ERP_Sysyem/delete_zero_items.py
-
curl -L -o delete_zero_items.py https://huggingface.co/spaces/amer003100/ERP_Sysyem/resolve/main/delete_zero_items.py
304 Bytes
| from app.core.database import SessionLocal | |
| from app.models.domain import InvoiceItem | |
| db = SessionLocal() | |
| items = db.query(InvoiceItem).filter(InvoiceItem.quantity <= 0).all() | |
| deleted = 0 | |
| for i in items: | |
| db.delete(i) | |
| deleted += 1 | |
| db.commit() | |
| print(f"Deleted {deleted} items with quantity <= 0") | |