contabilizar produtos vendidos no balcão

This commit is contained in:
2024-12-26 10:37:05 -03:00
parent 63c9859557
commit a9896730eb
7 changed files with 29 additions and 37 deletions

View File

@@ -35,22 +35,14 @@ def paymentBalcao(request, comanda_id):
typePayment = TypePay.objects.get(id=1)
consumo = ProductComanda.objects.filter(comanda=comanda_id)
vendasBalcao = Comanda.objects.get(name='VENDAS BALCAO')
print('ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg')
print(f'ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg{vendasBalcao.id}')
comanda = Comanda.objects.get(name='VENDA BALCÃO')
total = 0
for produto in consumo:
total += produto.product.price
produto.comanda = 14
produto.comanda = vendasBalcao
produto.save()
# newObject = ProductComanda.objects.get(comanda=produto.id)
# newObject.comanda= 14
# newObject.save()
pagamento = Payments(value=total, comanda=comanda, type_pay=typePayment,description='VENDA BALCÃO')
pagamento.save()
# comanda.save()
return redirect('comandas')
return redirect('viewBalcao')