implemented get_site_info for erpnext and patch to move setup complete to system settings

This commit is contained in:
Anand Doshi 2016-06-25 19:51:48 +05:30
parent 5cba40b74f
commit f576f3b17b
4 changed files with 36 additions and 0 deletions

View File

@ -181,3 +181,5 @@ get_translated_dict = {
bot_parsers = [
'erpnext.utilities.bot.FindItemBot',
]
get_site_info = 'erpnext.utilities.get_site_info'

View File

@ -274,3 +274,4 @@ erpnext.patches.v7_0.update_mins_to_first_response
erpnext.patches.v6_20x.repost_valuation_rate_for_negative_inventory
erpnext.patches.v7_0.re_route
erpnext.patches.v7_0.create_warehouse_nestedset
erpnext.patches.v7_0.system_settings_setup_complete

View File

@ -0,0 +1,16 @@
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doctype('System Settings')
companies = frappe.db.sql("""select name, country
from tabCompany order by creation asc""", as_dict=True)
if companies:
frappe.db.set_value('System Settings', 'System Settings', 'setup_complete', 1)
for company in companies:
if company.country:
frappe.db.set_value('System Settings', 'System Settings', 'country', company.country)
break

View File

@ -14,3 +14,20 @@ def update_doctypes():
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.db.get_value('Company', company, 'domain')
return {
'company': company,
'domain': domain
}