diff --git a/frappe/core/doctype/data_import_legacy/importer.py b/frappe/core/doctype/data_import_legacy/importer.py index f7f196da61..35569c7186 100644 --- a/frappe/core/doctype/data_import_legacy/importer.py +++ b/frappe/core/doctype/data_import_legacy/importer.py @@ -164,7 +164,7 @@ def upload(rows = None, submit_after_import=None, ignore_encoding_errors=False, d[fieldname] = get_datetime(_date + " " + _time) else: d[fieldname] = None - elif df.fieldtype == "Duration": + elif fieldtype == "Duration": d[fieldname] = duration_to_seconds(cstr(d[fieldname])) elif fieldtype in ("Image", "Attach Image", "Attach"): # added file to attachments list diff --git a/frappe/desk/query_report.py b/frappe/desk/query_report.py index dc42228f81..183d1a1371 100644 --- a/frappe/desk/query_report.py +++ b/frappe/desk/query_report.py @@ -8,7 +8,7 @@ import os, json from frappe import _ from frappe.modules import scrub, get_module_path -from frappe.utils import flt, cint, get_html_format, get_url_to_form, gzip_decompress, format_duration, cstr +from frappe.utils import flt, cint, get_html_format, get_url_to_form, gzip_decompress, format_duration from frappe.model.utils import render_include from frappe.translate import send_translations import frappe.desk.reportview @@ -369,7 +369,7 @@ def export_query(): def handle_duration_fieldtype_values(result, columns): for i, col in enumerate(columns): - fieldtype, fieldname = None, None + fieldtype = None if isinstance(col, string_types): col = col.split(":") if len(col) > 1: @@ -381,7 +381,6 @@ def handle_duration_fieldtype_values(result, columns): fieldtype = "Data" else: fieldtype = col.get("fieldtype") - fieldname = col.get("fieldname") if fieldtype == "Duration": for entry in range(0, len(result)): @@ -410,10 +409,7 @@ def build_xlsx_data(columns, data, visible_idx, include_indentation): for idx in range(len(data.columns)): label = columns[idx]["label"] fieldname = columns[idx]["fieldname"] - fieldtype = columns[idx]["fieldtype"] cell_value = row.get(fieldname, row.get(label, "")) - if fieldtype == "Duration": - cell_value = format_duration(value) if cint(include_indentation) and 'indent' in row and idx == 0: cell_value = (' ' * cint(row['indent'])) + cell_value diff --git a/frappe/public/js/frappe/utils/utils.js b/frappe/public/js/frappe/utils/utils.js index d64be06869..b8eeefb046 100644 --- a/frappe/public/js/frappe/utils/utils.js +++ b/frappe/public/js/frappe/utils/utils.js @@ -830,7 +830,7 @@ Object.assign(frappe.utils, { duration_options = { hide_days: 0, hide_seconds: 0 - } + }; } if (value) { let total_duration = frappe.utils.seconds_to_duration(value, duration_options); diff --git a/frappe/public/js/frappe/views/reports/query_report.js b/frappe/public/js/frappe/views/reports/query_report.js index 0817d8cfa5..3d7631371c 100644 --- a/frappe/public/js/frappe/views/reports/query_report.js +++ b/frappe/public/js/frappe/views/reports/query_report.js @@ -1323,7 +1323,7 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList { .slice(standard_column_count) .map((cell, i) => { if (cell.column.fieldtype === "Duration") { - cell.content = frappe.utils.get_formatted_duration(cell.content) + cell.content = frappe.utils.get_formatted_duration(cell.content); } if (include_indentation && i===0) { cell.content = ' '.repeat(row.meta.indent) + (cell.content || '');