brotherton-erpnext/erpnext/patches/v4_0/new_address_template.py

15 lines
438 B
Python
Raw Normal View History

from __future__ import unicode_literals
2014-06-05 09:14:16 +00:00
import frappe
def execute():
2014-06-05 12:04:59 +00:00
frappe.reload_doc("utilities", "doctype", "address_template")
2014-06-06 11:37:50 +00:00
if not frappe.db.sql("select name from `tabAddress Template`"):
2014-06-06 12:07:31 +00:00
try:
d = frappe.new_doc("Address Template")
2014-06-09 09:48:45 +00:00
d.update({"country":frappe.db.get_default("country") or
frappe.db.get_value("Global Defaults", "Global Defaults", "country")})
2014-06-06 12:07:31 +00:00
d.insert()
except:
print frappe.get_traceback()