mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-14 15:11:52 +00:00
fix(asset): apply capitalize_repair_cost read-only toggle on asset change too
Previously only wired to refresh, so selecting an asset in the link field left the field editable until a full page reload even though the server silently zeroes it for fully depreciated assets. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -74,15 +74,22 @@ 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"
|
||||
);
|
||||
});
|
||||
}
|
||||
frm.events.toggle_capitalize_repair_cost(frm);
|
||||
},
|
||||
|
||||
asset: function (frm) {
|
||||
frm.events.toggle_capitalize_repair_cost(frm);
|
||||
},
|
||||
|
||||
toggle_capitalize_repair_cost: function (frm) {
|
||||
if (!frm.doc.asset) return;
|
||||
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) => {
|
||||
|
||||
Reference in New Issue
Block a user