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()
|
unpaid_bills = AgencyBills.objects.all()
|
||||||
|
|
||||||
for bill in unpaid_bills:
|
for bill in unpaid_bills:
|
||||||
# Für jede Rechnung eine Anfrage an die LexOffice API und voucherStatus auslesen
|
try:
|
||||||
headers = {
|
# Für jede Rechnung eine Anfrage an die LexOffice API und voucherStatus auslesen
|
||||||
'Authorization': 'Bearer ' + settings.LEX_API,
|
headers = {
|
||||||
'Content-Type': 'application/json',
|
'Authorization': 'Bearer ' + settings.LEX_API,
|
||||||
'Accept': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
}
|
'Accept': 'application/json',
|
||||||
|
}
|
||||||
|
|
||||||
json_data = {}
|
json_data = {}
|
||||||
|
|
||||||
r = requests.get("https://api.lexoffice.io/v1/invoices/"+AgencyBills.objects.get(pk=bill.pk).lexid, data=json_data, headers=headers)
|
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"):
|
if(json.loads(r.text)["voucherStatus"] == "paid"):
|
||||||
bill.billstatus="paid"
|
bill.billstatus="paid"
|
||||||
bill.save()
|
bill.save()
|
||||||
else:
|
else:
|
||||||
bill.billstatus="open"
|
bill.billstatus="open"
|
||||||
bill.save()
|
bill.save()
|
||||||
|
except:
|
||||||
|
mailstatus += "VOUCHERSTATUS ERROR ON BILL " + str(bill.pk)
|
||||||
|
|
||||||
|
|
||||||
# Monatliche Berechnung
|
# Monatliche Berechnung
|
||||||
|
|
@ -1916,6 +1919,7 @@ def cronactionsbill(request, code):
|
||||||
mailstatus,
|
mailstatus,
|
||||||
'noreply@digitale-agentur.com',
|
'noreply@digitale-agentur.com',
|
||||||
["htrampe@gmail.com", "info@digitale-agentur.com"],
|
["htrampe@gmail.com", "info@digitale-agentur.com"],
|
||||||
|
#["htrampe@gmail.com"],
|
||||||
fail_silently=True,
|
fail_silently=True,
|
||||||
)
|
)
|
||||||
return JsonResponse(data)
|
return JsonResponse(data)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue