2013-11-20 07:29:58 +00:00
|
|
|
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
2013-08-12 14:31:55 +00:00
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
|
|
|
|
from __future__ import unicode_literals
|
2013-08-09 09:59:59 +00:00
|
|
|
import webnotes
|
|
|
|
|
|
|
|
def execute():
|
2013-09-21 08:13:48 +00:00
|
|
|
webnotes.reload_doc("selling", "doctype", "shopping_cart_price_list")
|
2013-10-31 07:05:52 +00:00
|
|
|
webnotes.reload_doc("stock", "doctype", "item_price")
|
2013-08-15 09:09:12 +00:00
|
|
|
|
2013-08-09 09:59:59 +00:00
|
|
|
for t in [
|
|
|
|
("Supplier Quotation", "price_list_name", "buying_price_list"),
|
|
|
|
("Purchase Order", "price_list_name", "buying_price_list"),
|
|
|
|
("Purchase Invoice", "price_list_name", "buying_price_list"),
|
|
|
|
("Purchase Receipt", "price_list_name", "buying_price_list"),
|
|
|
|
("Quotation", "price_list_name", "selling_price_list"),
|
|
|
|
("Sales Order", "price_list_name", "selling_price_list"),
|
|
|
|
("Delivery Note", "price_list_name", "selling_price_list"),
|
|
|
|
("Sales Invoice", "price_list_name", "selling_price_list"),
|
|
|
|
("POS Setting", "price_list_name", "selling_price_list"),
|
|
|
|
("Shopping Cart Price List", "price_list", "selling_price_list"),
|
|
|
|
("Item Price", "price_list_name", "price_list"),
|
|
|
|
("BOM", "price_list", "buying_price_list"),
|
|
|
|
]:
|
2013-08-12 06:59:36 +00:00
|
|
|
table_columns = webnotes.conn.get_table_columns(t[0])
|
|
|
|
if t[2] in table_columns and t[1] in table_columns:
|
2013-08-09 12:41:35 +00:00
|
|
|
# already reloaded, so copy into new column and drop old column
|
|
|
|
webnotes.conn.sql("""update `tab%s` set `%s`=`%s`""" % (t[0], t[2], t[1]))
|
2013-08-14 13:54:36 +00:00
|
|
|
webnotes.conn.sql_ddl("""alter table `tab%s` drop column `%s`""" % (t[0], t[1]))
|
2013-08-12 06:59:36 +00:00
|
|
|
elif t[1] in table_columns:
|
2013-08-09 12:41:35 +00:00
|
|
|
webnotes.conn.sql_ddl("alter table `tab%s` change `%s` `%s` varchar(180)" % t)
|
|
|
|
|
|
|
|
webnotes.reload_doc(webnotes.conn.get_value("DocType", t[0], "module"), "DocType", t[0])
|
2013-08-09 09:59:59 +00:00
|
|
|
|
|
|
|
webnotes.conn.sql("""update tabSingles set field='selling_price_list'
|
|
|
|
where field='price_list_name' and doctype='Selling Settings'""")
|
2013-08-09 12:41:35 +00:00
|
|
|
|
|
|
|
webnotes.reload_doc("Selling", "DocType", "Selling Settings")
|
|
|
|
webnotes.bean("Selling Settings").save()
|
|
|
|
|
|
|
|
|