mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-14 23:18:40 +00:00
fix(asset): allow asset repair creation for fully depreciated assets
(cherry picked from commit c7774a95e5)
# Conflicts:
# erpnext/assets/doctype/asset/asset.js
# erpnext/assets/doctype/asset_repair/asset_repair.json
This commit is contained in:
committed by
Mergify
parent
2e72d22328
commit
e2e4f888d2
@@ -94,6 +94,35 @@ frappe.ui.form.on("Asset", {
|
||||
|
||||
if (frm.doc.docstatus == 1) {
|
||||
if (["Submitted", "Partially Depreciated", "Fully Depreciated"].includes(frm.doc.status)) {
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
if (frm.doc.maintenance_required && !frm.doc.maintenance_schedule) {
|
||||
frm.add_custom_button(
|
||||
__("Maintain Asset"),
|
||||
function () {
|
||||
frm.trigger("create_asset_maintenance");
|
||||
},
|
||||
__("Actions")
|
||||
);
|
||||
}
|
||||
if (frm.doc.status === "Fully Depreciated") {
|
||||
frm.add_custom_button(
|
||||
__("Asset Repair"),
|
||||
function () {
|
||||
frm.trigger("create_asset_repair");
|
||||
},
|
||||
__("Actions")
|
||||
);
|
||||
}
|
||||
frm.add_custom_button(
|
||||
__("Split Asset"),
|
||||
function () {
|
||||
frm.trigger("split_asset");
|
||||
},
|
||||
__("Actions")
|
||||
);
|
||||
|
||||
>>>>>>> c7774a95e5 (fix(asset): allow asset repair creation for fully depreciated assets)
|
||||
frm.add_custom_button(
|
||||
__("Transfer Asset"),
|
||||
function () {
|
||||
|
||||
@@ -74,6 +74,15 @@ frappe.ui.form.on("Asset Repair", {
|
||||
};
|
||||
};
|
||||
}
|
||||
if (frm.doc.asset) {
|
||||
frappe.db.get_value("Asset", frm.doc.asset, "status").then(({ message }) => {
|
||||
frm.set_df_property(
|
||||
"capitalize_repair_cost",
|
||||
"read_only",
|
||||
message && message.status === "Fully Depreciated"
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
repair_status: (frm) => {
|
||||
|
||||
@@ -140,7 +140,11 @@
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Asset",
|
||||
<<<<<<< HEAD
|
||||
"link_filters": "[[\"Asset\",\"status\",\"not in\",[\"Work In Progress\",\"Capitalized\",\"Fully Depreciated\",\"Sold\",\"Scrapped\",\"Cancelled\",null]]]",
|
||||
=======
|
||||
"link_filters": "[[\"Asset\",\"status\",\"not in\",[\"Work In Progress\",\"Capitalized\",\"Sold\",\"Scrapped\",\"Cancelled\"]]]",
|
||||
>>>>>>> c7774a95e5 (fix(asset): allow asset repair creation for fully depreciated assets)
|
||||
"options": "Asset",
|
||||
"reqd": 1
|
||||
},
|
||||
@@ -250,8 +254,18 @@
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"is_submittable": 1,
|
||||
<<<<<<< HEAD
|
||||
"links": [],
|
||||
"modified": "2026-01-06 15:48:13.862505",
|
||||
=======
|
||||
"links": [
|
||||
{
|
||||
"link_doctype": "Stock Entry",
|
||||
"link_fieldname": "asset_repair"
|
||||
}
|
||||
],
|
||||
"modified": "2026-06-20 15:43:54.943335",
|
||||
>>>>>>> c7774a95e5 (fix(asset): allow asset repair creation for fully depreciated assets)
|
||||
"modified_by": "Administrator",
|
||||
"module": "Assets",
|
||||
"name": "Asset Repair",
|
||||
|
||||
@@ -77,12 +77,15 @@ class AssetRepair(AccountsController):
|
||||
)
|
||||
|
||||
def validate_asset(self):
|
||||
if self.asset_doc.status in ("Sold", "Fully Depreciated", "Scrapped"):
|
||||
if self.asset_doc.status in ("Sold", "Scrapped"):
|
||||
frappe.throw(
|
||||
_("Asset {0} is in {1} status and cannot be repaired.").format(
|
||||
get_link_to_form("Asset", self.asset), self.asset_doc.status
|
||||
)
|
||||
)
|
||||
if self.asset_doc.get_status() == "Fully Depreciated":
|
||||
self.capitalize_repair_cost = 0
|
||||
self.increase_in_asset_life = 0
|
||||
|
||||
def validate_dates(self):
|
||||
if self.completion_date and (getdate(self.failure_date) > getdate(self.completion_date)):
|
||||
|
||||
Reference in New Issue
Block a user