diff --git a/frappe/core/doctype/data_import/data_import.js b/frappe/core/doctype/data_import/data_import.js index 1460f8698e..dfc560a98a 100644 --- a/frappe/core/doctype/data_import/data_import.js +++ b/frappe/core/doctype/data_import/data_import.js @@ -81,7 +81,10 @@ frappe.ui.form.on('Data Import', { frm.trigger('show_import_log'); frm.trigger('show_import_warnings'); frm.trigger('toggle_submit_after_import'); - frm.trigger('show_import_status'); + + if (frm.doc.status != 'Pending') + frm.trigger('show_import_status'); + frm.trigger('show_report_error_button'); if (frm.doc.status === 'Partial Success') { @@ -164,7 +167,7 @@ frappe.ui.form.on('Data Import', { : __('Successfully imported {0} record out of {1}. Click on Export Errored Rows, fix the errors and import again.', message_args); } else { message = - successful_records> 1 + successful_records > 1 ? __('Successfully updated {0} records out of {1}. Click on Export Errored Rows, fix the errors and import again.', message_args) : __('Successfully updated {0} record out of {1}. Click on Export Errored Rows, fix the errors and import again.', message_args); } diff --git a/frappe/core/doctype/data_import/importer.py b/frappe/core/doctype/data_import/importer.py index d13f4c1389..107c05a66a 100644 --- a/frappe/core/doctype/data_import/importer.py +++ b/frappe/core/doctype/data_import/importer.py @@ -156,11 +156,11 @@ class Importer: }, ) - import_log.append(create_import_log(self.data_import.name, log_index, { + create_import_log(self.data_import.name, log_index, { 'success': True, 'docname': doc.name, 'row_indexes': row_indexes - })) + }) log_index += 1 @@ -177,15 +177,13 @@ class Importer: # rollback if exception frappe.db.rollback() - import_log.append(create_import_log(self.data_import.name, log_index, { + create_import_log(self.data_import.name, log_index, { 'success': False, 'exception': frappe.get_traceback(), 'messages': messages, 'row_indexes': row_indexes - })) + }) - # commit after creating log for failure - frappe.db.commit() log_index += 1 # Logs are db inserted directly so will have to be fetched again diff --git a/frappe/core/doctype/data_import_log/data_import_log.json b/frappe/core/doctype/data_import_log/data_import_log.json index 8747728945..b1d991f099 100644 --- a/frappe/core/doctype/data_import_log/data_import_log.json +++ b/frappe/core/doctype/data_import_log/data_import_log.json @@ -60,7 +60,7 @@ "in_create": 1, "index_web_pages_for_search": 1, "links": [], - "modified": "2021-12-28 11:19:19.646076", + "modified": "2021-12-29 11:19:19.646076", "modified_by": "Administrator", "module": "Core", "name": "Data Import Log",