From 91c584342504d3dbff162a3bca1cc6f82d5e3d0e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 20 Jun 2024 20:56:13 +1000 Subject: [PATCH] Fix fields for PurchaseOrderCancelSerializer (#7481) (#7483) - Throwing an error on an OPTIONS request (cherry picked from commit 758871b8a94d1ed05fc8b84f366c4c7fccf8bae7) Co-authored-by: Oliver --- src/backend/InvenTree/order/serializers.py | 2 +- src/backend/InvenTree/order/test_api.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/backend/InvenTree/order/serializers.py b/src/backend/InvenTree/order/serializers.py index a1da09f21b..6c16977871 100644 --- a/src/backend/InvenTree/order/serializers.py +++ b/src/backend/InvenTree/order/serializers.py @@ -271,7 +271,7 @@ class PurchaseOrderCancelSerializer(serializers.Serializer): class Meta: """Metaclass options.""" - fields = ([],) + fields = [] def get_context_data(self): """Return custom context information about the order.""" diff --git a/src/backend/InvenTree/order/test_api.py b/src/backend/InvenTree/order/test_api.py index fb59f8b446..6e875a8bf9 100644 --- a/src/backend/InvenTree/order/test_api.py +++ b/src/backend/InvenTree/order/test_api.py @@ -484,6 +484,9 @@ class PurchaseOrderTest(OrderTest): url = reverse('api-po-cancel', kwargs={'pk': po.pk}) + # Get an OPTIONS request from the endpoint + self.options(url, data={'context': True}, expected_code=200) + # Try to cancel the PO, but without required permissions self.post(url, {}, expected_code=403)