fix(Asset): Add function to clear old depreciation schedule
This commit is contained in:
parent
54cbc8324a
commit
bd336c7d8e
@ -176,13 +176,8 @@ class Asset(AccountsController):
|
||||
|
||||
for d in self.get('finance_books'):
|
||||
self.validate_asset_finance_books(d)
|
||||
|
||||
start = 0
|
||||
for n in range(len(self.schedules)):
|
||||
if not self.schedules[n].journal_entry:
|
||||
del self.schedules[n:]
|
||||
start = n
|
||||
break
|
||||
|
||||
start = self.clear_depreciation_schedule()
|
||||
|
||||
if d.value_after_depreciation:
|
||||
value_after_depreciation = (flt(d.value_after_depreciation) -
|
||||
@ -296,6 +291,15 @@ class Asset(AccountsController):
|
||||
"finance_book_id": d.idx
|
||||
})
|
||||
|
||||
def clear_depreciation_schedule(self):
|
||||
start = 0
|
||||
for n in range(len(self.schedules)):
|
||||
if not self.schedules[n].journal_entry:
|
||||
del self.schedules[n:]
|
||||
start = n
|
||||
break
|
||||
return start
|
||||
|
||||
def check_is_pro_rata(self, row):
|
||||
has_pro_rata = False
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user