fix: do not hide primary-action for composite asset

(cherry picked from commit 482efee6c0)

# Conflicts:
#	erpnext/assets/doctype/asset/asset.json
This commit is contained in:
khushi8112
2025-12-18 16:43:26 +05:30
committed by Mergify
parent 8ef09c0dc0
commit 569571c135
2 changed files with 61 additions and 3 deletions

View File

@@ -80,6 +80,12 @@ frappe.ui.form.on("Asset", {
}
},
before_submit: function (frm) {
if (frm.doc.is_composite_asset && !frm.has_active_capitalization) {
frappe.throw(__("Please capitalize this asset before submitting."));
}
},
refresh: function (frm) {
frappe.ui.form.trigger("Asset", "is_existing_asset");
frm.toggle_display("next_depreciation_date", frm.doc.docstatus < 1);
@@ -201,8 +207,7 @@ frappe.ui.form.on("Asset", {
},
callback: function (r) {
if (!r.message) {
$(".primary-action").prop("hidden", true);
$(".form-message").text(__("Capitalize this asset to confirm"));
$(".form-message").text(__("Capitalize this asset before submitting."));
frm.add_custom_button(__("Capitalize Asset"), function () {
frm.trigger("create_asset_capitalization");
@@ -542,7 +547,6 @@ frappe.ui.form.on("Asset", {
callback: function (r) {
var doclist = frappe.model.sync(r.message);
frappe.set_route("Form", doclist[0].doctype, doclist[0].name);
$(".primary-action").prop("hidden", false);
},
});
},

View File

@@ -551,8 +551,58 @@
"fieldname": "purchase_invoice_item",
"fieldtype": "Data",
"hidden": 1,
<<<<<<< HEAD
"label": "Purchase Invoice Item",
"options": "Purchase Invoice Item"
=======
"label": "Purchase Invoice Item"
},
{
"fieldname": "insurance_details_tab",
"fieldtype": "Tab Break",
"label": "Insurance"
},
{
"fieldname": "other_info_tab",
"fieldtype": "Tab Break",
"label": "Other Info"
},
{
"fieldname": "connections_tab",
"fieldtype": "Tab Break",
"label": "Connections",
"show_dashboard": 1
},
{
"fieldname": "depreciation_tab",
"fieldtype": "Tab Break",
"label": "Depreciation"
},
{
"fieldname": "accounting_dimensions_section",
"fieldtype": "Section Break",
"label": "Accounting Dimensions"
},
{
"fieldname": "section_break_jtou",
"fieldtype": "Section Break",
"label": "Additional Info"
},
{
"default": "0",
"depends_on": "eval:(!doc.is_existing_asset && !doc.is_composite_asset)",
"fieldname": "is_composite_component",
"fieldtype": "Check",
"label": "Is Composite Component"
},
{
"fieldname": "net_purchase_amount",
"fieldtype": "Currency",
"label": "Net Purchase Amount",
"mandatory_depends_on": "eval:(!doc.is_composite_asset || doc.docstatus==1)",
"options": "Company:company:default_currency",
"read_only_depends_on": "eval: doc.is_composite_asset"
>>>>>>> 482efee6c0 (fix: do not hide primary-action for composite asset)
}
],
"idx": 72,
@@ -596,7 +646,11 @@
"link_fieldname": "target_asset"
}
],
<<<<<<< HEAD
"modified": "2025-11-17 18:01:51.417942",
=======
"modified": "2025-12-18 16:36:40.904246",
>>>>>>> 482efee6c0 (fix: do not hide primary-action for composite asset)
"modified_by": "Administrator",
"module": "Assets",
"name": "Asset",