mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-06 21:59:13 +00:00
Merge pull request #50088 from khushi8112/composite-component-depr-jv-cancellation-issue
fix: skip auto-cancel of depreciation for components during asset capitalization
This commit is contained in:
@@ -507,6 +507,7 @@ 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()
|
||||||
|
if not frappe.flags.is_composite_component:
|
||||||
cancel_depreciation_entries(asset_doc, date)
|
cancel_depreciation_entries(asset_doc, date)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -492,6 +492,8 @@ 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
|
||||||
|
try:
|
||||||
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(
|
||||||
@@ -500,6 +502,8 @@ class AssetCapitalization(StockController):
|
|||||||
)
|
)
|
||||||
depreciate_asset(asset, self.posting_date, notes)
|
depreciate_asset(asset, self.posting_date, notes)
|
||||||
asset.reload()
|
asset.reload()
|
||||||
|
finally:
|
||||||
|
frappe.flags.is_composite_component = False
|
||||||
|
|
||||||
fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(
|
fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(
|
||||||
asset,
|
asset,
|
||||||
|
|||||||
Reference in New Issue
Block a user