In company 2842554 we have purchase order 000045 with one line with a non-stock item. When creating an invoice by hand in the Visma.net GUI, it would be possible to select a ledger and sub account that differs from the proposed values. We wish to do the same using the API. We created purchase invoice 200354 by posting invoice.json (see below) to /controller/api/v1/supplierInvoice. In the entry line we've chosen ledger account 7120 and sub account 03-91-, which end up in the resulting entry line (screenshot available). Then we updated the invoice using PUT /controller/api/v1/supplierInvoice/Invoice/200354 in which we sent invoice_update.json (see below). The entry is updated and the line is now linked to line 1 of order 000045. The ledger and sub accounts however are reset to the default values 7110 and 02-91- (the values from the purchase order line; screenshot available). The chosen values 7120 and 03-91- should be kept. Is it correct to first create the invoice (invoice.json) and after that link the order/receipt (invoice_update.json)? We do this, because linking the order/receipt line in the initial POST does not work. A workaround was tried to (again) send the ledger and sub account information in the update, but this only works for the sub accounts. invoice.json {
"documentType": {
"value": "Invoice"
},
"date": {
"value": "2020-03-07T00:00:00.000Z"
},
"financialPeriod": {
"value": "202003"
},
"supplierReference": {
"value": "Example invoice"
},
"supplierNumber": {
"value": "30005"
},
"currencyId": {
"value": "EUR"
},
"creditTermsId": {
"value": "30"
},
"description": {
"value": ""
},
"note": {
"value": ""
},
"taxDetailLines": [
{
"taxId": {
"value": "3"
},
"taxableAmount": {
"value": 25
},
"vatAmount": {
"value": 5.25
}
}
],
"invoiceLines": [
{
"operation": "Insert",
"lineNumber": {
"value": 1
},
"transactionDescription": {
"value": "Non-stock item"
},
"inventoryNumber": {
"value": "DIVH"
},
"quantity": {
"value": 1
},
"uom": {
"value": "STUK"
},
"unitCostInCurrency": {
"value": 25
},
"costInCurrency": {
"value": 25
},
"accountNumber": {
"value": "7120"
},
"subaccount": [
{
"segmentId": 1,
"segmentValue": "03"
},
{
"segmentId": 2,
"segmentValue": "91"
}
],
"vatCodeId": {
"value": "1"
},
"projectId": {
"value": "X"
}
}
]
} invoice_update.json {
"invoiceLines": [
{
"operation": "Update",
"lineNumber": {
"value": 1
},
"linkLine": {
"purchaseType": "PurchaseOrder",
"purchaseNumber": {
"value": "000045"
},
"purchaseLineNbr": {
"value": 1
}
}
}
]
}
... View more