[minor] delete permission for communication and other minor fixes

This commit is contained in:
mbauskar 2017-03-30 11:22:45 +05:30 committed by Nabin Hait
parent 54384c774f
commit 0678bf392d
4 changed files with 31 additions and 21 deletions

View file

@ -1411,7 +1411,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-03-28 16:05:32.976002",
"modified": "2017-03-29 23:06:16.469149",
"modified_by": "Administrator",
"module": "Core",
"name": "Communication",
@ -1462,7 +1462,7 @@
"apply_user_permissions": 1,
"cancel": 0,
"create": 0,
"delete": 0,
"delete": 1,
"email": 1,
"export": 0,
"if_owner": 1,

View file

@ -56,7 +56,7 @@ frappe.views.ListSidebar = Class.extend({
if(this.current_view === 'Kanban') {
this.kanban_board = route[3];
} else if (this.current_view === 'Inbox') {
this.email_account = route[3] || frappe.boot.all_accounts;
this.email_account = route[3];
}
}
@ -279,7 +279,8 @@ frappe.views.ListSidebar = Class.extend({
accounts = frappe.boot.email_accounts;
accounts.forEach(function(account) {
var route = ["List", "Communication", "Inbox", account.email_account].join('/');
email_account = (account.email_id == "All Accounts")? "All Accounts": account.email_account;
var route = ["List", "Communication", "Inbox", email_account].join('/');
if(!divider) {
$('<li role="separator" class="divider"></li>').appendTo($dropdown);
divider = true;

View file

@ -1,14 +1,12 @@
<div class="no-result">
<div class="msg-box no-border">
{% if(!frappe.model.can_create(doctype) && doctype == "Email Account") { %}
<p>{{ __("No Email Accounts Assigned") }}</p>
{% } else { %}
<p>{{ msg }}</p>
<p>
<button class="btn btn-primary btn-sm btn-no-result" list_view_doc="{{ doctype }}">
{{ label }}
</button>
</p>
{% } %}
</div>
<div class="msg-box no-border">
{% if(!frappe.model.can_create(doctype) && doctype == "Email Account") { %}
<p>{{ __("No Email Accounts Assigned") }}</p>
{% } else { %}
<p>{{ msg }}</p>
<p>
<button class="btn btn-primary btn-sm btn-no-result" list_view_doc="{{ doctype }}">
{{ label }}
</button>
</p>
{% } %}
</div>

View file

@ -47,7 +47,6 @@ frappe.views.InboxView = frappe.views.ListRenderer.extend({
init_settings: function() {
this._super();
// this.show_no_result = false;
this.filters = this.get_inbox_filters();
},
should_refresh: function() {
@ -86,9 +85,15 @@ frappe.views.InboxView = frappe.views.ListRenderer.extend({
])
}
else {
var op = "="
if (email_account == "All Accounts") {
op = "in";
email_account = frappe.boot.all_accounts
}
filters = default_filters.concat([
["Communication", "sent_or_received", "=", "Received", true],
["Communication", "email_account", "=", email_account, true],
["Communication", "email_account", op, email_account, true],
["Communication", "email_status", "not in", "Spam,Trash", true],
])
}
@ -110,8 +115,14 @@ frappe.views.InboxView = frappe.views.ListRenderer.extend({
get_current_email_account: function() {
var route = frappe.get_route();
if(!route[3] && frappe.boot.email_accounts.length) {
frappe.set_route("List", "Communication", "Inbox", frappe.boot.email_accounts[0].email_account);
} else if(route[3] && !frappe.boot.email_accounts.find(b => b.email_account === route[3])) {
if(frappe.boot.email_accounts[0].email_id == "All Accounts") {
email_account = "All Accounts"
} else {
email_account = frappe.boot.email_accounts[0].email_account
}
frappe.set_route("List", "Communication", "Inbox", email_account);
} else if(route[3] && route[3] != "All Accounts" &&
!frappe.boot.email_accounts.find(b => b.email_account === route[3])) {
// frappe.throw(__(`Email Account <b>${route[3] || ''}</b> not found`));
return ''
}