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

This commit is contained in:
Nabin Hait
2024-03-02 19:06:48 +05:30
parent ffd04b3960
commit 5fcf8c588a
2 changed files with 5 additions and 7 deletions

View File

@@ -428,7 +428,7 @@ class Asset(AccountsController):
schedule_date = get_last_day(schedule_date) schedule_date = get_last_day(schedule_date)
# if asset is being sold # 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) from_date = self.get_from_date_for_disposal(finance_book)
depreciation_amount, days, months = self.get_pro_rata_amt( depreciation_amount, days, months = self.get_pro_rata_amt(
finance_book, finance_book,

View File

@@ -157,7 +157,6 @@ def get_depreciation_cost_center_and_depreciation_series_for_company():
return res return res
@frappe.whitelist() @frappe.whitelist()
def make_depreciation_entry( def make_depreciation_entry(
asset_name, asset_name,
@@ -210,9 +209,7 @@ def make_depreciation_entry(
debit_account, debit_account,
accounting_dimensions, accounting_dimensions,
) )
frappe.db.commit()
except Exception as e: except Exception as e:
frappe.db.rollback()
depreciation_posting_error = e depreciation_posting_error = e
asset.set_status() asset.set_status()
@@ -474,6 +471,7 @@ def depreciate_asset(asset, date):
make_depreciation_entry(asset.name, date) make_depreciation_entry(asset.name, date)
asset.reload()
cancel_depreciation_entries(asset, date) cancel_depreciation_entries(asset, date)