Ver código fonte

[fix] Domain Setting patch (#4464)

* [fix] Domain Setting patch

* minor fix

* Update domain.py
version-14
Faris Ansari 7 anos atrás
committed by Nabin Hait
pai
commit
cd32e87b98
2 arquivos alterados com 9 adições e 2 exclusões
  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 Ver arquivo

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

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

Carregando…
Cancelar
Salvar