From 6f64a78ecfd927d142d7059c53c98fc4f4f2815c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 19 Oct 2015 14:46:36 +0530 Subject: [PATCH] Test case fixed for swtiching valuation method --- .../doctype/delivery_note/test_delivery_note.py | 17 ++++++++++++++++- .../test_stock_reconciliation.py | 4 ++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py index 3aaefaf855..07308e6c30 100644 --- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py @@ -336,7 +336,7 @@ class TestDeliveryNote(unittest.TestCase): qty=100, rate=100) create_stock_reconciliation(item_code="_Test Item Home Desktop 100", target=warehouse, qty=100, rate=100) - + opening_qty_test_warehouse_1 = get_qty_after_transaction(warehouse="_Test Warehouse 1 - _TC") dn = create_delivery_note(item_code="_Test Product Bundle Item", @@ -352,6 +352,21 @@ class TestDeliveryNote(unittest.TestCase): self.assertEquals(actual_qty, opening_qty_test_warehouse_1 + 25) # stock value diff for source warehouse + # for "_Test Item" + stock_value_difference = frappe.db.get_value("Stock Ledger Entry", + {"voucher_type": "Delivery Note", "voucher_no": dn.name, + "item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC"}, + "stock_value_difference") + + # stock value diff for target warehouse + stock_value_difference1 = frappe.db.get_value("Stock Ledger Entry", + {"voucher_type": "Delivery Note", "voucher_no": dn.name, + "item_code": "_Test Item", "warehouse": "_Test Warehouse 1 - _TC"}, + "stock_value_difference") + + self.assertEquals(abs(stock_value_difference), stock_value_difference1) + + # for "_Test Item Home Desktop 100" stock_value_difference = frappe.db.get_value("Stock Ledger Entry", {"voucher_type": "Delivery Note", "voucher_no": dn.name, "item_code": "_Test Item Home Desktop 100", "warehouse": "_Test Warehouse - _TC"}, diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py index 1c6be1f3df..947a0935aa 100644 --- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py @@ -119,8 +119,8 @@ def set_valuation_method(item_code, valuation_method): for warehouse in frappe.get_all("Warehouse", filters={"company": "_Test Company"}): update_entries_after({ - "item_code": item_code, - "warehouse": warehouse + "item_code": item_code, + "warehouse": warehouse.name }, allow_negative_stock=1) test_dependencies = ["Item", "Warehouse"]