Skip to content

Commit

Permalink
test: fetching of previous sle (#26352)
Browse files Browse the repository at this point in the history
  • Loading branch information
nextchamp-saqib committed Jul 6, 2021
1 parent a62f943 commit f9e9d86
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_item_cost_reposting(self):
)

# _Test Item for Reposting transferred from Stores to FG warehouse on 30-04-2020
make_stock_entry(
se = make_stock_entry(
item_code="_Test Item for Reposting",
source="Stores - _TC",
target="Finished Goods - _TC",
Expand All @@ -64,29 +64,29 @@ def test_item_cost_reposting(self):
posting_date='2020-04-30',
posting_time='14:00'
)
target_wh_sle = get_previous_sle({
target_wh_sle = frappe.db.get_value('Stock Ledger Entry', {
"item_code": "_Test Item for Reposting",
"warehouse": "Finished Goods - _TC",
"posting_date": '2020-04-30',
"posting_time": '14:00'
})
"voucher_type": "Stock Entry",
"voucher_no": se.name
}, ["valuation_rate"], as_dict=1)

self.assertEqual(target_wh_sle.get("valuation_rate"), 150)

# Repack entry on 5-5-2020
repack = create_repack_entry(company=company, posting_date='2020-05-05', posting_time='14:00')

finished_item_sle = get_previous_sle({
finished_item_sle = frappe.db.get_value('Stock Ledger Entry', {
"item_code": "_Test Finished Item for Reposting",
"warehouse": "Finished Goods - _TC",
"posting_date": '2020-05-05',
"posting_time": '14:00'
})
"voucher_type": "Stock Entry",
"voucher_no": repack.name
}, ["incoming_rate", "valuation_rate"], as_dict=1)
self.assertEqual(finished_item_sle.get("incoming_rate"), 540)
self.assertEqual(finished_item_sle.get("valuation_rate"), 540)

# Reconciliation for _Test Item for Reposting at Stores on 12-04-2020: Qty = 50, Rate = 150
create_stock_reconciliation(
sr = create_stock_reconciliation(
item_code="_Test Item for Reposting",
warehouse="Stores - _TC",
qty=50,
Expand All @@ -109,12 +109,12 @@ def test_item_cost_reposting(self):
self.assertEqual(target_wh_sle.get("valuation_rate"), 175)

# Check valuation rate of repacked item after back-dated entry at Stores
finished_item_sle = get_previous_sle({
finished_item_sle = frappe.db.get_value('Stock Ledger Entry', {
"item_code": "_Test Finished Item for Reposting",
"warehouse": "Finished Goods - _TC",
"posting_date": '2020-05-05',
"posting_time": '14:00'
})
"voucher_type": "Stock Entry",
"voucher_no": repack.name
}, ["incoming_rate", "valuation_rate"], as_dict=1)
self.assertEqual(finished_item_sle.get("incoming_rate"), 790)
self.assertEqual(finished_item_sle.get("valuation_rate"), 790)

Expand Down

0 comments on commit f9e9d86

Please sign in to comment.