Fix empty invoice unhandled error

This commit is contained in:
Reckless_Satoshi 2022-05-28 06:05:26 -07:00
parent b67e671b89
commit f304fa27f9
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
2 changed files with 8 additions and 3 deletions

View File

@ -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":

View File

@ -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: