From 132b517584352a8a6c895fd3256bdc08b03c1df5 Mon Sep 17 00:00:00 2001 From: Saif Ur Rehman Date: Thu, 16 Sep 2021 23:20:36 +0500 Subject: [PATCH] fix(Asset Captalization): run_serially on posting_date changed --- .../asset_capitalization/asset_capitalization.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/erpnext/assets/doctype/asset_capitalization/asset_capitalization.js b/erpnext/assets/doctype/asset_capitalization/asset_capitalization.js index 892f8c7d4a..d135e60ae7 100644 --- a/erpnext/assets/doctype/asset_capitalization/asset_capitalization.js +++ b/erpnext/assets/doctype/asset_capitalization/asset_capitalization.js @@ -16,7 +16,7 @@ erpnext.assets.AssetCapitalization = class AssetCapitalization extends erpnext.s refresh() { erpnext.hide_company(); this.show_general_ledger(); - if (this.frm.doc.stock_items || !this.frm.doc.target_is_fixed_asset) { + if ((this.frm.doc.stock_items && this.frm.doc.stock_items.length) || !this.frm.doc.target_is_fixed_asset) { this.show_stock_ledger(); } } @@ -130,8 +130,10 @@ erpnext.assets.AssetCapitalization = class AssetCapitalization extends erpnext.s posting_date() { if (this.frm.doc.posting_date) { - this.get_all_item_warehouse_details(); - this.get_all_asset_values(); + frappe.run_serially([ + () => this.get_all_item_warehouse_details(), + () => this.get_all_asset_values() + ]); } } @@ -347,7 +349,7 @@ erpnext.assets.AssetCapitalization = class AssetCapitalization extends erpnext.s get_all_item_warehouse_details() { var me = this; - me.frm.call({ + return me.frm.call({ method: "set_warehouse_details", doc: me.frm.doc, callback: function(r) { @@ -360,7 +362,7 @@ erpnext.assets.AssetCapitalization = class AssetCapitalization extends erpnext.s get_all_asset_values() { var me = this; - me.frm.call({ + return me.frm.call({ method: "set_asset_values", doc: me.frm.doc, callback: function(r) {