Merge pull request #17435 from rmehta/coa-sorting

fix(minor): chart of accounts sorting and message
This commit is contained in:
Nabin Hait 2019-05-02 11:57:08 +05:30 committed by GitHub
commit 5a7c5bc4dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 5 deletions

View File

@ -331,9 +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])
# sort by key (number) or name
return cmp(a[key], b[key])
return 1
accounts.sort(key = functools.cmp_to_key(compare_accounts))

View File

@ -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];
}

View File

@ -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)