@David Tandberg-Johansen As far as I can see, both the alternatives described in the documentation should work. I agree that the first example is not the best, it was probably written before the suggest-option came to life. We've had more than one way of suggesting values, the deprecated one is marked as such in the documentation. The latest suggest method is here, also used in the alternatives mentioned above. As for sometimes having the same voucherno and sometimes not, it should depend on whether the voucherno balances or not. As long as the voucherno does not balance, the same voucherno is used on the next line. When the voucher is in balance, the next voucherno is suggested etc. I usually use this example to test batch/voucher-creation with suggested values, try it out and let me know what you think:
mutation CreateBatch ($cid: Int, $batchId: Int = 0) {
useCompany(no: $cid){
batch_create(
values: [
{
voucherSeriesNo: 1,
valueDate: 20230926
description: "Test suggest"
}])
{ affectedRows
items { batchNo @export(as: "batchId")}
}
voucher_create(
values: [{
batchNo: $batchId
valueDate: null
voucherDate: null
voucherType: null
voucherNo: null
text: "first line"
amountDomestic: 1300
creditAccountNo:4300 },
{
batchNo: $batchId
valueDate: null
voucherDate: null
voucherType: null
voucherNo: null
text: "second line"
amountDomestic: 1300
debitAccountNo: 4300 },
{
batchNo: $batchId
valueDate: null
voucherDate: null
voucherType: null
voucherNo: null
text: "third line"
amountDomestic: 500
debitAccountNo: 4300 }])
{affectedRows
items{
batchNo
voucherNo
}
}
}
}
... View more