fix: Depreciation posting date only when calculate depreciation is checked
diff --git a/erpnext/assets/doctype/asset/asset.js b/erpnext/assets/doctype/asset/asset.js
index f414930..a43a16c 100644
--- a/erpnext/assets/doctype/asset/asset.js
+++ b/erpnext/assets/doctype/asset/asset.js
@@ -239,8 +239,10 @@
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 @@
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) {