Martijn Nosyncerror
Martijn Nosyncerror

Reputation: 192

Document attribute stays empty for Invoice class

When trying to fetch the SalesInvoices class from the Exact Online REST API all the relevant document entries stay empty. I'm using the Exact Online Python SDK for fetching these SalesInvoices.

The code used:

return self.api.invoices.filter(
    filter="Customer eq guid'{}'".format(self.api.relations.get(relation_code=relation_code)['ID']),
    top=10,
    orderby='EntryNumber desc')

Which gives the following response:

"Document": null,
"DocumentNumber": null,
"DocumentSubject": null,

While the SalesInvoice does have a generated document:

invoice

I have contacted Exact Online support but so far have gotten no reply

Upvotes: 0

Views: 233

Answers (1)

Guido Leenders
Guido Leenders

Reputation: 4262

See picture. The Document, DocumentNumber and DocumentSubject are available in ExactOnlineREST..SalesInvoices:

SalesInvoice with Document

But... the evil is in the detail, because documentation reads:

Document that is manually linked to the invoice

And indeed, this field only gets a value when you manually add a document to the invoice such as before printing it.

When you need all documents and files attached to the sales invoice, please use something like:

select dat.url
from   salesinvoices sie
join   exactonlinerest..documents dct
on     dct.salesinvoicenumber = sie.invoicenumber
and    dct.type=10 /* Optional to improve performance. */
join   ExactOnlineREST.Documents.DocumentAttachments dat
on     dat.document = dct.id

Please change this into Python code, but the syntax and join order and arguments are clear.

Upvotes: 1

Related Questions