Private
Tracker *Bug Feature Support Testing
Subject *
Description Edit Code Location: vendorInvoiceController.js:L2951, L4697 *What is happening in code:* When vendors are created, they get a human-readable custom code like "vn_100234". Invoices, batches, and purchase orders save vendor_id = "vn_100234". However, API endpoints like getAllVendorInvoices and getVendorProductsAndBatches query the database using the 24-character MongoDB internal ID ("65a8e2..."). *Real-Life Example:* You open the Vendor Details page for "Green Leaf Nursery Ltd" (vn_100234). You click the Invoice History or Batches tab. The frontend asks the backend: "Give me all invoices for vendor 65a8e2f910b2...". The database searches for invoices with vendor_id: "65a8e2f910b2...", but finds zero matches because all invoices have vendor_id: "vn_100234". Business Impact: The screen shows "No Invoices Found" or crashes with a CastError, even though you have 20 invoices on file for that vendor. *Simple Fix:* Standardize all lookups to resolve the vendor document first: const vendorDoc = mongoose.isValidObjectId(vendorId) ? await Vendor.findById(vendorId).select("vendor_id") : await Vendor.findOne({ vendor_id: vendorId }).select("vendor_id"); const resolvedId = vendorDoc ? vendorDoc.vendor_id : vendorId;
Status Resolved
Priority *Low Normal High Immediate
Assignee Ajit ABindu DandaChandra SekharDivya InapakurthiKarthik PalakondaPavan Kumar MuralaRavi Shankar PalleRavindra AtthotaSai MahanandaSai Priyatham SadineniSowjanya atthotaSravani RangannapalemTeja Sriram SanganiYalavarthi Thriveni
Target version Sprint (10/05/2026- 10/09/2026) sprint (10/12/2026 - 10/31/2026) Backlog
Parent task
Start date
Due date
Estimated time Hours
% Done0 % 10 % 20 % 30 % 40 % 50 % 60 % 70 % 80 % 90 % 100 %