blob: 9dfe6b4a0228fcfb5d9289c76c737e85c4f9e759 [file] [log] [blame]
Rushabh Mehtae67d1fb2013-08-05 14:59:54 +05301# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
2# License: GNU General Public License v3. See license.txt
3
Rushabh Mehta6382a422013-01-23 10:09:28 +05304import webnotes
5
6def execute():
7 # get all currencies
8 webnotes.reload_doc("setup", "doctype", "currency")
9 clist = [webnotes.conn.get_default("currency")]
10 for f in webnotes.conn.sql("""select parent, fieldname from tabDocField
11 where options in ('Currency', 'link:Currency')""", as_dict=1):
12 if not webnotes.conn.get_value("DocType", f.parent, "issingle"):
13 clist += [c[0] for c in webnotes.conn.sql("""select distinct `%s`
14 from `tab%s`""" % (f.fieldname, f.parent))]
15
16 clist = list(set(clist))
17 for c in clist:
18 if c:
19 webnotes.conn.sql("""update tabCurrency set `enabled`=1 where name=%s""", c)