Merge pull request #6993 from zerodhatech/fixtures
export fixtures of a specific app
This commit is contained in:
commit
abfb44a047
2 changed files with 9 additions and 4 deletions
|
|
@ -223,15 +223,16 @@ def export_csv(context, doctype, path):
|
|||
frappe.destroy()
|
||||
|
||||
@click.command('export-fixtures')
|
||||
@click.option('--app', default=None, help='Export fixtures of a specific app')
|
||||
@pass_context
|
||||
def export_fixtures(context):
|
||||
def export_fixtures(context, app=None):
|
||||
"Export fixtures"
|
||||
from frappe.utils.fixtures import export_fixtures
|
||||
for site in context.sites:
|
||||
try:
|
||||
frappe.init(site=site)
|
||||
frappe.connect()
|
||||
export_fixtures()
|
||||
export_fixtures(app=app)
|
||||
finally:
|
||||
frappe.destroy()
|
||||
|
||||
|
|
|
|||
|
|
@ -50,9 +50,13 @@ def import_custom_scripts(app):
|
|||
"script": script
|
||||
}).insert()
|
||||
|
||||
def export_fixtures():
|
||||
def export_fixtures(app=None):
|
||||
"""Export fixtures as JSON to `[app]/fixtures`"""
|
||||
for app in frappe.get_installed_apps():
|
||||
if app:
|
||||
apps = [app]
|
||||
else:
|
||||
apps = frappe.get_installed_apps()
|
||||
for app in apps:
|
||||
for fixture in frappe.get_hooks("fixtures", app_name=app):
|
||||
filters = None
|
||||
or_filters = None
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue