fix: split expected jv entries for scrap asset

This commit is contained in:
Gursheen Anand 2023-11-08 00:46:52 +05:30
parent 68c6ad6036
commit 291a499124
2 changed files with 13 additions and 4 deletions

View File

@ -356,7 +356,7 @@ def save_entries(gl_map, adv_adj, update_outstanding, from_repost=False):
process_debit_credit_difference(gl_map) process_debit_credit_difference(gl_map)
if 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) is_opening = any(d.get("is_opening") == "Yes" for d in gl_map)
if gl_map[0]["voucher_type"] != "Period Closing Voucher": if gl_map[0]["voucher_type"] != "Period Closing Voucher":
validate_against_pcv(is_opening, gl_map[0]["posting_date"], gl_map[0]["company"]) 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, partial_cancel=partial_cancel,
) )
validate_accounting_period(gl_entries) 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) 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"]) validate_against_pcv(is_opening, gl_entries[0]["posting_date"], gl_entries[0]["company"])

View File

@ -256,7 +256,16 @@ class TestAsset(AssetSetup):
flt(18000.0 + pro_rata_amount, asset.precision("gross_purchase_amount")), flt(18000.0 + pro_rata_amount, asset.precision("gross_purchase_amount")),
0.0, 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", "_Test Gain/Loss on Asset Disposal - _TC",
flt(82000.0 - pro_rata_amount, asset.precision("gross_purchase_amount")), flt(82000.0 - pro_rata_amount, asset.precision("gross_purchase_amount")),
@ -267,7 +276,7 @@ class TestAsset(AssetSetup):
gle = frappe.db.sql( gle = frappe.db.sql(
"""select account, debit, credit from `tabGL Entry` """select account, debit, credit from `tabGL Entry`
where voucher_type='Journal Entry' and voucher_no = %s where voucher_type='Journal Entry' and voucher_no = %s
order by account""", order by account, credit""",
asset.journal_entry_for_scrap, asset.journal_entry_for_scrap,
) )
self.assertSequenceEqual(gle, expected_gle) self.assertSequenceEqual(gle, expected_gle)