fix: Book depreciation until the asset disposal date and removed unwanted commits
(cherry picked from commit dedae4fecf)
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user