brotherton-erpnext/erpnext/patches/v7_0/system_settings_setup_complete.py

17 lines
467 B
Python

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