Merge remote-tracking branch 'upstream/wsgi' into HEAD

Conflicts:
	public/js/complete_setup.js
	setup/doctype/setup_control/setup_control.py
This commit is contained in:
Pratik Vyas
2013-10-25 14:07:48 +05:30
313 changed files with 3813 additions and 3018 deletions

View File

@@ -0,0 +1,13 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
webnotes.reload_doc("stock", "doctype", "delivery_note_item")
webnotes.conn.sql("""update `tabDelivery Note Item` set against_sales_order=prevdoc_docname
where prevdoc_doctype='Sales Order' """)
webnotes.conn.sql("""update `tabDelivery Note Item` set against_sales_invoice=prevdoc_docname
where prevdoc_doctype='Sales Invoice' """)

View File

@@ -0,0 +1,11 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
webnotes.reload_doc("core", "doctype", "communication")
webnotes.conn.sql("""update tabCommunication
set sent_or_received= if(ifnull(recipients, '')='', "Received", "Sent")""")

View File

@@ -0,0 +1,47 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
# reason field
def execute():
change_map = {
"Lead": [
["Lead Lost", "Lead"],
["Not interested", "Do Not Contact"],
["Opportunity Made", "Opportunity"],
["Contacted", "Replied"],
["Attempted to Contact", "Replied"],
["Contact in Future", "Interested"],
],
"Opportunity": [
["Quotation Sent", "Quotation"],
["Order Confirmed", "Quotation"],
["Opportunity Lost", "Lost"],
],
"Quotation": [
["Order Confirmed", "Ordered"],
["Order Lost", "Lost"]
],
"Support Ticket": [
["Waiting for Customer", "Replied"],
["To Reply", "Open"],
]
}
for dt, opts in change_map.items():
for status in opts:
webnotes.conn.sql("""update `tab%s` set status=%s where status=%s""" % \
(dt, "%s", "%s"), (status[1], status[0]))
for dt in ["Lead", "Opportunity"]:
for name in webnotes.conn.sql_list("""select name from `tab%s`""" % dt):
bean = webnotes.bean(dt, name)
before_status = bean.doc.status
bean.get_controller().set_status()
if bean.doc.status != before_status:
webnotes.conn.sql("""update `tab%s` set status=%s where name=%s""" % (dt, "%s", "%s"),
(bean.doc.status, name))

View File

@@ -0,0 +1,33 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
import webnotes.utils
import os
def execute():
base_path = webnotes.utils.get_base_path()
# Remove symlinks from public folder:
# - server.py
# - web.py
# - unsupported.html
# - blank.html
# - rss.xml
# - sitemap.xml
for file in ("server.py", "web.py", "unsupported.html", "blank.html", "rss.xml", "sitemap.xml"):
file_path = os.path.join(base_path, "public", file)
if os.path.exists(file_path):
os.remove(file_path)
# Remove wn-web files
# - js/wn-web.js
# - css/wn-web.css
for file_path in (("js", "wn-web.js"), ("css", "wn-web.css")):
file_path = os.path.join(base_path, "public", *file_path)
if os.path.exists(file_path):
os.remove(file_path)
# Remove update app page
webnotes.delete_doc("Page", "update-manager")

View File

@@ -0,0 +1,36 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
"""
Assuming that some kind of indentation exists:
- Find indentation of server custom script
- replace indentation with tabs
- Add line:
class CustomDocType(DocType):
- Add tab indented code after this line
- Write to file
- Delete custom script record
"""
import os
from webnotes.utils import get_site_base_path
from core.doctype.custom_script.custom_script import make_custom_server_script_file
for name, dt, script in webnotes.conn.sql("""select name, dt, script from `tabCustom Script`
where script_type='Server'"""):
if script.strip():
script = indent_using_tabs(script)
make_custom_server_script_file(dt, script)
def indent_using_tabs(script):
for line in script.split("\n"):
try:
indentation_used = line[:line.index("def ")]
script = script.replace(indentation_used, "\t")
break
except ValueError:
pass
return script

View File

@@ -0,0 +1,21 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes, os
def execute():
webnotes.reload_doc("core", "doctype", "doctype")
tables = webnotes.conn.sql_list("show tables")
if "tabPacked Item" not in tables:
webnotes.rename_doc("DocType", "Delivery Note Packing Item", "Packed Item", force=True)
webnotes.reload_doc("stock", "doctype", "packed_item")
if os.path.exists("app/stock/doctype/delivery_note_packing_item"):
os.system("rm -rf app/stock/doctype/delivery_note_packing_item")
if webnotes.conn.exists("DocType", "Delivery Note Packing Item"):
webnotes.delete_doc("DocType", "Delivery Note Packing Item")

View File

@@ -0,0 +1,10 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
# reset property setters for series
for name in ("Stock Settings", "Selling Settings", "Buying Settings", "HR Settings"):
webnotes.bean(name, name).save()