mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 12:19:12 +00:00
fix(Asset): Group buttons under 'Action'
This commit is contained in:
@@ -78,26 +78,6 @@ frappe.ui.form.on('Asset', {
|
|||||||
frm.toggle_display("next_depreciation_date", frm.doc.docstatus < 1);
|
frm.toggle_display("next_depreciation_date", frm.doc.docstatus < 1);
|
||||||
frm.events.make_schedules_editable(frm);
|
frm.events.make_schedules_editable(frm);
|
||||||
|
|
||||||
if (frm.doc.docstatus==1) {
|
|
||||||
if (in_list(["Submitted", "Partially Depreciated", "Fully Depreciated"], frm.doc.status)) {
|
|
||||||
frm.add_custom_button("Transfer Asset", function() {
|
|
||||||
erpnext.asset.transfer_asset(frm);
|
|
||||||
});
|
|
||||||
|
|
||||||
frm.add_custom_button("Scrap Asset", function() {
|
|
||||||
erpnext.asset.scrap_asset(frm);
|
|
||||||
});
|
|
||||||
|
|
||||||
frm.add_custom_button("Sell Asset", function() {
|
|
||||||
frm.trigger("make_sales_invoice");
|
|
||||||
});
|
|
||||||
|
|
||||||
} else if (frm.doc.status=='Scrapped') {
|
|
||||||
frm.add_custom_button("Restore Asset", function() {
|
|
||||||
erpnext.asset.restore_asset(frm);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (frm.doc.purchase_receipt || !frm.doc.is_existing_asset) {
|
if (frm.doc.purchase_receipt || !frm.doc.is_existing_asset) {
|
||||||
frm.add_custom_button("General Ledger", function() {
|
frm.add_custom_button("General Ledger", function() {
|
||||||
frappe.route_options = {
|
frappe.route_options = {
|
||||||
@@ -110,6 +90,26 @@ frappe.ui.form.on('Asset', {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (frm.doc.docstatus==1) {
|
||||||
|
if (in_list(["Submitted", "Partially Depreciated", "Fully Depreciated"], frm.doc.status)) {
|
||||||
|
frm.add_custom_button("Transfer Asset", function() {
|
||||||
|
erpnext.asset.transfer_asset(frm);
|
||||||
|
}, __("Actions"));
|
||||||
|
|
||||||
|
frm.add_custom_button("Scrap Asset", function() {
|
||||||
|
erpnext.asset.scrap_asset(frm);
|
||||||
|
}, __("Actions"));
|
||||||
|
|
||||||
|
frm.add_custom_button("Sell Asset", function() {
|
||||||
|
frm.trigger("make_sales_invoice");
|
||||||
|
}, __("Actions"));
|
||||||
|
|
||||||
|
} else if (frm.doc.status=='Scrapped') {
|
||||||
|
frm.add_custom_button("Restore Asset", function() {
|
||||||
|
erpnext.asset.restore_asset(frm);
|
||||||
|
}, __("Actions"));
|
||||||
|
}
|
||||||
|
|
||||||
if (frm.doc.maintenance_required && !frm.doc.maintenance_schedule) {
|
if (frm.doc.maintenance_required && !frm.doc.maintenance_schedule) {
|
||||||
frm.add_custom_button(__("Asset Maintenance"), function() {
|
frm.add_custom_button(__("Asset Maintenance"), function() {
|
||||||
frm.trigger("create_asset_maintenance");
|
frm.trigger("create_asset_maintenance");
|
||||||
|
|||||||
Reference in New Issue
Block a user