Browse Source

[minor] automatically add restrict to domain if not added

version-14
Rushabh Mehta 7 years ago
parent
commit
ea42530112
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      frappe/core/doctype/doctype/doctype.py

+ 3
- 0
frappe/core/doctype/doctype/doctype.py View File

@@ -753,6 +753,9 @@ def validate_permissions(doctype, for_remove=False):
def make_module_and_roles(doc, perm_fieldname="permissions"): def make_module_and_roles(doc, perm_fieldname="permissions"):
"""Make `Module Def` and `Role` records if already not made. Called while installing.""" """Make `Module Def` and `Role` records if already not made. Called while installing."""
try: try:
if doc.restrict_to_domain and not frappe.db.exists('Domain', doc.restrict_to_domain):
frappe.get_doc(doctype='Domain', domain=doc.restrict_to_domain).insert()

if not frappe.db.exists("Module Def", doc.module): if not frappe.db.exists("Module Def", doc.module):
m = frappe.get_doc({"doctype": "Module Def", "module_name": doc.module}) m = frappe.get_doc({"doctype": "Module Def", "module_name": doc.module})
m.app_name = frappe.local.module_app[frappe.scrub(doc.module)] m.app_name = frappe.local.module_app[frappe.scrub(doc.module)]


Loading…
Cancel
Save