[minor] fix for custom perms

This commit is contained in:
Rushabh Mehta
2017-01-13 14:47:37 +05:30
parent d40e661ebd
commit af077dc616
2 changed files with 8 additions and 5 deletions

View File

@@ -8,17 +8,19 @@ from frappe.utils import cstr
from frappe import msgprint, throw, _
from frappe.model.document import Document
from frappe.permissions import get_doctypes_with_read
class NamingSeriesNotSetError(frappe.ValidationError): pass
class NamingSeries(Document):
def get_transactions(self, arg=None):
doctypes = list(set(frappe.db.sql_list("""select parent
from `tabDocField` df where fieldname='naming_series' and
exists(select * from `tabDocPerm` dp, `tabRole` role where dp.role = role.name and dp.parent = df.parent and not role.disabled)""")
from `tabDocField` df where fieldname='naming_series'""")
+ frappe.db.sql_list("""select dt from `tabCustom Field`
where fieldname='naming_series'""")))
doctypes = list(set(get_doctypes_with_read()) | set(doctypes))
prefixes = ""
for d in doctypes:
options = ""