[minor] use reload_doc instead of reload_doctype
This commit is contained in:
parent
73167eae60
commit
3c1a53c325
@ -7,14 +7,13 @@ import erpnext
|
|||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
"""Create domain documents"""
|
"""Create domain documents"""
|
||||||
frappe.reload_doctype("Domain")
|
frappe.reload_doc("core", "doctype", "domain")
|
||||||
|
frappe.reload_doc("core", "doctype", "domain_settings")
|
||||||
|
frappe.reload_doc("core", "doctype", "has_domain")
|
||||||
|
|
||||||
for domain in ("Distribution", "Manufacturing", "Retail", "Services", "Education"):
|
for domain in ("Distribution", "Manufacturing", "Retail", "Services", "Education"):
|
||||||
if not frappe.db.exists({'doctype': 'Domain', 'domain': domain}):
|
if not frappe.db.exists({"doctype": "Domain", "domain": domain}):
|
||||||
doc = frappe.new_doc("Domain")
|
create_domain(domain)
|
||||||
doc.domain = domain
|
|
||||||
doc.save()
|
|
||||||
|
|
||||||
|
|
||||||
# set domain in domain settings based on company domain
|
# set domain in domain settings based on company domain
|
||||||
|
|
||||||
@ -37,6 +36,17 @@ def execute():
|
|||||||
if domain in checked_domains:
|
if domain in checked_domains:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if not frappe.db.get_value("Domain", domain):
|
||||||
|
# user added custom domain in companies domain field
|
||||||
|
create_domain(domain)
|
||||||
|
|
||||||
row = domain_settings.append("active_domains", dict(domain=domain))
|
row = domain_settings.append("active_domains", dict(domain=domain))
|
||||||
|
|
||||||
domain_settings.save(ignore_permissions=True)
|
domain_settings.save(ignore_permissions=True)
|
||||||
|
|
||||||
|
def create_domain(domain):
|
||||||
|
# create new domain
|
||||||
|
|
||||||
|
doc = frappe.new_doc("Domain")
|
||||||
|
doc.domain = domain
|
||||||
|
doc.db_update()
|
Loading…
x
Reference in New Issue
Block a user