My Products
Help
Magnus Vadla
PARTNER

Unable to update account on PO line

by Magnus Vadla

I have a PO line with a non-stock item, default cost account 4200. I try to update it with a PUT request and the following payload. I get a 204 response, but the line account is still 4200.

{
  "lines": [
    {
      "operation": "Update",
      "lineNumber": {
        "value": 1
      },
      "account": {
        "value": "4080"
      }
    }
  ]
}
 
If I change the account to 4081 in the GUI and resend the same request, the account defaults back to 4200. 
 
Is this a bug? Do I have to replace the line to achieve my goal?
4 REPLIES 4
Magnus Vadla
PARTNER

by Magnus Vadla

Hello,

 

We ran into a problem here. The work around we implemented was to delete the original line, and then insert a new one, for example like this: PUT https://integration.visma.net/API/controller/api/v1/purchaseOrder/

{
   "lines": [
      {
         "operation": "Insert",
         "project": {
            "value": "58"
         },
         "projectTask": {
            "value": "100"
         },
         "warehouse": {
            "value": "P"
         },
         "account": {
            "value": "4010"
         },
         "orderQty": {
            "value": 1
         },
         "inventory": {
            "value": "02"
         }
      }
   ]
}

 The problem is when the nonStock inventoryItem '02' has a default account which is not part of a project accounting group. In that case I get "Error: Inserting 'Purchase order line' record raised at least one error. Please review the errors.\r\nError: 'Project' cannot be empty". Was it always like this? I am pretty sure this worked a couple months ago, but I can't find anything related in the patch notes.

 

The reason the default account needs to not be project enabled is that otherwise the default project is null which is very frustrating for the user.

Magnus Vadla
PARTNER

by Magnus Vadla

Sounds good.

If it gets flagged as a bug, do you have an idea of when it might be fixed? Its a key part of a customer solution we are building at the moment. Should I just go the replace line route?

Accepted solution
Magnus Johnsen
VISMA

Hi,

Unfortunately, we can't provide an ETA right now. We'll continue to update this thread when we have more information.

For the moment, that sounds like the best workaround. 

by Magnus Johnsen

Hi,

We can confirm that sending a PUT with accountNumber resets the lines field to the default value of the non-stock item.

We'll continue testing and report this to the development team. 

Thank you.