refactor(prepared-report): Do not serialize JSON serialized filters
Prepared report filters were being JSON serialized twice. There isn't any apparent need to do this. So don't do it.
This commit is contained in:
parent
0919234b66
commit
d76a0136dd
3 changed files with 5 additions and 3 deletions
|
|
@ -15,7 +15,7 @@ frappe.ui.form.on('Prepared Report', {
|
|||
<tbody></tbody>
|
||||
</table>`);
|
||||
|
||||
const filters = JSON.parse(JSON.parse(frm.doc.filters));
|
||||
const filters = JSON.parse(frm.doc.filters);
|
||||
|
||||
Object.keys(filters).forEach(key => {
|
||||
const filter_row = $(`<tr>
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class PreparedReport(Document):
|
|||
|
||||
def run_background(instance):
|
||||
report = frappe.get_doc("Report", instance.ref_report_doctype)
|
||||
result = generate_report_result(report, filters=json.loads(instance.filters), user=instance.owner)
|
||||
result = generate_report_result(report, filters=instance.filters, user=instance.owner)
|
||||
create_json_gz_file(result['result'], 'Prepared Report', instance.name)
|
||||
|
||||
instance.status = "Completed"
|
||||
|
|
|
|||
|
|
@ -100,7 +100,9 @@ def background_enqueue_run(report_name, filters=None, user=None):
|
|||
frappe.get_doc({
|
||||
"doctype": "Prepared Report",
|
||||
"report_name": report_name,
|
||||
"filters": json.dumps(filters),
|
||||
# This looks like an insanity but, without this it'd be very hard to find Prepared Reports matvhing given condition
|
||||
# We're ensuring that spacing is consistent. e.g. JS seems to put no spaces after ":", Python on the other hand does.
|
||||
"filters": json.dumps(json.loads(filters)),
|
||||
"ref_report_doctype": report_name,
|
||||
"report_type": report.report_type,
|
||||
"query": report.query,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue