blob: ed9860f5dec361a98b3ad1ee5e6b963b23e06056 [file] [log] [blame]
Rushabh Mehta6382a422013-01-23 10:09:28 +05301import webnotes
2
3def execute():
4 # get all currencies
5 webnotes.reload_doc("setup", "doctype", "currency")
6 clist = [webnotes.conn.get_default("currency")]
7 for f in webnotes.conn.sql("""select parent, fieldname from tabDocField
8 where options in ('Currency', 'link:Currency')""", as_dict=1):
9 if not webnotes.conn.get_value("DocType", f.parent, "issingle"):
10 clist += [c[0] for c in webnotes.conn.sql("""select distinct `%s`
11 from `tab%s`""" % (f.fieldname, f.parent))]
12
13 clist = list(set(clist))
14 for c in clist:
15 if c:
16 webnotes.conn.sql("""update tabCurrency set `enabled`=1 where name=%s""", c)