diff --git a/django/Invoice/views.py b/django/Invoice/views.py
index 8540818..363f2a0 100644
--- a/django/Invoice/views.py
+++ b/django/Invoice/views.py
@@ -59,7 +59,7 @@ def show_customer(request):
if request.method =="POST":
customer_name = request.POST.get("customerreffullname")
print(f'customer_name: {customer_name}')
- context['objects'] = [['abc', 'def', 'ghi', 'jkl']]
+ # context['objects'] = [['abc', 'def', 'ghi', 'jkl']]
context['objects'] = []
if customer_name:
@@ -73,8 +73,11 @@ def show_customer(request):
open_sales_orders = ini.get_open_so()
print(f'open sales orders:{open_sales_orders}')
ini=None
- if open_sales_orders:
- context['objects'] = open_sales_orders
+ if not open_sales_orders:
+ messages.info(request, f"There is No open SO for {customer_name}")
+ return redirect("Invoice:show_customer")
+ # if open_sales_orders:
+ context['objects'] = open_sales_orders
context['customer_fullname'] = customer_name
@@ -331,9 +334,11 @@ def save_inv(request):
print(result)
if result and ini.status_ok(result):
pass
-
- messages.success(request, 'Invoice Has Been SAVED')
+ # context['messages']=[{"alert":"info", "message": "invoice Is Good"}]
+ messages.success(request, f"Invoice No: Has Been SAVED with link SO No. : {unique(df['RefNumber'].to_list())}")
+ # messages.info(request, 'Invoice Has Been SAVED2')
return redirect('Invoice:show_customer')
+ return render(request, "Invoice/show-customers.html", context)
return render(request, "Invoice/so_details_form.html", context)
else:
return HttpResponse(f"You cannot Save, because There Is No Open Sales Order for Customer: {customer_fullname}")
diff --git a/django/templates/base.html b/django/templates/base.html
index 4b510de..bbd81bf 100644
--- a/django/templates/base.html
+++ b/django/templates/base.html
@@ -8,8 +8,8 @@
-
-
+