My Products
Help
Florian Haase
PARTNER

Update POReceipts with delete of lines

by Florian Haase

Hei,

 

I try to update POReceipts. That means that I try to delete the existing lines and insert the updated ones. (I do this because delete endpoint is missing):

 

But I cant get this work:

 

Insert of new lines works perfectly:

 

{"lines":[{"operation":"Insert","inventoryId":{"value":"1150"},"transactionDescription":{"value":"Glass og metall fra Næring#Veieseddel: 306650 - dato: 30.09.2020"},"receiptQty":{"value":7.68}}],"receiptType":{"value":"PoReceipt"},"receiptNbr":{"value":"306650"},"hold":{"value":false},"date":{"value":"2020-09-30T09:14:14.117+02:00"},"createBill":{"value":false},"supplierRef":{"value":"bh"}}

 

 

The same json just with the delete:

{"lines":[{"operation":"Delete","lineNbr":{"value":1}},{"operation":"Insert","inventoryId":{"value":"1150"},"transactionDescription":{"value":"Glass og metall fra Næring#Veieseddel: 306650 - dato: 30.09.2020"},"receiptQty":{"value":7.68}}],"receiptType":{"value":"PoReceipt"},"receiptNbr":{"value":"306650"},"hold":{"value":false},"date":{"value":"2020-09-30T09:14:14.117+02:00"},"createBill":{"value":false},"supplierRef":{"value":"bh"}}

 

results in:

Error updating purchase receipt. Error: Inserting 'Purchase receipt line' record raised at least one error. Please review the errors.\\r\\nError: 'Account' cannot be empty.\\r\\nError: 'Sub. ID' cannot be empty.\\r\\n\

 

Regards 

 

Florian

 

13 REPLIES 13
Florian Haase
PARTNER

by Florian Haase

I tried also to set the same information on the delete lines as on the insert lines but I get still the same error-message.

 

Florian

by Magnus Johnsen

Is this poReceipt linked to an order?

And the line that you want to delete, is it the only line in the receipt?

Does this happen when you send the delete by itself as well, or only when you delete one line and add another?

Florian Haase
PARTNER

by Florian Haase

Hei,

 

Line is not connected to anything since we directly import to POReceipts. These receipts are balanced but don't have any connection. They are also marked as no-billing. I have checked - it's not a problem to delete these lines in the UI. It does not seem like the number of lines does matter either. I get the same error if there are three or one lines in the receipts. I did not try to just send the delete (I think that it would not be possible to save an empty receipt without lines)

 

Florian

 

 

by Magnus Johnsen

Alright, could you please send us an example of what you would include in your initial post, and then the put for your request, you can attach this as a text file.

We'll have a look and test this according to your scenario.

Thank you. 

Florian Haase
PARTNER

by Florian Haase

I sent a email with the Json strings

 

Florian

by Magnus Johnsen

Thank you, we'll have a look and get back to you. 

Florian Haase
PARTNER

by Florian Haase

Hi Magnus,

 

whats the status here? 

We got around this by first placing a new line and than delete the old lines instead for first deleting the old lines and than placing the new lines.

 

But now I got completely stock: Our customer wants to change the SupplierId by the API. And that its only possible in the UI when I delete all lines first. How can I handle this? There is missing the DELETE endpoint on the POReceipt and I can't delete the lines either - so its not possible to change the supplier in any way I see. 

 

Any suggestions?

 

Florian

Florian Haase
PARTNER

by Florian Haase

I just wonder if I have really tried to only delete all lines without inserting at the same time. I test this now. This is getting to give many API calls for just 1 update of an POReceipt, but maybe the only solution...

Florian Haase
PARTNER

by Florian Haase

Hi,

 

ok, I am actually able to delete all lines if I set the POReceipt on hold at the same time.

But now I meet the next problem:

 

{
  "message": "Error updating purchase receipt. Update of receipt supplier is not allowed."
}

JSon:

{
"supplierId":{"value":40480}

}

 

That's no problem in the UI so far the POREceipt is on hold and has no lines. 

Can you confirm this as a bug? We have a status meeting with the customer tomorrow, would be nice to have at least a answer...

 

 

Florian

 

 

by Yıldırım

Hello Florian, 

 

As long as Purchase Receipt has no lines & not released, its "SupplierID" can be updated and this should also be viable through the API > PUT request. We confirm the bug, unfortunately, the operation returns the aforementioned error. This has now been conveyed to the development team.

UI.pngpurchase_receipt_PUT_supplier_bug.png

 

 

Florian Haase
PARTNER

by Florian Haase

OK,

 

thanks for confirming,

than I know that we have to get around this in another way. Just now we delete all lines set it on hold and leave it and generate a new running number on the same main number. A lot of coding, but will probably work good enough.

 

Would be so much more easier if we  just could delete the POReceipts through the API.... 🙂

 

Florian

 

 

by Yıldırım (Updated ‎19-11-2020 15:26 by Yıldırım VISMA )

We've also escalated, exposing Delete Operation under Purchase Receipt endpoint as a new idea for the development team's review :  Expose Delete operation via Purchase Receipt Endpoint

 

We're sorry for that the issue put additional workload in the integration. We'll inform you about the bug fix progress.

Florian Haase
PARTNER

by Florian Haase

Thank you, 

great!