From b2973fc2539b5810c5ac7b59afc6bf38a7400099 Mon Sep 17 00:00:00 2001 From: Sourav Singh Date: Sun, 31 May 2026 05:22:43 +0530 Subject: [PATCH] fix(cart): keep separate lines per batch for batch-tracked items Cart merge matched item_code + UOM only, so a second batch overwrote the first line and only one batch reached the Sales Invoice. Match lines by batch_no, add ERPNext-aligned auto-allocation for multi-batch qty, and scope cart update/remove to the correct batch line. Fixes #266 --- POS/src/components/sale/BatchSerialDialog.vue | 108 ++++++++++++++- POS/src/components/sale/InvoiceCart.vue | 16 +-- POS/src/composables/useInvoice.js | 54 ++++++-- POS/src/pages/POSSale.vue | 36 ++++- POS/src/stores/posCart.js | 35 +++-- pos_next/api/items.py | 124 ++++++++++++++++++ 6 files changed, 337 insertions(+), 36 deletions(-) diff --git a/POS/src/components/sale/BatchSerialDialog.vue b/POS/src/components/sale/BatchSerialDialog.vue index f4f09899a..424853e91 100644 --- a/POS/src/components/sale/BatchSerialDialog.vue +++ b/POS/src/components/sale/BatchSerialDialog.vue @@ -29,8 +29,32 @@
+
+
+
+ {{ __('Requested') }}: {{ requestedQty }} + | + {{ __('Available') }}: {{ totalAvailableQty }} + + ({{ __("{0} batches", [availableBatches.length]) }}) + +
+ +
+

{{ allocationError }}

+
+
{{ __('Exp: {0}', [formatDate(batch.expiry_date)]) }} + + {{ __('Max {0} from this batch', [batch.qty]) }} +
@@ -188,7 +215,7 @@ @@ -198,7 +225,7 @@