fix: Book depreciation until the asset disposal date and removed unwanted commits

(cherry picked from commit dedae4fecf)
This commit is contained in:
Nabin Hait
2024-03-12 12:32:57 +05:30
committed by Mergify
parent a5e6763be5
commit 2d7ff5d4cf
2 changed files with 2 additions and 3 deletions

View File

@@ -242,9 +242,7 @@ def make_depreciation_entry(
debit_account,
accounting_dimensions,
)
frappe.db.commit()
except Exception as e:
frappe.db.rollback()
depreciation_posting_error = e
asset.set_status()
@@ -523,6 +521,7 @@ def depreciate_asset(asset_doc, date, notes):
make_depreciation_entry_for_all_asset_depr_schedules(asset_doc, date)
asset_doc.reload()
cancel_depreciation_entries(asset_doc, date)

View File

@@ -327,7 +327,7 @@ class AssetDepreciationSchedule(Document):
schedule_date = get_last_day(schedule_date)
# if asset is being sold or scrapped
if date_of_disposal:
if date_of_disposal and getdate(schedule_date) >= getdate(date_of_disposal):
from_date = add_months(
getdate(asset_doc.available_for_use_date),
(asset_doc.number_of_depreciations_booked * row.frequency_of_depreciation),