test: serial no valuation test case
This commit is contained in:
parent
fcc885bc16
commit
5d27a7672e
@ -11,6 +11,7 @@ from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delive
|
|||||||
from erpnext.stock.doctype.item.test_item import make_item
|
from erpnext.stock.doctype.item.test_item import make_item
|
||||||
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
|
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
|
||||||
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
|
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
|
||||||
|
from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
|
||||||
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
|
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
|
||||||
from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
|
from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
|
||||||
|
|
||||||
@ -22,6 +23,10 @@ from erpnext.tests.utils import ERPNextTestCase
|
|||||||
|
|
||||||
|
|
||||||
class TestSerialNo(ERPNextTestCase):
|
class TestSerialNo(ERPNextTestCase):
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
frappe.db.rollback()
|
||||||
|
|
||||||
def test_cannot_create_direct(self):
|
def test_cannot_create_direct(self):
|
||||||
frappe.delete_doc_if_exists("Serial No", "_TCSER0001")
|
frappe.delete_doc_if_exists("Serial No", "_TCSER0001")
|
||||||
|
|
||||||
@ -211,7 +216,28 @@ class TestSerialNo(ERPNextTestCase):
|
|||||||
|
|
||||||
self.assertEqual(se.get("items")[0].serial_no, "_TS1\n_TS2\n_TS3\n_TS4 - 2021")
|
self.assertEqual(se.get("items")[0].serial_no, "_TS1\n_TS2\n_TS3\n_TS4 - 2021")
|
||||||
|
|
||||||
frappe.db.rollback()
|
def test_correct_serial_no_incoming_rate(self):
|
||||||
|
""" Check correct consumption rate based on serial no record.
|
||||||
|
"""
|
||||||
|
item_code = "_Test Serialized Item"
|
||||||
|
warehouse = "_Test Warehouse - _TC"
|
||||||
|
serial_nos = ["LOWVALUATION", "HIGHVALUATION"]
|
||||||
|
|
||||||
|
in1 = make_stock_entry(item_code=item_code, to_warehouse=warehouse, qty=1, rate=42,
|
||||||
|
serial_no=serial_nos[0])
|
||||||
|
in2 = make_stock_entry(item_code=item_code, to_warehouse=warehouse, qty=1, rate=113,
|
||||||
|
serial_no=serial_nos[1])
|
||||||
|
|
||||||
|
out = create_delivery_note(item_code=item_code, qty=1, serial_no=serial_nos[0], do_not_submit=True)
|
||||||
|
|
||||||
|
# change serial no
|
||||||
|
out.items[0].serial_no = serial_nos[1]
|
||||||
|
out.save()
|
||||||
|
out.submit()
|
||||||
|
|
||||||
|
value_diff = frappe.db.get_value("Stock Ledger Entry",
|
||||||
|
{"voucher_no": out.name, "voucher_type": "Delivery Note"},
|
||||||
|
"stock_value_difference"
|
||||||
|
)
|
||||||
|
self.assertEqual(value_diff, -113)
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
frappe.db.rollback()
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user