Handle TypeError raised in an invoice for generic product

Case: No VM_ID exists and hence int(vm_id) raises TypeError
This commit is contained in:
PCoder 2019-11-15 21:10:12 +05:30
parent a423dd9f49
commit 1e57eb5fae

View file

@ -1268,6 +1268,10 @@ class InvoiceDetailView(LoginRequiredMixin, DetailView):
context['vm']['total_price'] = (
price + vat - discount['amount']
)
except TypeError:
logger.error("Type error. Probably we "
"came from a generic product. "
"Invoice ID %s" % obj.invoice_id)
except WrongIdError:
logger.error("WrongIdError while accessing "
"invoice {}".format(obj.invoice_id))