mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 19:59:12 +00:00
fix: Hide Make Depreciation Entry if the Asset is not in the Submitted or Partially Depreciated state
This commit is contained in:
@@ -78,6 +78,7 @@ frappe.ui.form.on('Asset', {
|
|||||||
frappe.ui.form.trigger("Asset", "is_existing_asset");
|
frappe.ui.form.trigger("Asset", "is_existing_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);
|
||||||
|
frm.trigger("toggle_make_depreciation_entry");
|
||||||
|
|
||||||
if (frm.doc.docstatus==1) {
|
if (frm.doc.docstatus==1) {
|
||||||
if (in_list(["Submitted", "Partially Depreciated", "Fully Depreciated"], frm.doc.status)) {
|
if (in_list(["Submitted", "Partially Depreciated", "Fully Depreciated"], frm.doc.status)) {
|
||||||
@@ -141,6 +142,18 @@ frappe.ui.form.on('Asset', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
toggle_make_depreciation_entry: function(frm) {
|
||||||
|
if (frm.doc.calculate_depreciation){
|
||||||
|
if (in_list(["Submitted", "Partially Depreciated"], frm.doc.status)){
|
||||||
|
frm.fields_dict['schedules'].grid.set_column_disp('make_depreciation_entry', true);
|
||||||
|
} else {
|
||||||
|
frm.fields_dict['schedules'].grid.set_column_disp('make_depreciation_entry', false);
|
||||||
|
}
|
||||||
|
|
||||||
|
frm.refresh_field('schedules');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
toggle_reference_doc: function(frm) {
|
toggle_reference_doc: function(frm) {
|
||||||
if (frm.doc.purchase_receipt && frm.doc.purchase_invoice && frm.doc.docstatus === 1) {
|
if (frm.doc.purchase_receipt && frm.doc.purchase_invoice && frm.doc.docstatus === 1) {
|
||||||
frm.set_df_property('purchase_invoice', 'read_only', 1);
|
frm.set_df_property('purchase_invoice', 'read_only', 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user