Skip to content

Commit

Permalink
Don't show submit, cancel, amend buttons for non submittable doctypes (
Browse files Browse the repository at this point in the history
  • Loading branch information
netchampfaris authored and rmehta committed Nov 10, 2017
1 parent 9615619 commit e617dfb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions frappe/core/page/permission_manager/permission_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ frappe.PermissionEngine = Class.extend({
role: me.get_role()
},
callback: function(r) {
me.render(r.message);
frappe.model.with_doc('DocType', me.get_doctype(), () => {
me.render(r.message);
});
}
});
},
Expand Down Expand Up @@ -209,7 +211,10 @@ frappe.PermissionEngine = Class.extend({
var perm_cell = me.add_cell(row, d, "permissions").css("padding-top", 0);
var perm_container = $("<div class='row'></div>").appendTo(perm_cell);

$.each(me.rights, function(i, r) {
const { is_submittable } = frappe.model.get_doc('DocType', me.get_doctype());

me.rights.forEach(r => {
if (!is_submittable && ['submit', 'cancel', 'amend'].includes(r)) return;
me.add_check(perm_container, d, r);
});

Expand Down

0 comments on commit e617dfb

Please sign in to comment.