fix(Asset Captalization): run_serially on posting_date changed

This commit is contained in:
Saif Ur Rehman
2021-09-16 23:20:36 +05:00
parent d173e06e69
commit 132b517584

View File

@@ -16,7 +16,7 @@ erpnext.assets.AssetCapitalization = class AssetCapitalization extends erpnext.s
refresh() { refresh() {
erpnext.hide_company(); erpnext.hide_company();
this.show_general_ledger(); 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(); this.show_stock_ledger();
} }
} }
@@ -130,8 +130,10 @@ erpnext.assets.AssetCapitalization = class AssetCapitalization extends erpnext.s
posting_date() { posting_date() {
if (this.frm.doc.posting_date) { if (this.frm.doc.posting_date) {
this.get_all_item_warehouse_details(); frappe.run_serially([
this.get_all_asset_values(); () => 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() { get_all_item_warehouse_details() {
var me = this; var me = this;
me.frm.call({ return me.frm.call({
method: "set_warehouse_details", method: "set_warehouse_details",
doc: me.frm.doc, doc: me.frm.doc,
callback: function(r) { callback: function(r) {
@@ -360,7 +362,7 @@ erpnext.assets.AssetCapitalization = class AssetCapitalization extends erpnext.s
get_all_asset_values() { get_all_asset_values() {
var me = this; var me = this;
me.frm.call({ return me.frm.call({
method: "set_asset_values", method: "set_asset_values",
doc: me.frm.doc, doc: me.frm.doc,
callback: function(r) { callback: function(r) {