Rushabh Mehta | 6382a42 | 2013-01-23 10:09:28 +0530 | [diff] [blame] | 1 | import webnotes |
| 2 | |
| 3 | def 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) |