From 43958dcd11beab52d6d9fd0f2fd2c0e3ca4cdecb Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 1 May 2019 13:53:05 +0530 Subject: [PATCH 1/2] fix(minor): chart of accounts sorting and message --- erpnext/accounts/report/financial_statements.py | 3 +++ erpnext/projects/doctype/project/project_list.js | 2 +- erpnext/projects/doctype/task/task.py | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py index 48663cac7e..eea77ed610 100644 --- a/erpnext/accounts/report/financial_statements.py +++ b/erpnext/accounts/report/financial_statements.py @@ -334,6 +334,9 @@ def sort_accounts(accounts, is_root=False, key="name"): if re.split('\W+', a[key])[0].isdigit(): # if chart of accounts is numbered, then sort by number return cmp(a[key], b[key]) + else: + # common, this should be alphabetic otherwise! + return cmp(a[key], b[key]) return 1 accounts.sort(key = functools.cmp_to_key(compare_accounts)) diff --git a/erpnext/projects/doctype/project/project_list.js b/erpnext/projects/doctype/project/project_list.js index 0f715bf691..5ad4bb7f93 100644 --- a/erpnext/projects/doctype/project/project_list.js +++ b/erpnext/projects/doctype/project/project_list.js @@ -3,7 +3,7 @@ frappe.listview_settings['Project'] = { filters:[["status","=", "Open"]], get_indicator: function(doc) { if(doc.status=="Open" && doc.percent_complete) { - return [__("{0}% Complete", [cint(doc.percent_complete)]), "orange", "percent_complete,>,0|status,=,Open"]; + return [__("{0}%", [cint(doc.percent_complete)]), "orange", "percent_complete,>,0|status,=,Open"]; } else { return [__(doc.status), frappe.utils.guess_colour(doc.status), "status,=," + doc.status]; } diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py index 2686e58294..ac71b285dc 100755 --- a/erpnext/projects/doctype/task/task.py +++ b/erpnext/projects/doctype/task/task.py @@ -48,7 +48,7 @@ class Task(NestedSet): if self.status!=self.get_db_value("status") and self.status == "Completed": for d in self.depends_on: if frappe.db.get_value("Task", d.task, "status") != "Completed": - frappe.throw(_("Cannot close task as its dependant task {0} is not closed.").format(d.task)) + frappe.throw(_("Cannot close task {0} as its dependant task {1} is not closed.").format(frappe.bold(self.name), frappe.bold(d.task))) from frappe.desk.form.assign_to import clear clear(self.doctype, self.name) From 27a30c842d0b39a96e6b5e43527dc6bb8c8f1584 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 2 May 2019 09:22:48 +0530 Subject: [PATCH 2/2] fix: simplify sort condition --- erpnext/accounts/report/financial_statements.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py index eea77ed610..214031582f 100644 --- a/erpnext/accounts/report/financial_statements.py +++ b/erpnext/accounts/report/financial_statements.py @@ -331,12 +331,8 @@ def sort_accounts(accounts, is_root=False, key="name"): if a.root_type == "Income" and b.root_type == "Expense": return -1 else: - if re.split('\W+', a[key])[0].isdigit(): - # if chart of accounts is numbered, then sort by number - return cmp(a[key], b[key]) - else: - # common, this should be alphabetic otherwise! - return cmp(a[key], b[key]) + # sort by key (number) or name + return cmp(a[key], b[key]) return 1 accounts.sort(key = functools.cmp_to_key(compare_accounts))