From f7d6545235e17ee28873a232437936d12ffa3a99 Mon Sep 17 00:00:00 2001 From: Mojtaba-z Date: Mon, 29 Sep 2025 16:47:48 +0330 Subject: [PATCH] fix bug of keys in transaction when they not in body data --- apps/notification/urls.py | 4 ++-- apps/warehouse/pos/api/v1/serializers.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/notification/urls.py b/apps/notification/urls.py index 4f756db..4508a10 100644 --- a/apps/notification/urls.py +++ b/apps/notification/urls.py @@ -1,6 +1,6 @@ from django.urls import path, include urlpatterns = [ - path('web/', include('apps.notification.web.api.v1.urls')), - path('pos/', include('apps.notification.pos.api.v1.urls')) + # path('web/', include('apps.notification.web.api.v1.urls')), + # path('pos/', include('apps.notification.pos.api.v1.urls')) ] diff --git a/apps/warehouse/pos/api/v1/serializers.py b/apps/warehouse/pos/api/v1/serializers.py index c37ac6b..d2d7768 100644 --- a/apps/warehouse/pos/api/v1/serializers.py +++ b/apps/warehouse/pos/api/v1/serializers.py @@ -145,8 +145,8 @@ class InventoryQuotaSaleTransactionSerializer(serializers.ModelSerializer): for item_data in items_data: warehouse_models.InventoryQuotaSaleItem.objects.filter( Q(transaction=transaction) & ( - Q(free_product_id=item_data['free_product']) | - Q(gov_product_id=item_data['gov_product']) + Q(free_product_id=item_data.get('free_product', None)) | + Q(gov_product_id=item_data.get('gov_product', None)) ) ).update(**item_data) return transaction @@ -180,8 +180,8 @@ class InventoryQuotaSaleTransactionSerializer(serializers.ModelSerializer): for item_data in items_data: warehouse_models.InventoryQuotaSaleItem.objects.filter( Q(transaction=transaction) & ( - Q(free_product_id=item_data['free_product']) | - Q(gov_product_id=item_data['gov_product']) + Q(free_product_id=item_data.get('free_product', None)) | + Q(gov_product_id=item_data.get('gov_product', None)) ) ).update(**item_data)