2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-09-18 08:31:33 +00:00

Add bulk delete for purchase order line items (#4452)

* add bulk delete for purchase order line items

* bump API version

* fix JS style

* handle parts with no linked manufacturer part correctly

* add unit test for purchase order line item bulk delete
This commit is contained in:
simonkuehling
2023-03-08 00:50:24 +01:00
committed by GitHub
parent abeb85cbb3
commit 106c238af5
5 changed files with 121 additions and 2 deletions

View File

@@ -603,6 +603,26 @@ class PurchaseOrderLineItemTest(OrderTest):
self.filter({'has_pricing': 1}, 0)
self.filter({'has_pricing': 0}, 5)
def test_po_line_bulk_delete(self):
"""Test that we can bulk delete multiple PurchaseOrderLineItems via the API."""
n = models.PurchaseOrderLineItem.objects.count()
self.assignRole('purchase_order.delete')
url = reverse('api-po-line-list')
# Try to delete a set of line items via their IDs
self.delete(
url,
{
'items': [1, 2],
},
expected_code=204,
)
# We should have 2 less PurchaseOrderLineItems after deletign them
self.assertEqual(models.PurchaseOrderLineItem.objects.count(), n - 2)
class PurchaseOrderDownloadTest(OrderTest):
"""Unit tests for downloading PurchaseOrder data via the API endpoint."""