Skip to content

Commit

Permalink
fix: Retain depreciation schedule rows that are linked with JEs while…
Browse files Browse the repository at this point in the history
… clearing the schedule
  • Loading branch information
GangaManoj committed Nov 23, 2021
1 parent f455de2 commit 33a0b1d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions erpnext/assets/doctype/asset/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@ def clear_depreciation_schedule(self):

for schedule in self.get('schedules'):

# to update start when there are JEs linked with all the schedule rows corresponding to an FB
if len(start) == (int(schedule.finance_book_id) - 2):
start.append(num_of_depreciations_completed)
num_of_depreciations_completed = 0

# to ensure that start will only be updated once for each FB
if len(start) == (int(schedule.finance_book_id) - 1):
if schedule.journal_entry:
Expand All @@ -344,11 +349,6 @@ def clear_depreciation_schedule(self):
start.append(num_of_depreciations_completed)
num_of_depreciations_completed = 0

# to update start when there are JEs linked with all the schedule rows corresponding to an FB
elif len(start) == (int(schedule.finance_book_id) - 2):
start.append(num_of_depreciations_completed)
num_of_depreciations_completed = 0

# to update start when all the schedule rows corresponding to the last FB are linked with JEs
if len(start) == (len(self.finance_books) - 1):
start.append(num_of_depreciations_completed)
Expand Down

0 comments on commit 33a0b1d

Please sign in to comment.