mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-09 23:39:28 +00:00
test(stock): add ledger preview unit tests (#58700)
This commit is contained in:
committed by
Sudharsanan11
parent
2932793af0
commit
5edb7e2abc
23
erpnext/controllers/tests/test_ledger_preview.py
Normal file
23
erpnext/controllers/tests/test_ledger_preview.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Copyright (c) 2026, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
|
# See license.txt
|
||||||
|
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
import frappe
|
||||||
|
from frappe.tests import UnitTestCase
|
||||||
|
|
||||||
|
from erpnext.controllers.stock_controller import get_sl_entries_for_preview
|
||||||
|
|
||||||
|
|
||||||
|
class TestLedgerPreview(UnitTestCase):
|
||||||
|
def test_in_out_rate_is_only_set_for_outgoing_entries(self):
|
||||||
|
stock_ledger_entries = [
|
||||||
|
frappe._dict(actual_qty=5, stock_value_difference=10),
|
||||||
|
frappe._dict(actual_qty=-5, stock_value_difference=-15),
|
||||||
|
]
|
||||||
|
|
||||||
|
with patch("frappe.get_all", return_value=stock_ledger_entries):
|
||||||
|
entries = get_sl_entries_for_preview("Delivery Note", "DN-0001", [])
|
||||||
|
|
||||||
|
self.assertIsNone(entries[0].get("in_out_rate"))
|
||||||
|
self.assertEqual(entries[1].in_out_rate, 3)
|
||||||
Reference in New Issue
Block a user