fix: Depreciation posting date only when calculate depreciation is checked

This commit is contained in:
Deepesh Garg 2022-09-18 19:41:05 +05:30
parent 487d825ede
commit fac82cf69b

View File

@ -239,8 +239,10 @@ frappe.ui.form.on('Asset', {
item_code: function(frm) {
if(frm.doc.item_code) {
if(frm.doc.item_code && frm.doc.calculate_depreciation) {
frm.trigger('set_finance_book');
} else {
frm.set_value('finance_books', []);
}
},
@ -381,6 +383,11 @@ frappe.ui.form.on('Asset', {
calculate_depreciation: function(frm) {
frm.toggle_reqd("finance_books", frm.doc.calculate_depreciation);
if (frm.doc.item_code && frm.doc.calculate_depreciation ) {
frm.trigger("set_finance_book");
} else {
frm.set_value("finance_books", []);
}
},
gross_purchase_amount: function(frm) {