1. Reports List - allow read permission to All

2. Display message when ToDo doesnt contain any item
This commit is contained in:
Anand Doshi 2012-06-13 18:02:43 +05:30
parent d104f4bc32
commit 47afacc8e9
3 changed files with 43 additions and 3 deletions

View File

@ -0,0 +1,18 @@
def execute():
"""allow read permission to all for report list"""
import webnotes
import webnotes.model.doc
new_perms = [
{
'parent': 'Report',
'parentfield': 'permissions',
'parenttype': 'DocType',
'role': 'All',
'permlevel': 0,
'read': 1,
},
]
for perms in new_perms:
doc = webnotes.model.doc.Document('DocPerm')
doc.fields.update(perms)
doc.save()

View File

@ -427,4 +427,9 @@ patch_list = [
'patch_file': 'fetch_organization_from_lead',
'description': 'Fetch organization from lead in quote'
},
{
'patch_module': 'patches.june_2012',
'patch_file': 'reports_list_permission',
'description': 'allow read permission to all for report list'
},
]

View File

@ -20,14 +20,31 @@ erpnext.todo.refresh = function() {
wn.call({
method: 'utilities.page.todo.todo.get',
callback: function(r,rt) {
$('#todo-list div.todo-content').empty();
$('#assigned-todo-list div.todo-content').empty();
var todo_list = $('#todo-list div.todo-content');
var assigned_todo_list = $('#assigned-todo-list div.todo-content');
todo_list.empty();
assigned_todo_list.empty();
var nothing_to_do = function() {
$('#todo-list div.todo-content')
.html('<div class="help-box">Nothing to do :)</div>');
}
var nothing_delegated = function() {
$('#assigned-todo-list div.todo-content')
.html('<div class="help-box">Nothing assigned to other users. \
Use "Assign To" in a form to delegate work.</div>');
}
if(r.message) {
for(var i in r.message) {
new erpnext.todo.ToDoItem(r.message[i]);
}
if (!todo_list.html()) { nothing_to_do(); }
if (!assigned_todo_list.html()) { nothing_delegated(); }
} else {
$('#todo-list').html('<div class="help-box">Nothing to do :)</div>');
nothing_to_do();
nothing_delegated();
}
}
});