fix: implement coderabbit suggested changes

(cherry picked from commit d1b81b96a5)
This commit is contained in:
khushi8112
2026-02-06 15:56:08 +05:30
parent 194b158e18
commit b619f6d906
3 changed files with 15 additions and 19 deletions

View File

@@ -111,7 +111,10 @@ frappe.ui.form.on("Asset", {
has_create_buttons = true; has_create_buttons = true;
} }
if (!frm.doc.calculate_depreciation) { if (
!frm.doc.calculate_depreciation &&
["Submitted", "Partially Depreciated", "Fully Depreciated"].includes(frm.doc.status)
) {
frm.add_custom_button( frm.add_custom_button(
__("Depreciation Entry"), __("Depreciation Entry"),
function () { function () {
@@ -126,17 +129,17 @@ frappe.ui.form.on("Asset", {
frm.page.set_inner_btn_group_as_primary(__("Create")); frm.page.set_inner_btn_group_as_primary(__("Create"));
} }
if (frm.doc.maintenance_required && !frm.doc.maintenance_schedule) {
frm.add_custom_button(
__("Maintain Asset"),
function () {
frm.trigger("create_asset_maintenance");
},
__("Actions")
);
}
if (["Submitted", "Partially Depreciated", "Fully Depreciated"].includes(frm.doc.status)) { if (["Submitted", "Partially Depreciated", "Fully Depreciated"].includes(frm.doc.status)) {
if (frm.doc.maintenance_required && !frm.doc.maintenance_schedule) {
frm.add_custom_button(
__("Maintain Asset"),
function () {
frm.trigger("create_asset_maintenance");
},
__("Actions")
);
}
frm.add_custom_button( frm.add_custom_button(
__("Split Asset"), __("Split Asset"),
function () { function () {

View File

@@ -448,7 +448,6 @@
}, },
{ {
"default": "0", "default": "0",
"depends_on": "eval:(doc.asset_type == \"Existing Asset\")",
"fieldname": "is_fully_depreciated", "fieldname": "is_fully_depreciated",
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 1, "hidden": 1,

View File

@@ -44,7 +44,6 @@
"cost_center", "cost_center",
"column_break_14", "column_break_14",
"project", "project",
"accounting_dimension_tab",
"connection_tab" "connection_tab"
], ],
"fields": [ "fields": [
@@ -261,11 +260,6 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Accounting Dimension" "label": "Accounting Dimension"
}, },
{
"fieldname": "accounting_dimension_tab",
"fieldtype": "Tab Break",
"label": "Accounting Dimension"
},
{ {
"fieldname": "connection_tab", "fieldname": "connection_tab",
"fieldtype": "Tab Break", "fieldtype": "Tab Break",
@@ -281,7 +275,7 @@
"link_fieldname": "asset_repair" "link_fieldname": "asset_repair"
} }
], ],
"modified": "2026-02-06 02:25:37.536357", "modified": "2026-02-06 14:57:54.257572",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Assets", "module": "Assets",
"name": "Asset Repair", "name": "Asset Repair",