@@ -1801,6 +1801,47 @@ def test_stock_reco_with_opening_stock_with_diff_inventory(self):
18011801 elif s .id_plant == plant_b .name :
18021802 self .assertEqual (s .actual_qty , 3 )
18031803
1804+ def test_serial_no_status_with_backdated_stock_reco (self ):
1805+ from erpnext .stock .doctype .delivery_note .test_delivery_note import create_delivery_note
1806+
1807+ item_code = self .make_item (
1808+ "Test Item" ,
1809+ {
1810+ "is_stock_item" : 1 ,
1811+ "has_serial_no" : 1 ,
1812+ "serial_no_series" : "SERIAL.###" ,
1813+ },
1814+ ).name
1815+
1816+ warehouse = "_Test Warehouse - _TC"
1817+
1818+ reco = create_stock_reconciliation (
1819+ item_code = item_code ,
1820+ posting_date = add_days (nowdate (), - 2 ),
1821+ warehouse = warehouse ,
1822+ qty = 1 ,
1823+ rate = 80 ,
1824+ purpose = "Opening Stock" ,
1825+ )
1826+
1827+ serial_no = get_serial_nos_from_bundle (reco .items [0 ].serial_and_batch_bundle )[0 ]
1828+
1829+ create_delivery_note (
1830+ item_code = item_code , warehouse = warehouse , qty = 1 , rate = 100 , posting_date = nowdate ()
1831+ )
1832+
1833+ self .assertEqual (frappe .get_value ("Serial No" , serial_no , "status" ), "Delivered" )
1834+
1835+ reco = create_stock_reconciliation (
1836+ item_code = item_code ,
1837+ posting_date = add_days (nowdate (), - 1 ),
1838+ warehouse = warehouse ,
1839+ qty = 1 ,
1840+ rate = 90 ,
1841+ )
1842+
1843+ self .assertEqual (frappe .get_value ("Serial No" , serial_no , "status" ), "Delivered" )
1844+
18041845
18051846def create_batch_item_with_batch (item_name , batch_id ):
18061847 batch_item_doc = create_item (item_name , is_stock_item = 1 )
0 commit comments