The license.txt file has been replaced with LICENSE for quite a while now. INAL but it didn't seem accurate to say "hey, checkout license.txt although there's no such file". Apart from this, there were inconsistencies in the headers altogether...this change brings consistency.
21 lines
525 B
Python
21 lines
525 B
Python
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
|
|
# License: MIT. See LICENSE
|
|
|
|
import frappe
|
|
import json
|
|
|
|
def execute():
|
|
"""Convert Query Report json to support other content"""
|
|
records = frappe.get_all('Report',
|
|
filters={
|
|
"json": ["!=", ""]
|
|
},
|
|
fields=["name", "json"]
|
|
)
|
|
for record in records:
|
|
jstr = record["json"]
|
|
data = json.loads(jstr)
|
|
if isinstance(data, list):
|
|
# double escape braces
|
|
jstr = f'{{"columns":{jstr}}}'
|
|
frappe.db.update('Report', record["name"], "json", jstr)
|