Eine Fehlerbehandlung bei fehlerhaften Rechnungen dazu
This commit is contained in:
parent
dbb60dbbd4
commit
987efe5f75
Binary file not shown.
|
|
@ -1734,22 +1734,25 @@ def cronactionsbill(request, code):
|
|||
unpaid_bills = AgencyBills.objects.all()
|
||||
|
||||
for bill in unpaid_bills:
|
||||
# Für jede Rechnung eine Anfrage an die LexOffice API und voucherStatus auslesen
|
||||
headers = {
|
||||
'Authorization': 'Bearer ' + settings.LEX_API,
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
}
|
||||
try:
|
||||
# Für jede Rechnung eine Anfrage an die LexOffice API und voucherStatus auslesen
|
||||
headers = {
|
||||
'Authorization': 'Bearer ' + settings.LEX_API,
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
}
|
||||
|
||||
json_data = {}
|
||||
|
||||
r = requests.get("https://api.lexoffice.io/v1/invoices/"+AgencyBills.objects.get(pk=bill.pk).lexid, data=json_data, headers=headers)
|
||||
if(json.loads(r.text)["voucherStatus"] == "paid"):
|
||||
bill.billstatus="paid"
|
||||
bill.save()
|
||||
else:
|
||||
bill.billstatus="open"
|
||||
bill.save()
|
||||
json_data = {}
|
||||
|
||||
r = requests.get("https://api.lexoffice.io/v1/invoices/"+AgencyBills.objects.get(pk=bill.pk).lexid, data=json_data, headers=headers)
|
||||
if(json.loads(r.text)["voucherStatus"] == "paid"):
|
||||
bill.billstatus="paid"
|
||||
bill.save()
|
||||
else:
|
||||
bill.billstatus="open"
|
||||
bill.save()
|
||||
except:
|
||||
mailstatus += "VOUCHERSTATUS ERROR ON BILL " + str(bill.pk)
|
||||
|
||||
|
||||
# Monatliche Berechnung
|
||||
|
|
@ -1916,6 +1919,7 @@ def cronactionsbill(request, code):
|
|||
mailstatus,
|
||||
'noreply@digitale-agentur.com',
|
||||
["htrampe@gmail.com", "info@digitale-agentur.com"],
|
||||
#["htrampe@gmail.com"],
|
||||
fail_silently=True,
|
||||
)
|
||||
return JsonResponse(data)
|
||||
|
|
|
|||
Loading…
Reference in New Issue