frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
21.86k stars 7.33k forks source link

Serial and Batch Bundle - batch_no in Stock Ledger Entry table is empty #42997

Closed guilmori closed 1 month ago

guilmori commented 2 months ago

Information about bug

We are currently migrating to version 15 and are encountering issues with the new feature called 'Serial and Batch Bundle'.

When I create a Purchase Receipt for an item with has_batch_no=1 and enter the batch number in the batch_no field, the Purchase Receipt is submitted correctly. However, when I check the Stock Ledger Entry table, the batch_no column is empty.

This is problematic as I have several queries that rely on this column for joins.

Here are my Stock Settings image

I understand that the 'Serial and Batch Bundle' feature was introduced to enhance serial numbers integrity. However, I’m concerned that it may have unintentionally disrupted the previously well-functioning batch management process.

Could you please provide some insight into the reasoning behind applying the 'Serial and Batch Bundle' changes for batches and not just for serials?

Is there a way to disable this feature and maintain the reliable batch management behavior from version 14?

Module

stock

Version

Version 15

Installation method

None

Relevant log output / Stack trace / Full Error Message.

No response

guilmori commented 2 months ago

Could you please provide clarification on the following matter?

Is it expected that the batch_no field in the Stock Ledger Entry table will always remain empty? Even if Use Serial / Batch fields is checked ?

For instance, if I were to run this query, would it be accurate to assume that with version 15, this is not working anymore?

SELECT 
    tabItem.item_name, sle.item_code, tabItem.description, sle.stock_uom, sle.batch_no, sle.warehouse, sum(sle.actual_qty) as qty
FROM `tabStock Ledger Entry` sle
LEFT join tabBatch ON tabBatch.name = sle.batch_no
INNER JOIN tabItem ON tabItem.name = sle.item_code
WHERE warehouse = %(warehouse)s
AND sle.is_cancelled = 0 
GROUP BY sle.item_code, sle.batch_no
HAVING sum(actual_qty) > 0;
rohitwaghchaure commented 1 month ago

Is it expected that the batch_no field in the Stock Ledger Entry table will always remain empty? Even if Use Serial / Batch fields is checked ?

Yes, for that we have added the Serial and Batch Bundle.