From 02a31caa050556408fdae1e8ed5121e2783f4218 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Sat, 3 Aug 2024 09:27:16 +0530 Subject: [PATCH] fix: use get_last_day to get the correct date (backport #42564) (#42602) fix: use get_last_day to get the correct date (#42564) (cherry picked from commit 5d58eb67a6e025811ef0b2f1b96e3a5ccbded336) Co-authored-by: Khushi Rawat <142375893+khushi8112@users.noreply.github.com> --- .../asset_depreciation_schedule.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py b/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py index 02fcb8efb3d..e7b5a25cc73 100644 --- a/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py +++ b/erpnext/assets/doctype/asset_depreciation_schedule/asset_depreciation_schedule.py @@ -729,10 +729,15 @@ def get_daily_depr_amount(asset, row, schedule_idx, amount): ) ), add_days( - add_months( - row.depreciation_start_date, - (row.frequency_of_depreciation * (asset.opening_number_of_booked_depreciations + 1)) - * -1, + get_last_day( + add_months( + row.depreciation_start_date, + ( + row.frequency_of_depreciation + * (asset.opening_number_of_booked_depreciations + 1) + ) + * -1, + ), ), 1, ),