From ef0ab5d9aab2390de7ef041b1f73309428ce1545 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 29 Jul 2013 13:06:50 +0530 Subject: [PATCH] [patch] [minor] set price list currency, where only one currency is used for item price --- patches/july_2013/p11_update_price_list_currency.py | 9 +++++++++ patches/patch_list.py | 1 + 2 files changed, 10 insertions(+) create mode 100644 patches/july_2013/p11_update_price_list_currency.py diff --git a/patches/july_2013/p11_update_price_list_currency.py b/patches/july_2013/p11_update_price_list_currency.py new file mode 100644 index 0000000000..887149da15 --- /dev/null +++ b/patches/july_2013/p11_update_price_list_currency.py @@ -0,0 +1,9 @@ +import webnotes + +def execute(): + for price_list_name in webnotes.conn.sql_list("""select name from `tabPrice List` + where ifnull(currency, '')=''"""): + res = webnotes.conn.sql("""select distinct ref_currency from `tabItem Price` + where price_list_name=%s""", price_list_name) + if res and len(res)==1 and res[0][0]: + webnotes.conn.set_value("Price List", price_list_name, "currency", res[0][0]) diff --git a/patches/patch_list.py b/patches/patch_list.py index 9b6bb0f2dd..b60ca13779 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -262,4 +262,5 @@ patch_list = [ "patches.july_2013.p08_custom_print_format_net_total_export", "patches.july_2013.p09_remove_website_pyc", "patches.july_2013.p10_change_partner_user_to_website_user", + "patches.july_2013.p11_update_price_list_currency", ] \ No newline at end of file