fix: show Exit Questionnaire button only to the users with write access

- fix linter issues
This commit is contained in:
Rucha Mahabal 2021-12-07 13:04:23 +05:30
parent 3230741cde
commit 0a937dc050
5 changed files with 6 additions and 6 deletions

View File

@ -3,7 +3,7 @@
frappe.ui.form.on('Exit Interview', {
refresh: function(frm) {
if (!frm.doc.__islocal && !frm.doc.questionnaire_email_sent) {
if (!frm.doc.__islocal && !frm.doc.questionnaire_email_sent && frappe.boot.user.can_write.includes('Exit Interview')) {
frm.add_custom_button(__('Send Exit Questionnaire'), function () {
frm.trigger('send_exit_questionnaire');
});

View File

@ -28,9 +28,9 @@ class ExitInterview(Document):
'docstatus': ('!=', 2)
})
if doc:
frappe.throw(_('Exit Interview {0} already scheduled for Employee: {1}').format(
frappe.throw(_('Exit Interview {0} already exists for Employee: {1}').format(
get_link_to_form('Exit Interview', doc), frappe.bold(self.employee)),
title=_('Duplicate Document'))
frappe.DuplicateEntryError)
def set_employee_email(self):
employee = frappe.get_doc('Employee', self.employee)

View File

@ -4,5 +4,6 @@
# import frappe
import unittest
class TestExitInterview(unittest.TestCase):
pass

View File

@ -1,4 +1,5 @@
import frappe
# import frappe
def get_context(context):
# do your magic here

View File

@ -91,8 +91,6 @@ def get_columns():
]
def get_data(filters):
data = []
employee = frappe.qb.DocType('Employee')
interview = frappe.qb.DocType('Exit Interview')
fnf = frappe.qb.DocType('Full and Final Statement')