From 291a4991246b5a53491066eb46efda0de2a8002f Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Wed, 8 Nov 2023 00:46:52 +0530 Subject: [PATCH] fix: split expected jv entries for scrap asset --- erpnext/accounts/general_ledger.py | 4 ++-- erpnext/assets/doctype/asset/test_asset.py | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py index 2f721c8013..70a8470614 100644 --- a/erpnext/accounts/general_ledger.py +++ b/erpnext/accounts/general_ledger.py @@ -356,7 +356,7 @@ def save_entries(gl_map, adv_adj, update_outstanding, from_repost=False): process_debit_credit_difference(gl_map) if gl_map: - # check_freezing_date(gl_map[0]["posting_date"], adv_adj) + check_freezing_date(gl_map[0]["posting_date"], adv_adj) is_opening = any(d.get("is_opening") == "Yes" for d in gl_map) if gl_map[0]["voucher_type"] != "Period Closing Voucher": validate_against_pcv(is_opening, gl_map[0]["posting_date"], gl_map[0]["company"]) @@ -593,7 +593,7 @@ def make_reverse_gl_entries( partial_cancel=partial_cancel, ) validate_accounting_period(gl_entries) - # check_freezing_date(gl_entries[0]["posting_date"], adv_adj) + check_freezing_date(gl_entries[0]["posting_date"], adv_adj) is_opening = any(d.get("is_opening") == "Yes" for d in gl_entries) validate_against_pcv(is_opening, gl_entries[0]["posting_date"], gl_entries[0]["company"]) diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index 9e3ec6faa8..536845ed26 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -256,7 +256,16 @@ class TestAsset(AssetSetup): flt(18000.0 + pro_rata_amount, asset.precision("gross_purchase_amount")), 0.0, ), - ("_Test Fixed Asset - _TC", 0.0, 100000.0), + ( + "_Test Fixed Asset - _TC", + 0.0, + flt(18000.0 + pro_rata_amount, asset.precision("gross_purchase_amount")), + ), + ( + "_Test Fixed Asset - _TC", + 0.0, + flt(82000.0 - pro_rata_amount, asset.precision("gross_purchase_amount")), + ), ( "_Test Gain/Loss on Asset Disposal - _TC", flt(82000.0 - pro_rata_amount, asset.precision("gross_purchase_amount")), @@ -267,7 +276,7 @@ class TestAsset(AssetSetup): gle = frappe.db.sql( """select account, debit, credit from `tabGL Entry` where voucher_type='Journal Entry' and voucher_no = %s - order by account""", + order by account, credit""", asset.journal_entry_for_scrap, ) self.assertSequenceEqual(gle, expected_gle)