refactor: parse native JSON request args in accounts/doctype/bank_statement_import_log/bank_statement_import_log.py

Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
This commit is contained in:
Mihir Kandoi
2026-06-24 20:37:30 +05:30
parent 2f0367807f
commit 9d8f6d4ed9

View File

@@ -1183,8 +1183,7 @@ def update_pdf_tables(statement_import_id: str, tables: list | str):
if doc.status == "Completed":
frappe.throw(_("This statement has already been imported."), title=_("Already Imported"))
if isinstance(tables, str):
tables = json.loads(tables)
tables = frappe.parse_json(tables)
doc.apply_pdf_tables(tables)
@@ -1204,8 +1203,7 @@ def reextract_pdf_table(statement_import_id: str, page: int, table_index: int, b
if doc.status == "Completed":
frappe.throw(_("This statement has already been imported."), title=_("Already Imported"))
if isinstance(bbox, str):
bbox = json.loads(bbox)
bbox = frappe.parse_json(bbox)
page = int(page)
table_index = int(table_index)
@@ -1290,8 +1288,7 @@ def update_column_mapping(statement_import_id: str, column_mapping: list | str):
if doc.status == "Completed":
frappe.throw(_("This statement has already been imported."), title=_("Already Imported"))
if isinstance(column_mapping, str):
column_mapping = json.loads(column_mapping)
column_mapping = frappe.parse_json(column_mapping)
doc.apply_column_mapping(column_mapping)
doc.save()