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
diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py
index 77640db..aac6cd3 100644
--- a/erpnext/stock/doctype/batch/batch.py
+++ b/erpnext/stock/doctype/batch/batch.py
@@ -244,7 +244,6 @@
)
)
stock_entry.set_stock_entry_type()
- stock_entry.set_missing_values()
stock_entry.insert()
stock_entry.submit()
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry_utils.py b/erpnext/stock/doctype/stock_entry/stock_entry_utils.py
index cf1032c..c5c0cef 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry_utils.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry_utils.py
@@ -132,7 +132,6 @@
)
s.set_stock_entry_type()
- s.set_missing_values()
if not args.do_not_save:
s.insert()
diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
index b9c57c1..71baf9f 100644
--- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
@@ -1424,6 +1424,25 @@
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)