mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-05 13:24:47 +00:00
started fresh install and added country_info
This commit is contained in:
12
patches/january_2013/change_patch_structure.py
Normal file
12
patches/january_2013/change_patch_structure.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
webnotes.reload_doc("core", "doctype", "patch_log")
|
||||
for d in webnotes.conn.sql("""select patch from __PatchLog"""):
|
||||
webnotes.doc({
|
||||
"doctype": "Patch Log",
|
||||
"patch": d[0]
|
||||
}).insert()
|
||||
|
||||
webnotes.conn.commit()
|
||||
webnotes.conn.sql("drop table __PatchLog")
|
||||
27
patches/january_2013/update_country_info.py
Normal file
27
patches/january_2013/update_country_info.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
from webnotes.country_info import get_all
|
||||
data = get_all()
|
||||
|
||||
webnotes.reload_doc("setup", "doctype", "country")
|
||||
webnotes.reload_doc("setup", "doctype", "currency")
|
||||
|
||||
for c in webnotes.conn.sql("""select name from tabCountry"""):
|
||||
if c[0] in data:
|
||||
info = webnotes._dict(data[c[0]])
|
||||
doc = webnotes.doc("Country", c[0])
|
||||
doc.date_format = info.date_format or "dd-mm-yyyy"
|
||||
doc.time_zones = "\n".join(info.timezones or [])
|
||||
doc.save()
|
||||
|
||||
if webnotes.conn.exists("Currency", info.currency):
|
||||
doc = webnotes.doc("Currency", info.currency)
|
||||
doc.fields.update({
|
||||
"fraction": info.currency_fraction,
|
||||
"symbol": info.currency_symbol,
|
||||
"fraction_units": info.currency_fraction_units
|
||||
})
|
||||
doc.save()
|
||||
Reference in New Issue
Block a user