fix: asset repair link and improve notes
This commit is contained in:
parent
9627b46ee7
commit
61cd0f98fd
@ -487,7 +487,7 @@
|
||||
{
|
||||
"group": "Repair",
|
||||
"link_doctype": "Asset Repair",
|
||||
"link_fieldname": "asset_name"
|
||||
"link_fieldname": "asset"
|
||||
},
|
||||
{
|
||||
"group": "Value",
|
||||
@ -500,7 +500,7 @@
|
||||
"link_fieldname": "asset"
|
||||
}
|
||||
],
|
||||
"modified": "2022-11-25 12:47:19.689702",
|
||||
"modified": "2023-01-16 12:01:00.502301",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Assets",
|
||||
"name": "Asset",
|
||||
|
@ -295,12 +295,12 @@ def reset_depreciation_schedule(asset_doc, date, notes):
|
||||
asset_doc, notes, date_of_return=date
|
||||
)
|
||||
|
||||
modify_depreciation_schedule_for_asset_repairs(asset_doc)
|
||||
modify_depreciation_schedule_for_asset_repairs(asset_doc, notes)
|
||||
|
||||
asset_doc.save()
|
||||
|
||||
|
||||
def modify_depreciation_schedule_for_asset_repairs(asset):
|
||||
def modify_depreciation_schedule_for_asset_repairs(asset, notes):
|
||||
asset_repairs = frappe.get_all(
|
||||
"Asset Repair", filters={"asset": asset.name}, fields=["name", "increase_in_asset_life"]
|
||||
)
|
||||
@ -309,10 +309,6 @@ def modify_depreciation_schedule_for_asset_repairs(asset):
|
||||
if repair.increase_in_asset_life:
|
||||
asset_repair = frappe.get_doc("Asset Repair", repair.name)
|
||||
asset_repair.modify_depreciation_schedule()
|
||||
notes = _("This schedule was created when Asset {0} went through Asset Repair {1}.").format(
|
||||
get_link_to_form(asset.doctype, asset.name),
|
||||
get_link_to_form(asset_repair.doctype, asset_repair.name),
|
||||
)
|
||||
make_new_active_asset_depr_schedules_and_cancel_current_ones(asset, notes)
|
||||
|
||||
|
||||
|
@ -430,7 +430,7 @@ class AssetCapitalization(StockController):
|
||||
|
||||
if asset.calculate_depreciation:
|
||||
notes = _(
|
||||
"This schedule was created when Asset {0} was consumed when Asset Capitalization {1} was submitted."
|
||||
"This schedule was created when Asset {0} was consumed through Asset Capitalization {1}."
|
||||
).format(
|
||||
get_link_to_form(asset.doctype, asset.name), get_link_to_form(self.doctype, self.get("name"))
|
||||
)
|
||||
@ -521,7 +521,7 @@ class AssetCapitalization(StockController):
|
||||
asset_doc.gross_purchase_amount = total_target_asset_value
|
||||
asset_doc.purchase_receipt_amount = total_target_asset_value
|
||||
notes = _(
|
||||
"This schedule was created when target Asset {0} was updated when Asset Capitalization {1} was submitted."
|
||||
"This schedule was created when target Asset {0} was updated through Asset Capitalization {1}."
|
||||
).format(
|
||||
get_link_to_form(asset_doc.doctype, asset_doc.name), get_link_to_form(self.doctype, self.name)
|
||||
)
|
||||
@ -537,7 +537,7 @@ class AssetCapitalization(StockController):
|
||||
if asset.calculate_depreciation:
|
||||
reverse_depreciation_entry_made_after_disposal(asset, self.posting_date)
|
||||
notes = _(
|
||||
"This schedule was created when Asset {0} was restored when Asset Capitalization {1} was cancelled."
|
||||
"This schedule was created when Asset {0} was restored on Asset Capitalization {1}'s cancellation."
|
||||
).format(
|
||||
get_link_to_form(asset.doctype, asset.name), get_link_to_form(self.doctype, self.name)
|
||||
)
|
||||
|
@ -56,8 +56,8 @@ class AssetRepair(AccountsController):
|
||||
):
|
||||
self.modify_depreciation_schedule()
|
||||
|
||||
notes = _("This schedule was created when Asset Repair {0} was submitted.").format(
|
||||
get_link_to_form(self.doctype, self.name)
|
||||
notes = _("This schedule was created when Asset {0} was repaired through Asset Repair {1}.").format(
|
||||
get_link_to_form(self.asset_doc.doctype, self.asset_doc.name), get_link_to_form(self.doctype, self.name)
|
||||
)
|
||||
self.asset_doc.flags.ignore_validate_update_after_submit = True
|
||||
make_new_active_asset_depr_schedules_and_cancel_current_ones(self.asset_doc, notes)
|
||||
@ -80,8 +80,8 @@ class AssetRepair(AccountsController):
|
||||
):
|
||||
self.revert_depreciation_schedule_on_cancellation()
|
||||
|
||||
notes = _("This schedule was created when Asset Repair {0} was cancelled.").format(
|
||||
get_link_to_form(self.doctype, self.name)
|
||||
notes = _("This schedule was created when Asset {0}'s Asset Repair {1} was cancelled.").format(
|
||||
get_link_to_form(self.asset_doc.doctype, self.asset_doc.name), get_link_to_form(self.doctype, self.name)
|
||||
)
|
||||
self.asset_doc.flags.ignore_validate_update_after_submit = True
|
||||
make_new_active_asset_depr_schedules_and_cancel_current_ones(self.asset_doc, notes)
|
||||
|
@ -127,12 +127,20 @@ class AssetValueAdjustment(Document):
|
||||
current_asset_depr_schedule_doc.flags.should_not_cancel_depreciation_entries = True
|
||||
current_asset_depr_schedule_doc.cancel()
|
||||
|
||||
notes = _(
|
||||
"This schedule was created when Asset {0} was adjusted through Asset Value Adjustment {1}."
|
||||
).format(
|
||||
get_link_to_form(asset.doctype, asset.name),
|
||||
get_link_to_form(self.get("doctype"), self.get("name")),
|
||||
)
|
||||
if self.docstatus == 1:
|
||||
notes = _(
|
||||
"This schedule was created when Asset {0} was adjusted through Asset Value Adjustment {1}."
|
||||
).format(
|
||||
get_link_to_form(asset.doctype, asset.name),
|
||||
get_link_to_form(self.get("doctype"), self.get("name")),
|
||||
)
|
||||
elif self.docstatus == 2:
|
||||
notes = _(
|
||||
"This schedule was created when Asset {0}'s Asset Value Adjustment {1} was cancelled."
|
||||
).format(
|
||||
get_link_to_form(asset.doctype, asset.name),
|
||||
get_link_to_form(self.get("doctype"), self.get("name")),
|
||||
)
|
||||
new_asset_depr_schedule_doc.notes = notes
|
||||
|
||||
new_asset_depr_schedule_doc.insert()
|
||||
|
Loading…
x
Reference in New Issue
Block a user