diff --git a/frappe/core/page/data_import_tool/data_import_tool.py b/frappe/core/page/data_import_tool/data_import_tool.py index 15f0054aef..1e7deac090 100644 --- a/frappe/core/page/data_import_tool/data_import_tool.py +++ b/frappe/core/page/data_import_tool/data_import_tool.py @@ -46,8 +46,11 @@ def export_csv(doctype, path): def export_json(doctype, path, filters=None): from frappe.utils.response import json_handler out = [] - for doc in frappe.get_all(doctype, fields=["name"], filters=filters, limit_page_length=0, order_by="creation asc"): - out.append(frappe.get_doc(doctype, doc.name).as_dict()) + if frappe.db.get_value("DocType", doctype, "issingle"): + out.append(frappe.get_doc(doctype).as_dict()) + else: + for doc in frappe.get_all(doctype, fields=["name"], filters=filters, limit_page_length=0, order_by="creation asc"): + out.append(frappe.get_doc(doctype, doc.name).as_dict()) with open(path, "w") as outfile: outfile.write(json.dumps(out, default=json_handler, indent=1, sort_keys=True)) diff --git a/frappe/utils/fixtures.py b/frappe/utils/fixtures.py index b47c8a19e5..b086169d3f 100644 --- a/frappe/utils/fixtures.py +++ b/frappe/utils/fixtures.py @@ -28,6 +28,6 @@ def export_fixtures(): if isinstance(fixture, basestring): fixture = [fixture]; if frappe.db.get_value("DocType", fixture[0], "issingle"): - export_fixture(fixture[0], fixture[0], app) + export_fixture(fixture[0], app) else: export_csv(fixture, frappe.get_app_path(app, "fixtures", frappe.scrub(fixture[0]) + ".csv"))