Merge pull request #40246 from nabinhait/depreciation-asset-sale
fix: Book depreciation until the asset disposal date and removed unwanted commits
This commit is contained in:
@@ -430,7 +430,7 @@ class Asset(AccountsController):
|
||||
schedule_date = get_last_day(schedule_date)
|
||||
|
||||
# if asset is being sold
|
||||
if date_of_disposal:
|
||||
if date_of_disposal and getdate(schedule_date) >= getdate(date_of_disposal):
|
||||
from_date = self.get_from_date_for_disposal(finance_book)
|
||||
depreciation_amount, days, months = self.get_pro_rata_amt(
|
||||
finance_book,
|
||||
|
||||
@@ -210,9 +210,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()
|
||||
@@ -474,6 +472,7 @@ def depreciate_asset(asset, date):
|
||||
|
||||
make_depreciation_entry(asset.name, date)
|
||||
|
||||
asset.reload()
|
||||
cancel_depreciation_entries(asset, date)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user