diff --git a/gestaoRaul/balcao/__pycache__/htmx_views.cpython-312.pyc b/gestaoRaul/balcao/__pycache__/htmx_views.cpython-312.pyc index 2762430..8fa7aeb 100644 Binary files a/gestaoRaul/balcao/__pycache__/htmx_views.cpython-312.pyc and b/gestaoRaul/balcao/__pycache__/htmx_views.cpython-312.pyc differ diff --git a/gestaoRaul/balcao/__pycache__/views.cpython-312.pyc b/gestaoRaul/balcao/__pycache__/views.cpython-312.pyc index e5fe050..718e315 100644 Binary files a/gestaoRaul/balcao/__pycache__/views.cpython-312.pyc and b/gestaoRaul/balcao/__pycache__/views.cpython-312.pyc differ diff --git a/gestaoRaul/balcao/htmx_views.py b/gestaoRaul/balcao/htmx_views.py index 9b608e0..8fa028e 100644 --- a/gestaoRaul/balcao/htmx_views.py +++ b/gestaoRaul/balcao/htmx_views.py @@ -30,6 +30,8 @@ def addProductBalcao(request, product_id, comanda_id, qtd): for i in range(qtd): product_comanda = ProductComanda(comanda_id=comanda_id, product_id=product_id) product_comanda.save() + Product.subStock(Product.objects.get(id=product_id), qtd) + consumo = ProductComanda.objects.filter(comanda=comanda_id) total = 0 for produto in consumo: @@ -42,6 +44,7 @@ def addProductBalcaoTeclado(request, product_id, comanda_id, qtd): for i in range(qtd): product_comanda = ProductComanda(comanda_id=comanda_id, product_id=product_id) product_comanda.save() + Product.subStock(Product.objects.get(id=product_id), qtd) consumo = ProductComanda.objects.filter(comanda=comanda_id) total = 0 for produto in consumo: @@ -53,6 +56,8 @@ def removeProductBalcao(request, productComanda_id): product_comanda = ProductComanda.objects.get(id=productComanda_id) consumo = ProductComanda.objects.filter(comanda=product_comanda.comanda) product_comanda.delete() + Product.addStock(Product.objects.get(id=product_comanda.product.id), 1) + total = 0 for produto in consumo: total += produto.product.price diff --git a/gestaoRaul/comandas/__pycache__/htmx_views.cpython-312.pyc b/gestaoRaul/comandas/__pycache__/htmx_views.cpython-312.pyc index d3dc32f..6374490 100644 Binary files a/gestaoRaul/comandas/__pycache__/htmx_views.cpython-312.pyc and b/gestaoRaul/comandas/__pycache__/htmx_views.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/__pycache__/models.cpython-312.pyc b/gestaoRaul/comandas/__pycache__/models.cpython-312.pyc index f02c04a..6b5b583 100644 Binary files a/gestaoRaul/comandas/__pycache__/models.cpython-312.pyc and b/gestaoRaul/comandas/__pycache__/models.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/__pycache__/urls.cpython-312.pyc b/gestaoRaul/comandas/__pycache__/urls.cpython-312.pyc index 60191b4..706f463 100644 Binary files a/gestaoRaul/comandas/__pycache__/urls.cpython-312.pyc and b/gestaoRaul/comandas/__pycache__/urls.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/__pycache__/views.cpython-312.pyc b/gestaoRaul/comandas/__pycache__/views.cpython-312.pyc index b055aa7..4ba7291 100644 Binary files a/gestaoRaul/comandas/__pycache__/views.cpython-312.pyc and b/gestaoRaul/comandas/__pycache__/views.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/htmx_views.py b/gestaoRaul/comandas/htmx_views.py index 1787fee..87451b9 100644 --- a/gestaoRaul/comandas/htmx_views.py +++ b/gestaoRaul/comandas/htmx_views.py @@ -45,6 +45,8 @@ def removeProductComanda(request, productComanda_id): if product_comanda.product.cuisine == True: order = Order.objects.get(productComanda=product_comanda) product_comanda.delete() + Product.addStock(Product.objects.get(id=product_comanda.product.id), 1) + msg = JsonResponse({ 'type': 'broadcast', 'message': 'Atenção! Pedido cancelado', @@ -59,6 +61,7 @@ def removeProductComanda(request, productComanda_id): valores = somar(consumo,comanda) else: product_comanda.delete() + Product.addStock(Product.objects.get(id=product_comanda.product.id), 1) consumo = ProductComanda.objects.filter(comanda=comanda) valores = somar(consumo,comanda) diff --git a/gestaoRaul/comandas/templates/viewcomanda.html b/gestaoRaul/comandas/templates/viewcomanda.html index 8d6ff2b..920a66a 100644 --- a/gestaoRaul/comandas/templates/viewcomanda.html +++ b/gestaoRaul/comandas/templates/viewcomanda.html @@ -50,7 +50,7 @@ Detalhes {{comanda.name}}
-