Skip to content

Commit

Permalink
fix: fixed depreciation calculation as per income tax act
Browse files Browse the repository at this point in the history
  • Loading branch information
khushi8112 committed Aug 5, 2024
1 parent 38739be commit 8df1079
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions erpnext/assets/doctype/asset/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,16 @@ def _make_depreciation_schedule(
final_number_of_depreciations = cint(finance_book.total_number_of_depreciations) - cint(
self.number_of_depreciations_booked
)
has_pro_rata = self.check_is_pro_rata(finance_book)
for_income_tax = 0
if frappe.db.has_column("Finance Book", "for_income_tax"):
for_income_tax = frappe.db.get_value("Finance Book", finance_book.finance_book, "for_income_tax")
has_pro_rata = False
if not for_income_tax:
has_pro_rata = self.check_is_pro_rata(finance_book)
depr_already_booked = any(
[d.journal_entry for d in self.get("schedules") if d.finance_book == finance_book.finance_book]
)
if has_pro_rata and not depr_already_booked:
if has_pro_rata and not depr_already_booked and not for_income_tax:
final_number_of_depreciations += 1

has_wdv_or_dd_non_yearly_pro_rata = False
Expand Down Expand Up @@ -517,10 +522,13 @@ def _make_depreciation_schedule(
)

# Adjust depreciation amount in the last period based on the expected value after useful life
if (
n == cint(final_number_of_depreciations) - 1
and flt(value_after_depreciation) != flt(finance_book.expected_value_after_useful_life)
) or flt(value_after_depreciation) < flt(finance_book.expected_value_after_useful_life):
if not for_income_tax and (
(
n == cint(final_number_of_depreciations) - 1
and flt(value_after_depreciation) != flt(finance_book.expected_value_after_useful_life)
)
or flt(value_after_depreciation) < flt(finance_book.expected_value_after_useful_life)
):
depreciation_amount += flt(value_after_depreciation) - flt(
finance_book.expected_value_after_useful_life
)
Expand Down

0 comments on commit 8df1079

Please sign in to comment.