fix bug of free products from pos in update
This commit is contained in:
@@ -14,11 +14,14 @@ class POSFreeProductSerializer(serializers.ModelSerializer):
|
|||||||
"""
|
"""
|
||||||
@check free product for pos to be unique
|
@check free product for pos to be unique
|
||||||
"""
|
"""
|
||||||
organization = attrs['organization']
|
|
||||||
product = attrs['product']
|
|
||||||
|
|
||||||
if self.Meta.model.objects.filter(organization=organization, product=product).exists():
|
if not self.instance:
|
||||||
raise FreePOSProductUniqueCheck()
|
|
||||||
|
product = attrs['product']
|
||||||
|
organization = attrs['organization']
|
||||||
|
|
||||||
|
if self.Meta.model.objects.filter(organization=organization, product=product).exists():
|
||||||
|
raise FreePOSProductUniqueCheck()
|
||||||
|
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class ProductViewSet(viewsets.ModelViewSet, DynamicSearchMixin, POSDeviceMixin):
|
|||||||
try:
|
try:
|
||||||
trash(self.queryset, pk)
|
trash(self.queryset, pk)
|
||||||
except APIException as e:
|
except APIException as e:
|
||||||
return Response(e, status.HTTP_204_NO_CONTENT)
|
return Response(e, status.HTTP_204_NO_CONTENT)
|
||||||
|
|
||||||
@action(
|
@action(
|
||||||
methods=['post'],
|
methods=['post'],
|
||||||
|
|||||||
Reference in New Issue
Block a user