Procházet zdrojové kódy

[fix] Domain Setting patch (#4464)

* [fix] Domain Setting patch

* minor fix

* Update domain.py
version-14
Faris Ansari před 7 roky
committed by Nabin Hait
rodič
revize
cd32e87b98
2 změnil soubory, kde provedl 9 přidání a 2 odebrání
  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 Zobrazit soubor

@@ -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 Zobrazit soubor

@@ -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

Načítá se…
Zrušit
Uložit