Error Asset Depr Posting

I found this error this morning.


{'retry': 0, 'log': <function log at 0x7fda14a2c050>, 'site': u'', 'event': u'daily', 'method_name': u'erpnext.accounts.doctype.asset.depreciation.post_depreciation_entries', 'method': <function post_depreciation_entries at 0x7fda14a2c9b0>, 'user': u'Administrator', 'kwargs': {}, 'async': True, 'job_name': u'erpnext.accounts.doctype.asset.depreciation.post_depreciation_entries'}
Traceback (most recent call last):
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/", line 61, in execute_job
  File "/home/erpnext/frappe-bench/apps/erpnext/erpnext/accounts/doctype/asset/", line 14, in post_depreciation_entries
    make_depreciation_entry(asset, date)
  File "/home/erpnext/frappe-bench/apps/erpnext/erpnext/accounts/doctype/asset/", line 61, in make_depreciation_entry
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/", line 723, in submit
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/", line 712, in _submit
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/", line 223, in save
    return self._save(*args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/", line 242, in _save
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/", line 189, in insert
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/", line 753, in run_before_save_methods
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/", line 651, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/", line 858, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/", line 841, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/", line 645, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/erpnext/erpnext/accounts/doctype/journal_entry/", line 42, in validate
    self.title = self.get_title()
  File "/home/erpnext/frappe-bench/apps/erpnext/erpnext/accounts/doctype/journal_entry/", line 55, in get_title
    return self.pay_to_recd_from or self.accounts[0].account
IndexError: list index out of range

I have 8 asset items that were to have depreciation entries made yesterday 3/9. I have 12 coming up on 3/13. Any idea what caused this error?

Sorry for the issue, and thanks for reporting it. We will soon check into it and get back to you. @nabinhait please check.

@umair - ok so this is a defect in the function? so i need to manually do the depr entries?

For now, please book Depreciation via Journal Entry. If issue is resolved before 3/13, then you should have Journal Entry auto-created for those assets.

Thanks. So I see I have to do it fully manual. If I try and press the “Make Depreciation Entry” button from the depreciation schedule table I get same error.

Have you entered depreciation related accounts correctly in the Company?

Seems like you have entered same account in Depreciation Expense Account and Accumulated Depreciation Account field, which is causing the issue.

@nabinhait - thanks for the reply. So this is interesting. I do have entries there for the company in quesiton

However, I have more than one accumulated depreciation and regular depreciation account in my chart of accounts to match the asset categories so what is listed at the company record is not really correct.

Everything is really set on the asset category on what accounts to use. The script should leverage these records based on the company and asset category off of the asset itself and not worry about what is set in company.

I would say any capital intensive company will need to have more than one account for the various types of assets and the single value in the company record does not support that, but the way the asset category handles it works fine.

What are your thoughts about changing the way the function looks up the accounts?


I think the system primarily uses the accounts defined in the Asset Category and only falls back to the Company record if there are no values found there

@nabinhait could you please confirm?


Kind regards,

@James_Robertson @wale Yes, for getting depreciation related accounts, system first checks into Asset Category and if not found fetch from Company.

Regarding the error, basically it is coming because while creating Journal Entry system did not found any rows in the Journal Entry. It is mostly due to, there is no debit/credit amount set in those rows, which causes clearing those rows on saving the Journal Entry.

Can you check if there is Depreciation Amount mentioned in all the rows in the Depreciation Schedule of the concerned Asset?

ok so this is starting to make some sense. The assets in question that produced the error are already supposed to be fully depreciated existing assets, but ERP created a bunch of records

So how do I remove those table records? The asset is fully depreciated, but I still need to account for it in inventory.

@nabinhait any thoughts on this? As a workaround I set the assets to have a gross purchase amount of $0.60 so that every month $0.01 will be depreciated. The script will run tomorrow and I will see how that works. I see system created JV’s however for other accumulated depr records on other assets with a non-zero value for the depreciation amount so I am thinking that a penny per month with work. However, this is not really accurate. I would think that if I check “existing asset” then I would have a lot more control on how depreciation entries are or are not entered by the system.