mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 06:29:20 +00:00
refactor: use json directly instead of using frappe.json (#41609)
This commit is contained in:
@@ -481,7 +481,7 @@ def create_merge_logs(invoice_by_customer, closing_entry=None):
|
|||||||
if closing_entry:
|
if closing_entry:
|
||||||
closing_entry.set_status(update=True, status="Failed")
|
closing_entry.set_status(update=True, status="Failed")
|
||||||
if isinstance(error_message, list):
|
if isinstance(error_message, list):
|
||||||
error_message = frappe.json.dumps(error_message)
|
error_message = json.dumps(error_message)
|
||||||
closing_entry.db_set("error_message", error_message)
|
closing_entry.db_set("error_message", error_message)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
|
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _, qb
|
from frappe import _, qb
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
@@ -502,7 +504,7 @@ def is_any_doc_running(for_filter: str | dict | None = None) -> str | None:
|
|||||||
running_doc = None
|
running_doc = None
|
||||||
if for_filter:
|
if for_filter:
|
||||||
if isinstance(for_filter, str):
|
if isinstance(for_filter, str):
|
||||||
for_filter = frappe.json.loads(for_filter)
|
for_filter = json.loads(for_filter)
|
||||||
|
|
||||||
running_doc = frappe.db.get_value(
|
running_doc = frappe.db.get_value(
|
||||||
"Process Payment Reconciliation",
|
"Process Payment Reconciliation",
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
# License: GNU General Public License v3. See license.txt
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
import json
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.model.dynamic_links import get_dynamic_link_map
|
from frappe.model.dynamic_links import get_dynamic_link_map
|
||||||
@@ -3733,9 +3734,9 @@ class TestSalesInvoice(FrappeTestCase):
|
|||||||
|
|
||||||
map_docs(
|
map_docs(
|
||||||
method="erpnext.stock.doctype.delivery_note.delivery_note.make_sales_invoice",
|
method="erpnext.stock.doctype.delivery_note.delivery_note.make_sales_invoice",
|
||||||
source_names=frappe.json.dumps([dn1.name, dn2.name]),
|
source_names=json.dumps([dn1.name, dn2.name]),
|
||||||
target_doc=si,
|
target_doc=si,
|
||||||
args=frappe.json.dumps({"customer": dn1.customer, "merge_taxes": 1, "filtered_children": []}),
|
args=json.dumps({"customer": dn1.customer, "merge_taxes": 1, "filtered_children": []}),
|
||||||
)
|
)
|
||||||
si.save().submit()
|
si.save().submit()
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
|
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _, qb
|
from frappe import _, qb
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
@@ -163,7 +165,7 @@ def get_linked_payments_for_doc(
|
|||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def create_unreconcile_doc_for_selection(selections=None):
|
def create_unreconcile_doc_for_selection(selections=None):
|
||||||
if selections:
|
if selections:
|
||||||
selections = frappe.json.loads(selections)
|
selections = json.loads(selections)
|
||||||
# assuming each row is a unique voucher
|
# assuming each row is a unique voucher
|
||||||
for row in selections:
|
for row in selections:
|
||||||
unrecon = frappe.new_doc("Unreconcile Payment")
|
unrecon = frappe.new_doc("Unreconcile Payment")
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ def get_fiscal_year(
|
|||||||
date=None, fiscal_year=None, label="Date", verbose=1, company=None, as_dict=False, boolean=False
|
date=None, fiscal_year=None, label="Date", verbose=1, company=None, as_dict=False, boolean=False
|
||||||
):
|
):
|
||||||
if isinstance(boolean, str):
|
if isinstance(boolean, str):
|
||||||
boolean = frappe.json.loads(boolean)
|
boolean = loads(boolean)
|
||||||
|
|
||||||
fiscal_years = get_fiscal_years(
|
fiscal_years = get_fiscal_years(
|
||||||
date, fiscal_year, label, verbose, company, as_dict=as_dict, boolean=boolean
|
date, fiscal_year, label, verbose, company, as_dict=as_dict, boolean=boolean
|
||||||
@@ -1109,7 +1109,7 @@ def get_companies():
|
|||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_children(doctype, parent, company, is_root=False, include_disabled=False):
|
def get_children(doctype, parent, company, is_root=False, include_disabled=False):
|
||||||
if isinstance(include_disabled, str):
|
if isinstance(include_disabled, str):
|
||||||
include_disabled = frappe.json.loads(include_disabled)
|
include_disabled = loads(include_disabled)
|
||||||
from erpnext.accounts.report.financial_statements import sort_accounts
|
from erpnext.accounts.report.financial_statements import sort_accounts
|
||||||
|
|
||||||
parent_fieldname = "parent_" + doctype.lower().replace(" ", "_")
|
parent_fieldname = "parent_" + doctype.lower().replace(" ", "_")
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
# License: GNU General Public License v3. See license.txt
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.test_runner import make_test_records
|
from frappe.test_runner import make_test_records
|
||||||
from frappe.tests.utils import FrappeTestCase
|
from frappe.tests.utils import FrappeTestCase
|
||||||
@@ -321,7 +323,7 @@ class TestCustomer(FrappeTestCase):
|
|||||||
frappe.ValidationError,
|
frappe.ValidationError,
|
||||||
update_child_qty_rate,
|
update_child_qty_rate,
|
||||||
so.doctype,
|
so.doctype,
|
||||||
frappe.json.dumps([modified_item]),
|
json.dumps([modified_item]),
|
||||||
so.name,
|
so.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
# License: GNU General Public License v3. See license.txt
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.utils.nestedset import NestedSet, get_root_of
|
from frappe.utils.nestedset import NestedSet, get_root_of
|
||||||
|
|
||||||
@@ -71,7 +73,7 @@ def get_abbreviated_name(name, company):
|
|||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_children(doctype, parent=None, company=None, is_root=False, include_disabled=False):
|
def get_children(doctype, parent=None, company=None, is_root=False, include_disabled=False):
|
||||||
if isinstance(include_disabled, str):
|
if isinstance(include_disabled, str):
|
||||||
include_disabled = frappe.json.loads(include_disabled)
|
include_disabled = json.loads(include_disabled)
|
||||||
fields = ["name as value", "is_group as expandable"]
|
fields = ["name as value", "is_group as expandable"]
|
||||||
filters = {}
|
filters = {}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
# License: GNU General Public License v3. See license.txt
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _, throw
|
from frappe import _, throw
|
||||||
from frappe.contacts.address_and_contact import load_address_and_contact
|
from frappe.contacts.address_and_contact import load_address_and_contact
|
||||||
@@ -186,7 +188,7 @@ def get_children(doctype, parent=None, company=None, is_root=False, include_disa
|
|||||||
parent = ""
|
parent = ""
|
||||||
|
|
||||||
if isinstance(include_disabled, str):
|
if isinstance(include_disabled, str):
|
||||||
include_disabled = frappe.json.loads(include_disabled)
|
include_disabled = json.loads(include_disabled)
|
||||||
|
|
||||||
fields = ["name as value", "is_group as expandable"]
|
fields = ["name as value", "is_group as expandable"]
|
||||||
filters = [
|
filters = [
|
||||||
|
|||||||
Reference in New Issue
Block a user