I’m importing data from our previous system into ErpNext via API and I’ve gotten to landed cost vouchers. This one is giving me a perplexing error messge:
“Item must be added using ‘Get Items from Purchase Receipts’ button”
This seems to imply creating a LCV from API is impossible as it requires a UI interaction?
I’m trying a POST at this endpoint: /api/resource/Landed Cost Voucher
With the example body:
{
"posting_date": "2024-12-11",
"company": "Company",
"distribute_charges_based_on": "Amount",
"custom_mv_number": "TSH 1745",
"custom_sb_id": 535,
"custom_mv_id": 16754,
"custom_mv_status": "Closed",
"custom_sb_supplier_id": "1104",
"custom_payment_method": "None",
"purchase_receipts": [
{
"receipt_document_type": "Purchase Receipt",
"receipt_document": "MAT-PRE-2025-01765"
}
],
"items": [
{
"receipt_document_type": "Purchase Receipt",
"purchase_receipt": "MAT-PRE-2025-01765",
"item_code": "Q-2231"
},
{
"receipt_document_type": "Purchase Receipt",
"purchase_receipt": "MAT-PRE-2025-01765",
"item_code": "Q-2222"
}
],
"applicable_charges": [
{
"expense_account": "Expenses Included In Valuation - SGS",
"description": "Tariff - Tariff fee ",
"amount": 32.33
},
{
"expense_account": "Expenses Included In Valuation - SGS",
"description": "Shipping-D - Shipping (Domestic)",
"amount": 6.99
}
]
}
These are all pointing to specific other documents that already exist. Is there any workaround to programmatically create these without having to push a physical button for each one?