Skip to content

Commit

Permalink
perf: asset depreciation entry posting [develop] (#36555)
Browse files Browse the repository at this point in the history
* perf: optimise post_depreciation_entries and make_depreciation_entry

* chore: fixing minor mistake

* chore: fix asset_value_adjustment test
  • Loading branch information
anandbaburajan committed Aug 9, 2023
1 parent 5740942 commit ad33cd7
Show file tree
Hide file tree
Showing 4 changed files with 251 additions and 98 deletions.
8 changes: 5 additions & 3 deletions erpnext/assets/doctype/asset/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,9 @@ def get_default_finance_book_idx(self):

@frappe.whitelist()
def get_manual_depreciation_entries(self):
(_, _, depreciation_expense_account) = get_depreciation_accounts(self)
(_, _, depreciation_expense_account) = get_depreciation_accounts(
self.asset_category, self.company
)

gle = frappe.qb.DocType("GL Entry")

Expand Down Expand Up @@ -821,10 +823,10 @@ def get_asset_account(account_name, asset=None, asset_category=None, company=Non
def make_journal_entry(asset_name):
asset = frappe.get_doc("Asset", asset_name)
(
fixed_asset_account,
_,
accumulated_depreciation_account,
depreciation_expense_account,
) = get_depreciation_accounts(asset)
) = get_depreciation_accounts(asset.asset_category, asset.company)

depreciation_cost_center, depreciation_series = frappe.get_cached_value(
"Company", asset.company, ["depreciation_cost_center", "series_for_depreciation_entry"]
Expand Down
Loading

0 comments on commit ad33cd7

Please sign in to comment.