[FIX] sorting multiple compares
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index 5d2a35b..da8214a 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -5,6 +5,8 @@
import re
+import functools
+
import frappe
from erpnext.accounts.report.utils import get_currency, convert_to_presentation_currency
from erpnext.accounts.utils import get_fiscal_year
@@ -325,7 +327,7 @@
return -1
return 1
- roots.sort(compare_roots)
+ roots.sort(key = functools.cmp_to_key(compare_roots))
def set_gl_entries_by_account(
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index 953b4bc..4785312 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -9,6 +9,8 @@
from frappe.website.website_generator import WebsiteGenerator
from erpnext.stock.get_item_details import get_conversion_factor
+import functools
+
from six import string_types
from operator import itemgetter
@@ -585,7 +587,7 @@
@frappe.whitelist()
def get_bom_items(bom, company, qty=1, fetch_exploded=1):
items = get_bom_items_as_dict(bom, company, qty, fetch_exploded).values()
- items.sort(lambda a, b: a.item_code > b.item_code and 1 or -1)
+ items.sort(key = functools.cmp_to_key(lambda a, b: a.item_code > b.item_code and 1 or -1))
return items
def validate_bom_no(item, bom_no):