brotherton-erpnext/erpnext/patches/v4_2/set_company_country.py
2014-09-01 10:23:47 +05:30

16 lines
513 B
Python

# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
country = frappe.db.get_single_value("Global Defaults", "country")
if not country:
print "Country not specified in Global Defaults"
return
for company in frappe.db.sql_list("""select name from `tabCompany`
where ifnull(country, '')=''"""):
frappe.db.set_value("Company", company, "country", country)