My Products
Help
Magnus Vadla
PARTNER

Inconsistency in voucher_create mutation

by Magnus Vadla

Hello,

 

I am trying to figure out how Nxt behaves when I omit the field debit/creditAccountType on voucher_create values.

I made a simple batch and voucher create mutation that worked fine for one nxt company, but when I tried it with another companyId I got an error message "Error: Supplier 7519 does not exist.". If the solution is to always provide the accountType along with accountNo then so be it, but it would be nice to understand what happens in the backend.

 

The mutation I used:

 

mutation create_batch_and_vouchers($batchno: Int = 0) {
  useCompany(no: 123456) {
    batch_create(
      values: [{voucherSeriesNo: 500, valueDate: 20240602, description: "testfile"}]
    ) {
      items {
        batchNo @export(as: "batchno")
      }
    }
    voucher_create(
      values: [
        {
          batchNo: $batchno, 
          amountDomestic: 14296.19, 
          debitAccountNo: 7519, 
          valueDate: 20240602, 
          voucherDate: 20240601, 
          voucherType: 50
        }, 
        {
          batchNo: $batchno,
          amountDomestic: 14296.19,
          creditAccountNo: 2920, 
          valueDate: 20240602, 
          voucherDate: 20240601, 
          voucherType: 50
        }]
      suggest: {voucherNo: true}
    ) {
      affectedRows
    }
  }
}

 

1 REPLY 1

by Øyvind Årseth

Hi @Magnus Vadla 
I'm not able to reproduce with your example, so I am inclined to think the result depends on something in the company data. 
It should not be necessary to set the accountType, but something leads to the assumption that 7519 is a supplier for some reason. 

NB! Be aware you are using a deprecated way of suggesting voucher numbers.