Bug #11227
openBug #11115: In product quotation flow , without payment successfull pickup order email came and content of email need to change
InvoiceNumber error
100%
Description
❌ Socket disconnected: Cz9uu-cawPOXeqMpAAAB
🛎️ [Socket] Client lRDe1dzhgLcPiLn9AAAF joining room: terminal:EG-TCEQ
Failed to create invoice: MongoServerError: E11000 duplicate key error collection: evergreen.productinvoices index: invoiceNumber_1 dup key: { invoiceNumber: "PI_0002" }
at InsertOneOperation.execute (C:\Users\Lenovo\Desktop\pos main\evergreen_pos_be\node_modules\mongodb\lib\operations\insert.js:51:19)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async tryOperation (C:\Users\Lenovo\Desktop\pos main\evergreen_pos_be\node_modules\mongodb\lib\operations\execute_operation.js:207:20)
at async executeOperation (C:\Users\Lenovo\Desktop\pos main\evergreen_pos_be\node_modules\mongodb\lib\operations\execute_operation.js:75:16)
at async Collection.insertOne (C:\Users\Lenovo\Desktop\pos main\evergreen_pos_be\node_modules\mongodb\lib\collection.js:157:16) {
errorLabelSet: Set(0) {},
errorResponse: {
index: 0,
code: 11000,
errmsg: 'E11000 duplicate key error collection: evergreen.productinvoices index: invoiceNumber_1 dup key: { invoiceNumber: "PI_0002" }',
keyPattern: { invoiceNumber: 1 },
keyValue: { invoiceNumber: 'PI_0002' }
},
index: 0,
code: 11000,
keyPattern: { invoiceNumber: 1 },
keyValue: { invoiceNumber: 'PI_0002' }
}
GET /api/v1/nus-order/coupon/pos-available 304 225.757 ms - -
POST /api/v1/product-quotation/accept-quote/ecc4766d4c46285c2722c87749b504ddfa80d4dc75b6f02502e9be2259fa1cc8?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYk5hbWUiOiJldmVyZ3JlZW4iLCJxdW90ZUlkIjoiNmFiZTNiYmMzZDVhMTdiNWMxZjI2NTllIiwiaWF0IjoxNzkwODUyMDMzLCJleHAiOjE3OTM0NDQwMzN9.QHpg52TeDPdIn9a24v6dI-nI0c6W3zHd0UVb_JAoZnI 200 43200.820 ms - 361
GET /accept-product-quote/:token {
token: 'ecc4766d4c46285c2722c87749b504ddfa80d4dc75b6f02502e9be2259fa1cc8',
dbName: 'evergreen'
}
Product quotation loaded – {
quoteNumber: 'PQ_1070',
expires: 2026-10-31T10:53:48.676Z,
productCount: 1
}
GET /api/v1/product-quotation/accept-product-quotation/ecc4766d4c46285c2722c87749b504ddfa80d4dc75b6f02502e9be2259fa1cc8?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYk5hbWUiOiJldmVyZ3JlZW4iLCJxdW90ZUlkIjoiNmFiZTNiYmMzZDVhMTdiNWMxZjI2NTllIiwiaWF0IjoxNzkwODUyMDMzLCJleHAiOjE3OTM0 in
{
_id: ObjectId('6ab4a76105018992a2cf4c2b'),
invoiceNumber: 'PI_0723',
quoteId: ObjectId('6ab4a74505018992a2cf4b37'),
saleId: 'e7f47af6-c31d-4d39-a4d2-df929e9df093',
customer: ObjectId('6989aaf0e9d967b13e034676'),
products: [
{
productId: 'dc448125-61fa-4d44-bd72-3af91c6f8e9d',
productName: 'Brown River 2-4 inches',
quantity: NumberInt('1'),
price: NumberInt('150'),
total: NumberInt('150'),
_id: ObjectId('6ab4a76105018992a2cf4c2c')
}
],
totalAmount: NumberInt('150'),
taxAmount: NumberInt('0'),
discountAmount: NumberInt('0'),
deliveryCharge: NumberInt('0'),
finalAmount: NumberInt('150'),
remainingBalance: NumberInt('0'),
status: 'paid',
invoices: [
{
amount: NumberInt('150'),
type: 'full',
status: 'paid',
paymentMode: 'cash',
ByCustomer: false,
creditTax: NumberInt('0'),
_id: ObjectId('6ab4a76105018992a2cf4c2d'),
chequeNumber: null,
paidAt: ISODate('2026-09-24T04:31:03.197Z')
}
],
createdBy: ObjectId('69fae2bdadd6a3a411d948c8'),
dueDate: ISODate('2026-10-01T04:30:25.565Z'),
packageCreated: false,
excludeTax: false,
creditTax: NumberInt('0'),
createdAt: ISODate('2026-09-24T04:30:25.571Z'),
updatedAt: ISODate('2026-09-24T04:30:25.571Z'),
paymentHistory: [
{
amount: NumberInt('150'),
paymentMethod: 'cash',
paidAt: ISODate('2026-09-24T04:31:05.509Z'),
processedBy: ObjectId('69fae2bdadd6a3a411d948c8'),
_id: ObjectId('6ab4a78905018992a2cf4c8b')
}
],
__v: NumberInt('1')
}
invoice Id's are miss match with the db and code.. ? how the invoice id is showing 2 but in the db it is PI_0723
Subtasks
Related issues
Updated by Divya Inapakurthi about 14 hours ago
- Status changed from New to Resolved
- % Done changed from 0 to 100