|
|
@@ -47,8 +47,12 @@ def export_fixtures(): |
|
|
|
"""Export fixtures as JSON to `[app]/fixtures`""" |
|
|
|
for app in frappe.get_installed_apps(): |
|
|
|
for fixture in frappe.get_hooks("fixtures", app_name=app): |
|
|
|
print "Exporting {0}".format(fixture) |
|
|
|
filters = None |
|
|
|
if isinstance(fixture, dict): |
|
|
|
filters = fixture.get("filters") |
|
|
|
fixture = fixture.get("doctype") or fixture.get("dt") |
|
|
|
print "Exporting {0} {1} {2}".format(fixture, app, filters) |
|
|
|
if not os.path.exists(frappe.get_app_path(app, "fixtures")): |
|
|
|
os.mkdir(frappe.get_app_path(app, "fixtures")) |
|
|
|
|
|
|
|
export_json(fixture, frappe.get_app_path(app, "fixtures", frappe.scrub(fixture) + ".json")) |
|
|
|
export_json(fixture, frappe.get_app_path(app, "fixtures", frappe.scrub(fixture) + ".json"), filters=filters) |