diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py index 5d2a35bd96..da8214a851 100644 --- a/erpnext/accounts/report/financial_statements.py +++ b/erpnext/accounts/report/financial_statements.py @@ -5,6 +5,8 @@ from __future__ import unicode_literals 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 @@ def sort_root_accounts(roots): 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 953b4bc762..47853127b8 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -9,6 +9,8 @@ from erpnext.setup.utils import get_exchange_rate 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 @@ def get_bom_items_as_dict(bom, company, qty=1, fetch_exploded=1, fetch_scrap_ite @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):