Merge pull request #7477 from rmehta/custom-perms

[minor] fix for custom perms
This commit is contained in:
Nabin Hait 2017-01-18 17:03:58 +05:30 committed by GitHub
commit 6b3670848e
2 changed files with 8 additions and 5 deletions

View File

@ -374,7 +374,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"description": "Warehouse for reserving items", "description": "",
"fieldname": "source_warehouse", "fieldname": "source_warehouse",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -383,7 +383,7 @@
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Source Warehouse", "label": "Source Warehouse (for reserving Items)",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"options": "Warehouse", "options": "Warehouse",
@ -1244,7 +1244,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-11-07 05:13:02.064821", "modified": "2017-01-12 05:32:52.523006",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Production Order", "name": "Production Order",
@ -1298,5 +1298,6 @@
"read_only_onload": 0, "read_only_onload": 0,
"sort_order": "ASC", "sort_order": "ASC",
"title_field": "production_item", "title_field": "production_item",
"track_changes": 0,
"track_seen": 0 "track_seen": 0
} }

View File

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