I send a data dictionary to an external SOAP API using Zeep.
I did this, and it was working:
my_date = (form.cleaned_data['my_date'])
#This comes from a Django form
data2 = {
"CashBookEntryData": {
"Type" : "FinanceVoucher",
"CashBookHandle" : { "Number" : 1 },
"AccountHandle" : { "Number" : 5820 },
"Date" : my_date,
"VoucherNumber" : 100,
"Text" : "Dagenssalg",
"AmountDefaultCurrency" : 0,
"CurrencyHandle" : { "Code" : "DKK" },
"Amount" : beloeb_salg,
"DepartmentHandle" : { "Number" : 1 }
}
}
To be able to better control how the dict is constructed, I have changed it to this:
data1 =collections.OrderedDict()
data1["CashBookEntryData"] = {}
data1["CashBookEntryData"]["Type"] = "FinanceVoucher"
data1["CashBookEntryData"]["CashBookHandle"] = { "Number" : 1 }
data1["CashBookEntryData"]["AccountHandle"] = { "Number" : 5820 },
data1["CashBookEntryData"]["Date"] = my_date,
data1["CashBookEntryData"]["VoucherNumber"] = 100,
data1["CashBookEntryData"]["Text"] = "Dagenssalg",
data1["CashBookEntryData"]["AmountDefaultCurrency"] = 0,
data1["CashBookEntryData"]["CurrencyHandle"] = { "Code" : "DKK" },
data1["CashBookEntryData"]["Amount"] = 9999,
data1["CashBookEntryData"]["DepartmentHandle"] = { "Number" : 1 }
But now I get a Type Error: combine() argument 1 must be datetime.date, not tuple
Any help is very appreciated! Best Regards Kresten Buch
Edit:
Trying:
dato = form.cleaned_data['dato']
dato = datetime.datetime.strptime(dato, "%Y-%m-%d")
Gives the same error