mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
fix: Organize buttons
This commit is contained in:
@@ -82,24 +82,46 @@ frappe.ui.form.on('Asset', {
|
|||||||
if (in_list(["Submitted", "Partially Depreciated", "Fully Depreciated"], frm.doc.status)) {
|
if (in_list(["Submitted", "Partially Depreciated", "Fully Depreciated"], frm.doc.status)) {
|
||||||
frm.add_custom_button("Transfer Asset", function() {
|
frm.add_custom_button("Transfer Asset", function() {
|
||||||
erpnext.asset.transfer_asset(frm);
|
erpnext.asset.transfer_asset(frm);
|
||||||
});
|
}, __("Manage"));
|
||||||
|
|
||||||
frm.add_custom_button("Scrap Asset", function() {
|
frm.add_custom_button("Scrap Asset", function() {
|
||||||
erpnext.asset.scrap_asset(frm);
|
erpnext.asset.scrap_asset(frm);
|
||||||
});
|
}, __("Manage"));
|
||||||
|
|
||||||
frm.add_custom_button("Sell Asset", function() {
|
frm.add_custom_button("Sell Asset", function() {
|
||||||
frm.trigger("make_sales_invoice");
|
frm.trigger("make_sales_invoice");
|
||||||
});
|
}, __("Manage"));
|
||||||
|
|
||||||
} else if (frm.doc.status=='Scrapped') {
|
} else if (frm.doc.status=='Scrapped') {
|
||||||
frm.add_custom_button("Restore Asset", function() {
|
frm.add_custom_button("Restore Asset", function() {
|
||||||
erpnext.asset.restore_asset(frm);
|
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,
|
||||||
@@ -107,27 +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.maintenance_required && !frm.doc.maintenance_schedule) {
|
frm.page.set_inner_btn_group_as_primary(__("Manage"));
|
||||||
frm.add_custom_button(__("Asset Maintenance"), function() {
|
|
||||||
frm.trigger("create_asset_maintenance");
|
|
||||||
}, __('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");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,6 +309,20 @@ frappe.ui.form.on('Asset', {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
create_asset_repair: function(frm) {
|
||||||
|
frappe.call({
|
||||||
|
args: {
|
||||||
|
"asset": frm.doc.name,
|
||||||
|
"asset_name": frm.doc.asset_name
|
||||||
|
},
|
||||||
|
method: "erpnext.assets.doctype.asset.asset.create_asset_repair",
|
||||||
|
callback: function(r) {
|
||||||
|
var doclist = frappe.model.sync(r.message);
|
||||||
|
frappe.set_route("Form", doclist[0].doctype, doclist[0].name);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
create_asset_adjustment: function(frm) {
|
create_asset_adjustment: function(frm) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
args: {
|
args: {
|
||||||
|
|||||||
@@ -625,9 +625,18 @@ def create_asset_maintenance(asset, item_code, item_name, asset_category, compan
|
|||||||
})
|
})
|
||||||
return asset_maintenance
|
return asset_maintenance
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def create_asset_repair(asset, asset_name):
|
||||||
|
asset_repair = frappe.new_doc("Asset Repair")
|
||||||
|
asset_repair.update({
|
||||||
|
"asset": asset,
|
||||||
|
"asset_name": asset_name
|
||||||
|
})
|
||||||
|
return asset_repair
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def create_asset_adjustment(asset, asset_category, company):
|
def create_asset_adjustment(asset, asset_category, company):
|
||||||
asset_maintenance = frappe.new_doc("Asset Value Adjustment")
|
asset_maintenance = frappe.get_doc("Asset Value Adjustment")
|
||||||
asset_maintenance.update({
|
asset_maintenance.update({
|
||||||
"asset": asset,
|
"asset": asset,
|
||||||
"company": company,
|
"company": company,
|
||||||
|
|||||||
@@ -8,10 +8,9 @@
|
|||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
"field_order": [
|
"field_order": [
|
||||||
"naming_series",
|
"naming_series",
|
||||||
"asset_name",
|
|
||||||
"column_break_2",
|
"column_break_2",
|
||||||
"item_code",
|
"asset",
|
||||||
"item_name",
|
"asset_name",
|
||||||
"section_break_5",
|
"section_break_5",
|
||||||
"failure_date",
|
"failure_date",
|
||||||
"assign_to",
|
"assign_to",
|
||||||
@@ -30,15 +29,6 @@
|
|||||||
"amended_from"
|
"amended_from"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
|
||||||
"columns": 1,
|
|
||||||
"fieldname": "asset_name",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"in_list_view": 1,
|
|
||||||
"label": "Asset",
|
|
||||||
"options": "Asset",
|
|
||||||
"reqd": 1
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "naming_series",
|
"fieldname": "naming_series",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
@@ -50,18 +40,6 @@
|
|||||||
"fieldname": "column_break_2",
|
"fieldname": "column_break_2",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fetch_from": "asset_name.item_code",
|
|
||||||
"fieldname": "item_code",
|
|
||||||
"fieldtype": "Read Only",
|
|
||||||
"label": "Item Code"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fetch_from": "asset_name.item_name",
|
|
||||||
"fieldname": "item_name",
|
|
||||||
"fieldtype": "Read Only",
|
|
||||||
"label": "Item Name"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "section_break_5",
|
"fieldname": "section_break_5",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
@@ -159,12 +137,26 @@
|
|||||||
"options": "Asset Repair",
|
"options": "Asset Repair",
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"columns": 1,
|
||||||
|
"fieldname": "asset",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"in_list_view": 1,
|
||||||
|
"label": "Asset",
|
||||||
|
"options": "Asset",
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "asset_name",
|
||||||
|
"fieldtype": "Read Only",
|
||||||
|
"label": "Asset Name"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-01-22 15:08:12.495850",
|
"modified": "2021-05-10 22:48:42.165513",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Assets",
|
"module": "Assets",
|
||||||
"name": "Asset Repair",
|
"name": "Asset Repair",
|
||||||
|
|||||||
Reference in New Issue
Block a user