diff --git a/frappe/core/doctype/data_import/data_import.js b/frappe/core/doctype/data_import/data_import.js
index 7db3aa9629..b3fa136eb4 100644
--- a/frappe/core/doctype/data_import/data_import.js
+++ b/frappe/core/doctype/data_import/data_import.js
@@ -136,47 +136,40 @@ frappe.ui.form.on("Data Import", {
let total_records = cint(r.message.total_records);
if (!total_records) return;
+ let action, message;
+ if (frm.doc.import_type === "Insert New Records") {
+ action = "imported";
+ } else {
+ action = "updated";
+ }
- let message;
if (failed_records === 0) {
- let message_args = [successful_records];
- if (frm.doc.import_type === "Insert New Records") {
- message =
- successful_records > 1
- ? __("Successfully imported {0} records.", message_args)
- : __("Successfully imported {0} record.", message_args);
+ let message_args = [action, successful_records];
+ if (successful_records === 1) {
+ message = __("Successfully {0} 1 record.", message_args);
} else {
- message =
- successful_records > 1
- ? __("Successfully updated {0} records.", message_args)
- : __("Successfully updated {0} record.", message_args);
+ message = __("Successfully {0} {1} records.", message_args);
}
} else {
- let message_args = [successful_records, total_records];
- if (frm.doc.import_type === "Insert New Records") {
- message =
- successful_records > 1
- ? __(
- "Successfully imported {0} records out of {1}. Click on Export Errored Rows, fix the errors and import again.",
- message_args
- )
- : __(
- "Successfully imported {0} record out of {1}. Click on Export Errored Rows, fix the errors and import again.",
- message_args
- );
+ let message_args = [action, successful_records, total_records];
+ if (successful_records === 1) {
+ message = __(
+ "Successfully {0} {1} record out of {2}. Click on Export Errored Rows, fix the errors and import again.",
+ message_args
+ );
} else {
- message =
- 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
- );
+ message = __(
+ "Successfully {0} {1} records out of {2}. Click on Export Errored Rows, fix the errors and import again.",
+ message_args
+ );
}
}
+
+ // If the job timed out, display an extra hint
+ if (r.message.status === "Timed Out") {
+ message += "
" + __("Import timed out, please re-try.");
+ }
+
frm.dashboard.set_headline(message);
},
});
diff --git a/frappe/core/doctype/data_import/data_import.json b/frappe/core/doctype/data_import/data_import.json
index faa9a33bf1..97716219a2 100644
--- a/frappe/core/doctype/data_import/data_import.json
+++ b/frappe/core/doctype/data_import/data_import.json
@@ -1,198 +1,198 @@
{
- "actions": [],
- "autoname": "format:{reference_doctype} Import on {creation}",
- "beta": 1,
- "creation": "2019-08-04 14:16:08.318714",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "reference_doctype",
- "import_type",
- "download_template",
- "import_file",
- "payload_count",
- "html_5",
- "google_sheets_url",
- "refresh_google_sheet",
- "column_break_5",
- "status",
- "submit_after_import",
- "mute_emails",
- "template_options",
- "import_warnings_section",
- "template_warnings",
- "import_warnings",
- "section_import_preview",
- "import_preview",
- "import_log_section",
- "show_failed_logs",
- "import_log_preview"
- ],
- "fields": [
- {
- "fieldname": "reference_doctype",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Document Type",
- "options": "DocType",
- "reqd": 1,
- "set_only_once": 1
- },
- {
- "fieldname": "import_type",
- "fieldtype": "Select",
- "in_list_view": 1,
- "label": "Import Type",
- "options": "\nInsert New Records\nUpdate Existing Records",
- "reqd": 1,
- "set_only_once": 1
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "import_file",
- "fieldtype": "Attach",
- "in_list_view": 1,
- "label": "Import File",
- "read_only_depends_on": "eval: ['Success', 'Partial Success'].includes(doc.status)"
- },
- {
- "fieldname": "import_preview",
- "fieldtype": "HTML",
- "label": "Import Preview"
- },
- {
- "fieldname": "section_import_preview",
- "fieldtype": "Section Break",
- "label": "Preview"
- },
- {
- "fieldname": "column_break_5",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "template_options",
- "fieldtype": "Code",
- "hidden": 1,
- "label": "Template Options",
- "options": "JSON",
- "read_only": 1
- },
- {
- "fieldname": "import_log_section",
- "fieldtype": "Section Break",
- "label": "Import Log"
- },
- {
- "fieldname": "import_log_preview",
- "fieldtype": "HTML",
- "label": "Import Log Preview"
- },
- {
- "default": "Pending",
- "fieldname": "status",
- "fieldtype": "Select",
- "hidden": 1,
- "label": "Status",
- "no_copy": 1,
- "options": "Pending\nSuccess\nPartial Success\nError",
- "read_only": 1
- },
- {
- "fieldname": "template_warnings",
- "fieldtype": "Code",
- "hidden": 1,
- "label": "Template Warnings",
- "options": "JSON"
- },
- {
- "default": "0",
- "fieldname": "submit_after_import",
- "fieldtype": "Check",
- "label": "Submit After Import",
- "set_only_once": 1
- },
- {
- "fieldname": "import_warnings_section",
- "fieldtype": "Section Break",
- "label": "Import File Errors and Warnings"
- },
- {
- "fieldname": "import_warnings",
- "fieldtype": "HTML",
- "label": "Import Warnings"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "download_template",
- "fieldtype": "Button",
- "label": "Download Template"
- },
- {
- "default": "1",
- "fieldname": "mute_emails",
- "fieldtype": "Check",
- "label": "Don't Send Emails",
- "set_only_once": 1
- },
- {
- "default": "0",
- "fieldname": "show_failed_logs",
- "fieldtype": "Check",
- "label": "Show Failed Logs"
- },
- {
- "depends_on": "eval:!doc.__islocal && !doc.import_file",
- "fieldname": "html_5",
- "fieldtype": "HTML",
- "options": "