fix(Asset): Group all buttons under 'Manage'
This commit is contained in:
parent
3e0e3f0e1b
commit
bbbd61dab8
@ -78,8 +78,50 @@ 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);
|
||||||
|
}, __("Manage"));
|
||||||
|
|
||||||
|
frm.add_custom_button("Scrap Asset", function() {
|
||||||
|
erpnext.asset.scrap_asset(frm);
|
||||||
|
}, __("Manage"));
|
||||||
|
|
||||||
|
frm.add_custom_button("Sell Asset", function() {
|
||||||
|
frm.trigger("make_sales_invoice");
|
||||||
|
}, __("Manage"));
|
||||||
|
|
||||||
|
} else if (frm.doc.status=='Scrapped') {
|
||||||
|
frm.add_custom_button("Restore Asset", function() {
|
||||||
|
erpnext.asset.restore_asset(frm);
|
||||||
|
}, __("Manage"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (frm.doc.maintenance_required && !frm.doc.maintenance_schedule) {
|
||||||
|
frm.add_custom_button(__("Maintain Asset"), function() {
|
||||||
|
frm.trigger("create_asset_maintenance");
|
||||||
|
}, __("Manage"));
|
||||||
|
}
|
||||||
|
|
||||||
|
frm.add_custom_button(__("Repair Asset"), function() {
|
||||||
|
frm.trigger("create_asset_repair");
|
||||||
|
}, __("Manage"));
|
||||||
|
|
||||||
|
if (frm.doc.status != 'Fully Depreciated') {
|
||||||
|
frm.add_custom_button(__("Adjust Asset Value"), function() {
|
||||||
|
frm.trigger("create_asset_adjustment");
|
||||||
|
}, __("Manage"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!frm.doc.calculate_depreciation) {
|
||||||
|
frm.add_custom_button(__("Create Depreciation Entry"), function() {
|
||||||
|
frm.trigger("make_journal_entry");
|
||||||
|
}, __("Manage"));
|
||||||
|
}
|
||||||
|
|
||||||
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("View General Ledger", function() {
|
||||||
frappe.route_options = {
|
frappe.route_options = {
|
||||||
"voucher_no": frm.doc.name,
|
"voucher_no": frm.doc.name,
|
||||||
"from_date": frm.doc.available_for_use_date,
|
"from_date": frm.doc.available_for_use_date,
|
||||||
@ -87,56 +129,10 @@ frappe.ui.form.on('Asset', {
|
|||||||
"company": frm.doc.company
|
"company": frm.doc.company
|
||||||
};
|
};
|
||||||
frappe.set_route("query-report", "General Ledger");
|
frappe.set_route("query-report", "General Ledger");
|
||||||
});
|
}, __("Manage"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frm.doc.docstatus==1) {
|
frm.page.set_inner_btn_group_as_primary(__("Manage"));
|
||||||
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) {
|
|
||||||
frm.add_custom_button(__("Asset Maintenance"), function() {
|
|
||||||
frm.trigger("create_asset_maintenance");
|
|
||||||
}, __('Create'));
|
|
||||||
}
|
|
||||||
if (frm.doc.docstatus == 1) {
|
|
||||||
frm.add_custom_button(__("Asset Repair"), function() {
|
|
||||||
// frappe.model.open_mapped_doc({
|
|
||||||
// method: 'erpnext.stock.doctype.delivery_trip.delivery_trip.make_expense_claim',
|
|
||||||
// frm: cur_frm,
|
|
||||||
// });
|
|
||||||
frm.trigger("create_asset_repair");
|
|
||||||
}, __("Create"));
|
|
||||||
}
|
|
||||||
if (frm.doc.status != 'Fully Depreciated') {
|
|
||||||
frm.add_custom_button(__("Asset Value Adjustment"), function() {
|
|
||||||
frm.trigger("create_asset_adjustment");
|
|
||||||
}, __('Create'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!frm.doc.calculate_depreciation) {
|
|
||||||
frm.add_custom_button(__("Depreciation Entry"), function() {
|
|
||||||
frm.trigger("make_journal_entry");
|
|
||||||
}, __('Create'));
|
|
||||||
}
|
|
||||||
|
|
||||||
frm.page.set_inner_btn_group_as_primary(__('Create'));
|
|
||||||
frm.trigger("setup_chart");
|
frm.trigger("setup_chart");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user