diff --git a/api/logics.py b/api/logics.py index 5f2cd31c..97c921ca 100644 --- a/api/logics.py +++ b/api/logics.py @@ -484,9 +484,14 @@ class Logics: @classmethod def update_invoice(cls, order, user, invoice): - + + # Empty invoice? + if not invoice: + return False, { + "bad_invoice": + "You submitted an empty invoice" + } # only the buyer can post a buyer invoice - if not cls.is_buyer(order, user): return False, { "bad_request": diff --git a/api/views.py b/api/views.py index 45795f8b..3b49a2ab 100644 --- a/api/views.py +++ b/api/views.py @@ -459,7 +459,7 @@ class OrderView(viewsets.ViewSet): ) # 2) If action is 'update invoice' - if action == "update_invoice" and invoice: + if action == "update_invoice": valid, context = Logics.update_invoice(order, request.user, invoice) if not valid: