feat: progress bar, account name field
diff --git a/erpnext/accounts/doctype/ledger_merge/ledger_merge.js b/erpnext/accounts/doctype/ledger_merge/ledger_merge.js
index 6a768ca..ffc4ac4 100644
--- a/erpnext/accounts/doctype/ledger_merge/ledger_merge.js
+++ b/erpnext/accounts/doctype/ledger_merge/ledger_merge.js
@@ -3,25 +3,17 @@
 
 frappe.ui.form.on('Ledger Merge', {
   setup: function(frm) {
-    frappe.realtime.on('data_import_refresh', ({ ledger_merge }) => {
+    frappe.realtime.on('ledger_merge_refresh', ({ ledger_merge }) => {
 			if (ledger_merge !== frm.doc.name) return;
 			frm.refresh();
 		});
 
-		frappe.realtime.on('data_import_progress', data => {
-			if (data.data_import !== frm.doc.name) return;
+		frappe.realtime.on('ledger_merge_progress', data => {
+			if (data.ledger_merge !== frm.doc.name) return;
 			let message = __('Merging {0} of {1}', [data.current, data.total]);
       let percent = Math.floor((data.current * 100) / data.total);
 			frm.dashboard.show_progress(__('Merge Progress'), percent, message);
 			frm.page.set_indicator(__('In Progress'), 'orange');
-
-			// hide progress when complete
-			if (data.current === data.total) {
-				setTimeout(() => {
-					frm.dashboard.hide();
-					frm.refresh();
-				}, 2000);
-			}
 		});
 
     frm.set_query("account", function(doc) {
@@ -61,10 +53,15 @@
 	},
 
   after_save: function(frm) {
-		frm.trigger('update_primary_action');
+    setTimeout(() => {
+      frm.trigger('update_primary_action');
+		}, 750);
 	},
 
 	update_primary_action: function(frm) {
+    console.log(!frm.is_new());
+    console.log(frm.is_dirty());
+    console.log("-");
 		if (frm.is_dirty()) {
 			frm.enable_save();
 			return;
diff --git a/erpnext/accounts/doctype/ledger_merge/ledger_merge.json b/erpnext/accounts/doctype/ledger_merge/ledger_merge.json
index b3652bb..641b462 100644
--- a/erpnext/accounts/doctype/ledger_merge/ledger_merge.json
+++ b/erpnext/accounts/doctype/ledger_merge/ledger_merge.json
@@ -1,6 +1,6 @@
 {
  "actions": [],
- "autoname": "format:{account} merger on {creation}",
+ "autoname": "format:{account_name} merger on {creation}",
  "creation": "2021-12-09 15:38:04.556584",
  "doctype": "DocType",
  "editable_grid": 1,
@@ -9,6 +9,7 @@
   "section_break_1",
   "root_type",
   "account",
+  "account_name",
   "column_break_3",
   "company",
   "status",
@@ -68,11 +69,21 @@
    "options": "\nAsset\nLiability\nIncome\nExpense\nEquity",
    "reqd": 1,
    "set_only_once": 1
+  },
+  {
+   "depends_on": "account",
+   "fetch_from": "account.account_name",
+   "fetch_if_empty": 1,
+   "fieldname": "account_name",
+   "fieldtype": "Data",
+   "label": "Account Name",
+   "read_only": 1,
+   "reqd": 1
   }
  ],
  "hide_toolbar": 1,
  "links": [],
- "modified": "2021-12-09 18:35:30.720538",
+ "modified": "2021-12-09 23:41:11.097097",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Ledger Merge",
diff --git a/erpnext/accounts/doctype/ledger_merge/ledger_merge.py b/erpnext/accounts/doctype/ledger_merge/ledger_merge.py
index 48ac1e7..a23f565 100644
--- a/erpnext/accounts/doctype/ledger_merge/ledger_merge.py
+++ b/erpnext/accounts/doctype/ledger_merge/ledger_merge.py
@@ -43,27 +43,28 @@
 	successful_merges = 0
 	total = len(ledger_merge.merge_accounts)
 	for row in ledger_merge.merge_accounts:
-		try:
-			merge_account(row.account, ledger_merge.account, 0, ledger_merge.root_type, ledger_merge.company)
-			row.db_set('merged', 1)
-			frappe.db.commit()
-			successful_merges += 1
-			frappe.publish_realtime("ledger_merge_progress", {
-					"ledger_merge": ledger_merge.name,
-					"current": successful_merges,
-					"total": total
-				}
-			)
-		except Exception:
-			frappe.db.rollback()
-			ledger_merge.db_set("status", "Error")
-			frappe.log_error(title=ledger_merge.name)
-		finally:
-			if successful_merges == total:
-				ledger_merge.db_set('status', 'Success')
-			elif successful_merges > 0:
-				ledger_merge.db_set('status', 'Partial Success')
-			else:
-				ledger_merge.db_set('status', 'Error')
+		if not row.merged:
+			try:
+				merge_account(row.account, ledger_merge.account, 0, ledger_merge.root_type, ledger_merge.company)
+				row.db_set('merged', 1)
+				frappe.db.commit()
+				successful_merges += 1
+				frappe.publish_realtime("ledger_merge_progress", {
+						"ledger_merge": ledger_merge.name,
+						"current": successful_merges,
+						"total": total
+					}
+				)
+			except Exception:
+				frappe.db.rollback()
+				ledger_merge.db_set("status", "Error")
+				frappe.log_error(title=ledger_merge.name)
+			finally:
+				if successful_merges == total:
+					ledger_merge.db_set('status', 'Success')
+				elif successful_merges > 0:
+					ledger_merge.db_set('status', 'Partial Success')
+				else:
+					ledger_merge.db_set('status', 'Error')
 
 	frappe.publish_realtime("ledger_merge_refresh", {"ledger_merge": ledger_merge.name})
diff --git a/erpnext/accounts/doctype/ledger_merge_accounts/ledger_merge_accounts.json b/erpnext/accounts/doctype/ledger_merge_accounts/ledger_merge_accounts.json
index f5dab36..524e480 100644
--- a/erpnext/accounts/doctype/ledger_merge_accounts/ledger_merge_accounts.json
+++ b/erpnext/accounts/doctype/ledger_merge_accounts/ledger_merge_accounts.json
@@ -7,11 +7,12 @@
  "engine": "InnoDB",
  "field_order": [
   "account",
+  "account_name",
   "merged"
  ],
  "fields": [
   {
-   "columns": 8,
+   "columns": 4,
    "fieldname": "account",
    "fieldtype": "Link",
    "in_list_view": 1,
@@ -27,12 +28,21 @@
    "in_list_view": 1,
    "label": "Merged",
    "read_only": 1
+  },
+  {
+   "columns": 4,
+   "fetch_from": "account.account_name",
+   "fieldname": "account_name",
+   "fieldtype": "Data",
+   "label": "Account Name",
+   "read_only": 1,
+   "reqd": 1
   }
  ],
  "index_web_pages_for_search": 1,
  "istable": 1,
  "links": [],
- "modified": "2021-12-09 15:50:09.047183",
+ "modified": "2021-12-09 23:19:15.193921",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Ledger Merge Accounts",