add: add new feature for order and product
This commit is contained in:
@@ -19,6 +19,7 @@ class OrderItemCreateSerializer(serializers.Serializer):
|
|||||||
if not product:
|
if not product:
|
||||||
raise serializers.ValidationError("Product not found")
|
raise serializers.ValidationError("Product not found")
|
||||||
data['product'] = product
|
data['product'] = product
|
||||||
|
product.quantity_left -= round(data['quantity'] / product.min_quantity)
|
||||||
data['price'] = round((data['quantity'] / product.min_quantity) * product.price)
|
data['price'] = round((data['quantity'] / product.min_quantity) * product.price)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user