2019-01-22 12:52:20 +00:00
|
|
|
from __future__ import unicode_literals
|
2017-11-17 06:59:26 +00:00
|
|
|
import frappe
|
|
|
|
from frappe import _
|
2019-11-06 11:33:12 +00:00
|
|
|
from frappe.model.rename_doc import rename_doc
|
2017-11-17 06:59:26 +00:00
|
|
|
|
|
|
|
def execute():
|
2018-04-12 09:18:23 +00:00
|
|
|
frappe.reload_doc('stock', 'doctype', 'item')
|
2017-11-17 06:59:26 +00:00
|
|
|
language = frappe.get_single("System Settings").language
|
|
|
|
|
2017-11-17 09:19:46 +00:00
|
|
|
if language and language.startswith('en'): return
|
|
|
|
|
|
|
|
frappe.local.lang = language
|
2017-11-17 06:59:26 +00:00
|
|
|
|
|
|
|
all_domains = frappe.get_hooks("domains")
|
|
|
|
|
|
|
|
for domain in all_domains:
|
|
|
|
translated_domain = _(domain, lang=language)
|
|
|
|
if frappe.db.exists("Domain", translated_domain):
|
2017-12-14 11:22:50 +00:00
|
|
|
#if domain already exists merged translated_domain and domain
|
|
|
|
merge = False
|
|
|
|
if frappe.db.exists("Domain", domain):
|
|
|
|
merge=True
|
|
|
|
|
2019-11-06 11:33:12 +00:00
|
|
|
rename_doc("Domain", translated_domain, domain, ignore_permissions=True, merge=merge)
|
2017-11-17 06:59:26 +00:00
|
|
|
|
|
|
|
domain_settings = frappe.get_single("Domain Settings")
|
|
|
|
active_domains = [d.domain for d in domain_settings.active_domains]
|
2019-11-06 11:33:12 +00:00
|
|
|
|
2017-11-17 09:19:46 +00:00
|
|
|
try:
|
|
|
|
for domain in active_domains:
|
|
|
|
domain = frappe.get_doc("Domain", domain)
|
|
|
|
domain.setup_domain()
|
2017-11-17 06:59:26 +00:00
|
|
|
|
2017-11-17 09:19:46 +00:00
|
|
|
if int(frappe.db.get_single_value('System Settings', 'setup_complete')):
|
|
|
|
domain.setup_sidebar_items()
|
|
|
|
domain.setup_desktop_icons()
|
|
|
|
domain.set_default_portal_role()
|
|
|
|
except frappe.LinkValidationError:
|
|
|
|
pass
|