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

@@ -52,7 +52,7 @@ def update_for_doc(doctype, doc):
exists = True
if not (filename.startswith("http://") or filename.startswith("https://")):
if not os.path.exists(webnotes.utils.get_path("public", "files", filename)):
if not os.path.exists(webnotes.utils.get_site_path(webnotes.conf.files_path, filename)):
exists = False
if exists:

View File

@@ -4,7 +4,7 @@
import webnotes, os, webnotes.utils
def execute():
files_path = webnotes.utils.get_path("public", "files")
files_path = webnotes.utils.get_site_path(webnotes.conf.files_path)
webnotes.conn.auto_commit_on_many_writes = 1
for f in webnotes.conn.sql("""select name, file_name from
@@ -14,4 +14,4 @@ def execute():
if os.path.exists(filepath):
webnotes.conn.set_value("File Data", f.name, "file_size", os.stat(filepath).st_size)
webnotes.conn.auto_commit_on_many_writes = 0
webnotes.conn.auto_commit_on_many_writes = 0

View File

@@ -1,10 +1,9 @@
import webnotes
cancelled = []
uncancelled = []
def execute():
global cancelled, uncancelled
cancelled = []
uncancelled = []
stock_entries = webnotes.conn.sql("""select * from `tabStock Entry`
where docstatus >= 1 and date(modified) >= "2013-08-16"
and ifnull(production_order, '') != '' and ifnull(bom_no, '') != ''
@@ -17,14 +16,12 @@ def execute():
where voucher_type='Stock Entry' and voucher_no=%s
and is_cancelled='No'""", entry.name, as_dict=True)
if res:
make_stock_entry_detail(entry, res)
make_stock_entry_detail(entry, res, cancelled, uncancelled)
if cancelled or uncancelled:
send_email()
send_email(cancelled, uncancelled)
def make_stock_entry_detail(entry, res):
global cancelled, uncancelled
def make_stock_entry_detail(entry, res, cancelled, uncancelled):
fg_item = webnotes.conn.get_value("Production Order", entry.production_order,
"production_item")
voucher_detail_entries_map = {}
@@ -87,9 +84,8 @@ def make_stock_entry_detail(entry, res):
uncancelled.append(se.doc.name)
def send_email():
def send_email(cancelled, uncancelled):
from webnotes.utils.email_lib import sendmail_to_system_managers
global cancelled, uncancelled
uncancelled = "we have undone the cancellation of the following Stock Entries through a patch:\n" + \
"\n".join(uncancelled) if uncancelled else ""
cancelled = "and cancelled the following Stock Entries:\n" + "\n".join(cancelled) \

View File

@@ -7,7 +7,7 @@ def execute():
webnotes.reload_doc("selling", "doctype", "shopping_cart_settings")
# create two default territories, one for home country and one named Rest of the World
from setup.doctype.setup_control.setup_control import create_territories
from setup.page.setup_wizard.setup_wizard import create_territories
create_territories()
webnotes.conn.set_value("Shopping Cart Settings", None, "default_territory", "Rest of the World")

View File

@@ -3,10 +3,6 @@
def execute():
import webnotes
from webnotes.model.code import get_obj
#sc_obj = get_obj("Sales Common")
from selling.doctype.sales_common import sales_common
si = webnotes.conn.sql("""select distinct si.name
from `tabSales Invoice` si, `tabSales Invoice Item` si_item
@@ -16,5 +12,4 @@ def execute():
and ifnull(si_item.sales_order, '') != ''
""")
for d in si:
sales_common.StatusUpdater(get_obj("Sales Invoice", d[0], with_children=1), \
1).update_all_qty()
webnotes.bean("Sales Invoice", d[0]).run_method("update_qty")

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()

View File

@@ -3,10 +3,8 @@
from __future__ import unicode_literals
patch_list = [
"execute:webnotes.reload_doc('core', 'doctype', 'doctype', force=True) #2013-07-15",
"execute:webnotes.reload_doc('core', 'doctype', 'docfield', force=True) #2013-07-15",
"execute:webnotes.reload_doc('core', 'doctype', 'doctype', force=True) #2013-07-16",
"execute:webnotes.reload_doc('core', 'doctype', 'docfield', force=True) #2013-07-16",
"execute:webnotes.reload_doc('core', 'doctype', 'doctype', force=True) #2013-10-15",
"execute:webnotes.reload_doc('core', 'doctype', 'docfield', force=True) #2013-10-15",
"execute:webnotes.reload_doc('core', 'doctype', 'docperm') #2013-07-16",
"execute:webnotes.reload_doc('core', 'doctype', 'page') #2013-07-16",
"execute:webnotes.reload_doc('core', 'doctype', 'report') #2013-07-16",
@@ -220,8 +218,17 @@ patch_list = [
"patches.september_2013.p04_unsubmit_serial_nos",
"patches.september_2013.p05_fix_customer_in_pos",
"patches.october_2013.fix_is_cancelled_in_sle",
"patches.october_2013.p01_update_delivery_note_prevdocs",
"patches.october_2013.p02_set_communication_status",
"patches.october_2013.p03_crm_update_status",
"execute:webnotes.delete_doc('DocType', 'Setup Control')",
"patches.october_2013.p04_wsgi_migration",
"patches.october_2013.p05_server_custom_script_to_file",
"patches.october_2013.repost_ordered_qty",
"patches.october_2013.repost_planned_qty",
"patches.october_2013.p06_rename_packing_list_doctype",
"execute:webnotes.delete_doc('DocType', 'Sales Common')",
"patches.october_2013.p09_update_naming_series_settings",
"patches.october_2013.p02_update_price_list_and_item_details_in_item_price",
"execute:webnotes.delete_doc('Report', 'Item-wise Price List')",
"patches.october_2013.p03_remove_sales_and_purchase_return_tool",