My Products
Help
Kjetil Ringstad
PARTNER

NonStock items on purchasereceipts results in errors

by Kjetil Ringstad

Hi

When placing NonStock items on purchaseReceipts the following error occurs:

{
"message": "Error creating 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"
}

 

This works well in the GUI, but when adding to purchaseReceipts "manually" this error occurs.

 

Please see the attached json file as example.

13 REPLIES 13
erik-kle
PARTNER

by erik-kle

Was the issues ever resolved?

 

I still get this error when trying to post a purchasereceipt with non-stock items. 

Sigbjørn Eide
CONTRIBUTOR ***

by Sigbjørn Eide

Don't think so. Hopefully this will be resolved in the new v2 endpoint for purchaseReceipt POST planned to be released in Q1.

Sigbjørn Eide
CONTRIBUTOR ***

by Sigbjørn Eide

This problem was repported a year ago in the old forum but never resolved. In the old post it is also stated the following from your (Visma) side: "In further testing, we can see that even when using "actions" to link the documents, trying to update the line returns "Account cannot be empty" even when included." 

For multiple reasons using actions to create PurchaseReceipts is not an acceptable solution.

Please reopen the issue (if closed) to get this fixed through the normal /controller/api/v1/PurchaseReceipt POST endpoint and give us a status on when we can expect this to work. Our customers are  getting pretty impatient about all the flaws in creating  PurchaseReceipts through the API.

Yıldırım
VISMA

by Yıldırım (Updated ‎20-01-2021 15:41 by Yıldırım VISMA )

Hello, this has been conveyed to the development team when the mentioned issue arisen. The case is still open, we've once again emphasized that Transaction sent via Purchase Receipt Endpoint should be able to make correct linkage between Order <> Receipt and able to add Purchase Order Line/s containing non-stock items. 

Currently, we don't have information about when & how this will be fixed. We're following that, and we will provide further updates when we receive.

Thanks.

 

 

Yıldırım
VISMA

by Yıldırım (Updated ‎12-01-2021 13:57 by Yıldırım VISMA )

Hello, 

Please use the following endpoint for adding Purchase Order Lines to the Purchase Receipt after creating an empty receipt. 

Purchase Receipt <https://integration.visma.net/API-index/>
POline.png

 

e.g. 
POST:  https://integration.visma.net/API/controller/api/v1/PurchaseReceipt/<receiptNumber>
/action/addpurcha...

 

{
  "purchaseOrderLines": [
    {
      "orderNbr": "000006",
        "lines": [
	    {
		"lineNbr": "1"
	    },
	    {
		 "lineNbr": "2"
	    },
	    {
		  "lineNbr": "3"
	    }
	]
    },
    {
    	"orderNbr": "000007",
    	"lines": [
	    {
		"lineNbr": "1"
	    }
	 ]
    }
  ]
}

 

 

 

 

Kjetil Ringstad
PARTNER

Please see this thread https://community.visma.com/t5/Forum-in-Developers-Visma-net/addPurchaseOrderLines-and-purchaserecei...  where you recommend NOT to do it that way due to addPurchaseOrderLines having faults when dealing with serial numbers.

It's related to that case since we receive data with both serial numbers and also with nonstock items. Please advise.

Accepted solution
Yıldırım
VISMA

by Yıldırım (Updated ‎12-01-2021 14:35 by Yıldırım VISMA )

Unfortunately, in this case, this is not possible to complete the described transaction. Adding PO lines within Purchase Receipt Endpoint, that operation would not work with Stock-Item as its reported here (Also would cause data connection issues in the UI), therefore, specifically exposed endpoint needs to be used. 

poReceiptUpdateDto > Model
2021-01-12 14_04_26-Window.png



Consequently, this case should be resolved before the desired operation can be handled via the API: addPurchaseOrderLines and purchasereceipts with serial no

erik-kle
PARTNER

by erik-kle (Updated ‎07-12-2021 08:29 by erik-kle PARTNER )

When i use "addPurchaseOrderLines" for Non-stock items and subsequently PUT an update for receiptQty on the lines, the same error as in the thread start appear. So i find it impossible to use the purchaseReceipt endpoints for non-stock items. Is that correct, or im I missing something?

Yıldırım
VISMA

by Yıldırım (Updated ‎07-12-2021 10:42 by Yıldırım VISMA )

We're able to add a Purchase Order Line with a non-stock item to the Purchase Receipt.

1) POST - Purchase Receipt > https://integration.visma.net/API/controller/api/v1/PurchaseReceipt

{
    "receiptType": {
        "value": "PoReceipt"
    },
    "supplierId": {
        "value": "00005" <Replace with your data>
    },
      "date": {
    "value": "2021-07-12"
  }
}

2) POST > .../api/v1/PurchaseReceipt/000079/action/addpurchaseorderlines
2021-12-07 10_42_11-Window.jpg

{
  "purchaseOrderLines": [
    {
      "orderNbr": "000132", <Replace with your data>
      "lines": [
        {
          "lineNbr": "1"
        }
      ]
    }
  ]
}

 
Reference "Purchase Order":
Make sure, used non-stock item's "Require Receipt" flag is checked and Purchase Order Line > Account has a value.

purchaseOrder_added.jpg

 

Financials UI- Purchase Receipt
PurchaseReceipt.jpg

erik-kle
PARTNER

by erik-kle

Yes that works, but can you update receiptQty in a subseqent PUT request after you have added the lines?

Yıldırım
VISMA

by Yıldırım (Updated ‎07-12-2021 10:56 by Yıldırım VISMA )

Yes, original ReceiptQTY was 5 (As defined in the linked Purchase Order Line <orderQty>)


PUT > .../controller/api/v1/PurchaseReceipt/000079

{
    "ReceiptType": {
        "value": "PoReceipt"
    },
    "lines": [
        {
            "operation": "Update",
            "lineNbr": {
                "value": 1
            },
            "transactionDescription": {
                "value": "UpdateReceiptQTY"
            },
            "receiptQty": {
        "value": 7
      }
        }
    ]
}

 

receiptyQTY.jpg

 

Linked Purchase Order Line's ReceiptQty has also been updated accordingly.
PurchaseOrder.jpg

erik-kle
PARTNER

by erik-kle

Magic 🙂 This is exactly what i have been testing, but i get the 'Account' cannot be empty error instead. Ill make new tests tomorrow to figure out what im doing wrong. 

 

Thanks for the help 🙂

Yıldırım
VISMA

by Yıldırım

Hei Erik, no problem 🙂 Might be related to the Non-stock item's properties so if you could share the details of the Purchase Order / Receipt and the Inventory via developersupport@visma.com after testing then we can check this out together again. Cheers !