From 4f0f899c70fe1679b2c46981738f227f3e90f5c3 Mon Sep 17 00:00:00 2001 From: Mono Mono Date: Mon, 11 Nov 2024 15:36:21 -0500 Subject: [PATCH] fix(Purchase): create Purchase with other payments methods. --- tienda_ilusion/don_confiao/api_views.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tienda_ilusion/don_confiao/api_views.py b/tienda_ilusion/don_confiao/api_views.py index d8c6ffa..ef0d617 100644 --- a/tienda_ilusion/don_confiao/api_views.py +++ b/tienda_ilusion/don_confiao/api_views.py @@ -14,7 +14,12 @@ class SaleView(viewsets.ModelViewSet): customer = Customer.objects.get(pk=data['customer']) date = data['date'] lines = data['saleline_set'] - sale = Sale.objects.create(customer=customer, date=date) + payment_method = data['payment_method'] + sale = Sale.objects.create( + customer=customer, + date=date, + payment_method=payment_method + ) for line in lines: product = Product.objects.get(pk=line['product'])