test: fix expected test failures
diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
index 86af0a0..2ffe127 100644
--- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
+++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
@@ -200,7 +200,6 @@
def test_stock_reco_for_batch_item(self):
to_delete_records = []
- to_delete_serial_nos = []
# Add new serial nos
item_code = "Stock-Reco-batch-Item-1"
@@ -208,20 +207,22 @@
sr = create_stock_reconciliation(item_code=item_code,
warehouse = warehouse, qty=5, rate=200, do_not_submit=1)
- sr.save(ignore_permissions=True)
+ sr.save()
sr.submit()
- self.assertTrue(sr.items[0].batch_no)
+ batch_no = sr.items[0].batch_no
+ self.assertTrue(batch_no)
to_delete_records.append(sr.name)
sr1 = create_stock_reconciliation(item_code=item_code,
- warehouse = warehouse, qty=6, rate=300, batch_no=sr.items[0].batch_no)
+ warehouse = warehouse, qty=6, rate=300, batch_no=batch_no)
args = {
"item_code": item_code,
"warehouse": warehouse,
"posting_date": nowdate(),
"posting_time": nowtime(),
+ "batch_no": batch_no,
}
valuation_rate = get_incoming_rate(args)
@@ -230,7 +231,7 @@
sr2 = create_stock_reconciliation(item_code=item_code,
- warehouse = warehouse, qty=0, rate=0, batch_no=sr.items[0].batch_no)
+ warehouse = warehouse, qty=0, rate=0, batch_no=batch_no)
stock_value = get_stock_value_on(warehouse, nowdate(), item_code)
self.assertEqual(stock_value, 0)
diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py
index cacec40..2dd2664 100644
--- a/erpnext/stock/stock_ledger.py
+++ b/erpnext/stock/stock_ledger.py
@@ -751,6 +751,7 @@
self.wh_data.stock_value += stock_value_difference
else:
outgoing_rate = get_batch_incoming_rate(item_code=sle.item_code, warehouse=sle.warehouse, batch_no=sle.batch_no, posting_date=sle.posting_date, posting_time=sle.posting_time, creation=sle.creation)
+ # TODO: negative stock handling
stock_value_difference = outgoing_rate * actual_qty
self.wh_data.stock_value += stock_value_difference