Files
erpnext/erpnext/utilities/__init__.py
Chillar Anand 4b2be2999f chore: Cleanup imports (#27320)
* chore: Added isort to pre-commit config

* chore: Sort imports with isort

* chore: Remove imports with pycln

* chore: Sort imports with isort

* chore: Fix import issues

* chore: Fix sider issues

* chore: linting

* chore: linting / sorting import

from ecommerce refactor merge

* ci: dont allow unused imports

* chore: sort / clean ecommerce imports

Co-authored-by: Ankush Menat <ankush@iwebnotes.com>
2021-09-03 18:57:43 +05:30

39 lines
1.0 KiB
Python

## temp utility
from __future__ import print_function, unicode_literals
import frappe
from frappe.utils import cstr
from erpnext.utilities.activation import get_level
def update_doctypes():
for d in frappe.db.sql("""select df.parent, df.fieldname
from tabDocField df, tabDocType dt where df.fieldname
like "%description%" and df.parent = dt.name and dt.istable = 1""", as_dict=1):
dt = frappe.get_doc("DocType", d.parent)
for f in dt.fields:
if f.fieldname == d.fieldname and f.fieldtype in ("Text", "Small Text"):
f.fieldtype = "Text Editor"
dt.save()
break
def get_site_info(site_info):
# called via hook
company = frappe.db.get_single_value('Global Defaults', 'default_company')
domain = None
if not company:
company = frappe.db.sql('select name from `tabCompany` order by creation asc')
company = company[0][0] if company else None
if company:
domain = frappe.get_cached_value('Company', cstr(company), 'domain')
return {
'company': company,
'domain': domain,
'activation': get_level()
}