Fixes in user permissions patches

This commit is contained in:
Anand Doshi
2014-05-29 20:07:10 +05:30
parent 37993dd713
commit cdc1b640d9
7 changed files with 73 additions and 574 deletions

View File

@@ -11,6 +11,8 @@ import frappe.permissions
from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc
class EmployeeUserDisabledError(frappe.ValidationError): pass
class Employee(Document):
def onload(self):
self.get("__onload").salary_structure_exists = frappe.db.get_value("Salary Structure",
@@ -133,7 +135,7 @@ class Employee(Document):
enabled = frappe.db.sql("""select name from `tabUser` where
name=%s and enabled=1""", self.user_id)
if not enabled:
throw(_("User {0} is disabled").format(self.user_id))
throw(_("User {0} is disabled").format(self.user_id), EmployeeUserDisabledError)
def validate_duplicate_user_id(self):
employee = frappe.db.sql_list("""select name from `tabEmployee` where