I have just noticed that, in a very rare case, Warehouse of Serial No is not same as that reflected in Stock Ledger Entry.
I have the following query in order to display problematic Serial Nos:
select a.name, a.warehouse, s.warehouse, s.item_code from (select sum( ent.actual_qty / (LENGTH(TRIM(TRAILING '\n' FROM ent.serial_no)) - LENGTH(REPLACE(TRIM(TRAILING '\n' FROM ent.serial_no), '\n', '')) + 1)) as qty, ent.warehouse, serial.name, serial.item_code, ent.voucher_no from `tabStock Ledger Entry` ent, `tabSerial No` serial where ent.serial_no like concat('%',serial.name,'%') and ent.item_code=serial.item_code group by serial.name, warehouse) a, `tabSerial No` s where a.name=s.name and a.qty>=1 and a.warehouse<>s.warehouse
I am having trouble getting to the root cause of this problem. Where should I look, as one of the cases is unbelievable. I have purchased a Serialized Item at Location A via Purchase Invoice (Update Stock Ticked) and it is showing Location B in its Serial No and surprisingly no Material Transfer or Sales Invoice or Delivery Note has been Created for that Unit.