to get a personalized navigation.
to get a personalized navigation.
We are experiencing an error while creating a SalesOrder, this error happens with the V1 and V2 endpoint. It is exactly the same as here but than on SalesOrder level instead of CustomerInvoices.
The situation is as follows:
We have 2 branches branch 1 and 2, and branch 1 is the Main Branch. Branch 1 has Cash account 10 linked and branch 2 has Cash Account 20 linked.
When we create a SalesOrder for branch 2 we expect without posting the property “cashAccount”, it will auto set cash account 20 (because it is linked). Instead, we get the following error:
Error: Inserting 'Sales invoice/note' record raised at least one error. Please review the errors.\r\nError: Cash account '10' cannot found in the system. Check whether you have access rights to this object.\r\n"
Note: it Looks at the cash account that is linked to the main branch (branch 1)
Even of we set the property ‘cashaccount’ to 20 we get the same error. (‘branchid’ header is set to 2 and the properties “branchNumber” on the root of the object and in ‘lines’ array is set to 2.)
When we uncheck the ‘Restrict visibility with branch’ on the cash account that is linked to the main branch (cash account 10). Both scenarios described as above now work, but it is still a bit weird.
If we don't set the property “cash account” it will auto fill this to the cash account that is linked to the main branch (cash account 10). While we insert this salesOrder to branchId 2 we would expect cash account 20. If we set the property “cash account” to 20 it works as intended.
Below a Json request without the cashaccount set:
{
"method": "POST",
"url": "https:\/\/integration.visma.net\/API\/controller\/api\/v1\/salesorder",
"headers": {
"Accept": "application\/json",
"Content-Type": "application\/json",
"ipp-company-id": 10000000000,
"branchid": 2,
"Authorization": ""
},
"body": {
"orderType": {
"value": "IN"
},
"customerOrder": {
"value": "test_value"
},
"customer": {
"value": "00001"
},
"date": {
"value": "2021-12-24"
},
"customerRefNo": {
"value": "00001"
},
"description": {
"value": ""
},
"currency": {
"value": "EUR"
},
"soBillingContact": {
"value": {
"name": {
"value": "Contact name"
},
"email": {
"value": "contactname@example.com"
},
"phone1": {
"value": "06123456789"
}
}
},
"soBillingAddress": {
"value": {
"addressLine1": {
"value": "Address line 1"
},
"postalCode": {
"value": "1234 AB"
},
"city": {
"value": "Amsterdam"
},
"countryId": {
"value": "NL"
}
}
},
"soShippingContact": {
"value": {
"name": {
"value": " Contact name"
},
"email": {
"value": "contactname@example.com"
},
"phone1": {
"value": "0651236267"
}
}
},
"soShippingAddress": {
"value": {
"addressLine1": {
"value": " Address line 1"
},
"postalCode": {
"value": "2345 AC"
},
"city": {
"value": "Rotterdam"
},
"countryId": {
"value": "NL"
}
}
},
"branchNumber": {
"value": 2
},
"lines": [
{
"branchNumber": {
"value": 2
},
"operation": "Insert",
"lineNbr": {
"value": 1
},
"inventoryNumber": {
"value": "118113"
},
"quantity": {
"value": 1
},
"unitPrice": {
"value": 54.5702
}
}
]
}
}
Hello Sierd,
the API is processing the operations as the user being logged in via the main branch, and it seems, omitting the branch value sent in the payload so not allowing cash accounts restricted to different branches.
Have you tried the same operation via POST Salesorder V2 ?
Please also send us your ipp-company-ID <developersupport@visma.com>
Thanks.
Copyright © 2022 Visma.com. All rights reserved.