brotherton-erpnext/erpnext/utilities/__init__.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
988 B
Python
Raw Normal View History

## temp utility
import frappe
from frappe.utils import cstr
2017-02-16 09:21:48 +00:00
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
2022-03-28 13:22:46 +00:00
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:
2018-08-08 11:07:31 +00:00
domain = frappe.get_cached_value("Company", cstr(company), "domain")
2017-02-16 09:21:48 +00:00
return {"company": company, "domain": domain, "activation": get_level()}