瀏覽代碼

[fix] Domain Setting patch (#4464)

* [fix] Domain Setting patch

* minor fix

* Update domain.py
version-14
Faris Ansari 7 年之前
committed by Nabin Hait
父節點
當前提交
cd32e87b98
共有 2 個文件被更改,包括 9 次插入2 次删除
  1. +4
    -0
      frappe/core/doctype/domain/domain.py
  2. +5
    -2
      frappe/patches/v9_1/resave_domain_settings.py

+ 4
- 0
frappe/core/doctype/domain/domain.py 查看文件

@@ -36,6 +36,10 @@ class Domain(Document):
'''Enable roles that are restricted to this domain'''
if self.data.restricted_roles:
for role_name in self.data.restricted_roles:
if not frappe.db.get_value('Role', role_name):
frappe.get_doc(dict(doctype='Role', role_name=role_name)).insert()
continue

role = frappe.get_doc('Role', role_name)
role.disabled = 0
role.save()


+ 5
- 2
frappe/patches/v9_1/resave_domain_settings.py 查看文件

@@ -1,7 +1,10 @@
import frappe

def execute():
domains = ['Education', 'Healthcare', 'Hospitality']
try:
frappe.get_single('Domain Settings').save()
for d in domains:
domain = frappe.get_doc('Domain', d)
domain.setup_domain()
except frappe.LinkValidationError:
pass
pass

Loading…
取消
儲存