diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py index 77640db976..aac6cd386c 100644 --- a/erpnext/stock/doctype/batch/batch.py +++ b/erpnext/stock/doctype/batch/batch.py @@ -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() diff --git a/erpnext/stock/doctype/stock_entry/stock_entry_utils.py b/erpnext/stock/doctype/stock_entry/stock_entry_utils.py index cf1032c5ac..c5c0cefe51 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 @@ def make_stock_entry(**args): ) 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 b9c57c1ecf..71baf9f53f 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 @@ 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)