Skip to content

Commit

Permalink
fix: do not make new depreciation for fully depreciated asset
Browse files Browse the repository at this point in the history
(cherry picked from commit 25de412)
  • Loading branch information
khushi8112 authored and mergify[bot] committed Oct 19, 2024
1 parent 03b5d5a commit ddb38db
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions erpnext/accounts/doctype/sales_invoice/sales_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -1359,14 +1359,15 @@ def make_item_gl_entries(self, gl_entries):

else:
if asset.calculate_depreciation:
notes = _(
"This schedule was created when Asset {0} was sold through Sales Invoice {1}."
).format(
get_link_to_form(asset.doctype, asset.name),
get_link_to_form(self.doctype, self.get("name")),
)
depreciate_asset(asset, self.posting_date, notes)
asset.reload()
if not asset.status == "Fully Depreciated":
notes = _(
"This schedule was created when Asset {0} was sold through Sales Invoice {1}."
).format(
get_link_to_form(asset.doctype, asset.name),
get_link_to_form(self.doctype, self.get("name")),
)
depreciate_asset(asset, self.posting_date, notes)
asset.reload()

fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(
asset,
Expand Down

0 comments on commit ddb38db

Please sign in to comment.