* refactor: repost error handling (cherry picked from commitafc5a55a23) * test: dependent GL entry reposting (cherry picked from commita2af2daca7) # Conflicts: # erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py * fix: dependent GLE reposting (cherry picked from commitecdb49314f) # Conflicts: # erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.json # erpnext/stock/stock_ledger.py * test: repost queue progress (cherry picked from commit8f519545b0) * test: use disposable item codes in tests dependency causes flake (cherry picked from commitd2882ea436) * fix: correct sorting while updating bin (cherry picked from commitb24920c0e9) # Conflicts: # erpnext/stock/doctype/bin/bin.py * fix: sort stock vouchers before reposting GLE (cherry picked from commit700e864d90) * test: discard local future SLE cache between tests (cherry picked from commit9734329094) * chore: conflicts Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
import unittest
|
||||
|
||||
import frappe
|
||||
from frappe.test_runner import make_test_objects
|
||||
|
||||
from erpnext.accounts.party import get_party_shipping_address
|
||||
from erpnext.accounts.utils import get_future_stock_vouchers, get_voucherwise_gl_entries
|
||||
from erpnext.accounts.utils import (
|
||||
get_future_stock_vouchers,
|
||||
get_voucherwise_gl_entries,
|
||||
sort_stock_vouchers_by_posting_date,
|
||||
)
|
||||
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.stock_entry.stock_entry_utils import make_stock_entry
|
||||
|
||||
|
||||
class TestUtils(unittest.TestCase):
|
||||
@@ -47,6 +54,25 @@ class TestUtils(unittest.TestCase):
|
||||
msg="get_voucherwise_gl_entries not returning expected GLes",
|
||||
)
|
||||
|
||||
def test_stock_voucher_sorting(self):
|
||||
vouchers = []
|
||||
|
||||
item = make_item().name
|
||||
|
||||
stock_entry = {"item": item, "to_warehouse": "_Test Warehouse - _TC", "qty": 1, "rate": 10}
|
||||
|
||||
se1 = make_stock_entry(posting_date="2022-01-01", **stock_entry)
|
||||
se2 = make_stock_entry(posting_date="2022-02-01", **stock_entry)
|
||||
se3 = make_stock_entry(posting_date="2022-03-01", **stock_entry)
|
||||
|
||||
for doc in (se1, se2, se3):
|
||||
vouchers.append((doc.doctype, doc.name))
|
||||
|
||||
vouchers.append(("Stock Entry", "Wat"))
|
||||
|
||||
sorted_vouchers = sort_stock_vouchers_by_posting_date(list(reversed(vouchers)))
|
||||
self.assertEqual(sorted_vouchers, vouchers)
|
||||
|
||||
|
||||
ADDRESS_RECORDS = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user