test: Test for mapped SE and fix for failing tests
- Remove `set_missing_values` from mapper util function since a lot of item data is set after this function is run - `split_batch` can skip `set_missing_values` since no warehouses are set on mapping and relies on user input
This commit is contained in:
parent
90a8e924f5
commit
4fa15b50ca
@ -244,7 +244,6 @@ def split_batch(batch_no, item_code, warehouse, qty, new_batch_id=None):
|
||||
)
|
||||
)
|
||||
stock_entry.set_stock_entry_type()
|
||||
stock_entry.set_missing_values()
|
||||
stock_entry.insert()
|
||||
stock_entry.submit()
|
||||
|
||||
|
@ -132,7 +132,6 @@ def make_stock_entry(**args):
|
||||
)
|
||||
|
||||
s.set_stock_entry_type()
|
||||
s.set_missing_values()
|
||||
|
||||
if not args.do_not_save:
|
||||
s.insert()
|
||||
|
@ -1424,6 +1424,25 @@ class TestStockEntry(FrappeTestCase):
|
||||
|
||||
self.assertRaises(frappe.ValidationError, se.save)
|
||||
|
||||
def test_mapped_stock_entry(self):
|
||||
"Check if rate and stock details are populated in mapped SE given warehouse."
|
||||
from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_stock_entry
|
||||
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
|
||||
|
||||
item_code = "_TestMappedItem"
|
||||
create_item(item_code, is_stock_item=True)
|
||||
|
||||
pr = make_purchase_receipt(
|
||||
item_code=item_code, qty=2, rate=100, company="_Test Company", warehouse="Stores - _TC"
|
||||
)
|
||||
|
||||
mapped_se = make_stock_entry(pr.name)
|
||||
|
||||
self.assertEqual(mapped_se.items[0].s_warehouse, "Stores - _TC")
|
||||
self.assertEqual(mapped_se.items[0].actual_qty, 2)
|
||||
self.assertEqual(mapped_se.items[0].basic_rate, 100)
|
||||
self.assertEqual(mapped_se.items[0].basic_amount, 200)
|
||||
|
||||
|
||||
def make_serialized_item(**args):
|
||||
args = frappe._dict(args)
|
||||
|
Loading…
x
Reference in New Issue
Block a user