From 5d16936b9ef9943cee24c03e8bc969d0fcdf9656 Mon Sep 17 00:00:00 2001 From: Khushi Rawat <142375893+khushi8112@users.noreply.github.com> Date: Mon, 17 Mar 2025 12:17:10 +0530 Subject: [PATCH] fix(test): sales invoice test cases --- .../doctype/sales_invoice/test_sales_invoice.py | 10 +++++----- erpnext/assets/doctype/asset/depreciation.py | 1 + erpnext/assets/doctype/asset_repair/asset_repair.py | 1 - 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 1ee6f55801b..d2eed63df73 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -3013,7 +3013,7 @@ class TestSalesInvoice(ERPNextTestSuite): ) asset.load_from_db() - expected_values = [["2020-12-31", 30000, 30000], ["2021-12-31", 30000, 60000]] + expected_values = [["2020-12-31", 30000, 30000], ["2021-12-31", 30041.15, 60041.15]] for i, schedule in enumerate(get_depr_schedule(asset.name, "Active")): self.assertEqual(getdate(expected_values[i][0]), schedule.schedule_date) @@ -3038,10 +3038,10 @@ class TestSalesInvoice(ERPNextTestSuite): expected_values = [ ["2020-06-30", 1366.12, 1366.12, True], ["2021-06-30", 20000.0, 21366.12, True], - ["2022-06-30", 20000.0, 41366.12, False], - ["2023-06-30", 20000.0, 61366.12, False], - ["2024-06-30", 20000.0, 81366.12, False], - ["2025-06-06", 18633.88, 100000.0, False], + ["2022-06-30", 20000.95, 41367.07, False], + ["2023-06-30", 20000.95, 61368.02, False], + ["2024-06-30", 20000.95, 81368.97, False], + ["2025-06-06", 18631.03, 100000.0, False], ] for i, schedule in enumerate(get_depr_schedule(asset.name, "Active")): diff --git a/erpnext/assets/doctype/asset/depreciation.py b/erpnext/assets/doctype/asset/depreciation.py index 3ef116ffa0a..f6ec7bd6c33 100644 --- a/erpnext/assets/doctype/asset/depreciation.py +++ b/erpnext/assets/doctype/asset/depreciation.py @@ -527,6 +527,7 @@ def cancel_depreciation_entries(asset_doc, date): def reset_depreciation_schedule(asset_doc, notes): if asset_doc.calculate_depreciation: reschedule_depreciation(asset_doc, notes) + asset_doc.set_total_booked_depreciations() def reverse_depreciation_entry_made_on_disposal(asset): diff --git a/erpnext/assets/doctype/asset_repair/asset_repair.py b/erpnext/assets/doctype/asset_repair/asset_repair.py index 8bfbb2c7d21..8a4349233e5 100644 --- a/erpnext/assets/doctype/asset_repair/asset_repair.py +++ b/erpnext/assets/doctype/asset_repair/asset_repair.py @@ -242,7 +242,6 @@ class AssetRepair(AccountsController): def make_gl_entries(self, cancel=False): if cancel: self.ignore_linked_doctypes = ("GL Entry", "Stock Ledger Entry") - self.save() if flt(self.total_repair_cost) > 0: gl_entries = self.get_gl_entries()