mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-13 11:55:11 +00:00
fix: skip auto-cancel of depreciation for components during asset capitalization
This commit is contained in:
@@ -507,7 +507,8 @@ def depreciate_asset(asset_doc, date, notes):
|
|||||||
make_depreciation_entry_for_all_asset_depr_schedules(asset_doc, date)
|
make_depreciation_entry_for_all_asset_depr_schedules(asset_doc, date)
|
||||||
|
|
||||||
asset_doc.reload()
|
asset_doc.reload()
|
||||||
cancel_depreciation_entries(asset_doc, date)
|
if not frappe.flags.is_composite_component:
|
||||||
|
cancel_depreciation_entries(asset_doc, date)
|
||||||
|
|
||||||
|
|
||||||
@erpnext.allow_regional
|
@erpnext.allow_regional
|
||||||
|
|||||||
@@ -492,6 +492,7 @@ class AssetCapitalization(StockController):
|
|||||||
asset = frappe.get_doc("Asset", item.asset)
|
asset = frappe.get_doc("Asset", item.asset)
|
||||||
|
|
||||||
if asset.calculate_depreciation:
|
if asset.calculate_depreciation:
|
||||||
|
frappe.flags.is_composite_component = True
|
||||||
notes = _(
|
notes = _(
|
||||||
"This schedule was created when Asset {0} was consumed through Asset Capitalization {1}."
|
"This schedule was created when Asset {0} was consumed through Asset Capitalization {1}."
|
||||||
).format(
|
).format(
|
||||||
@@ -499,6 +500,7 @@ class AssetCapitalization(StockController):
|
|||||||
get_link_to_form(self.doctype, self.get("name")),
|
get_link_to_form(self.doctype, self.get("name")),
|
||||||
)
|
)
|
||||||
depreciate_asset(asset, self.posting_date, notes)
|
depreciate_asset(asset, self.posting_date, notes)
|
||||||
|
frappe.flags.is_composite_component = False
|
||||||
asset.reload()
|
asset.reload()
|
||||||
|
|
||||||
fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(
|
fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(
|
||||||
|
|||||||
Reference in New Issue
Block a user