[minor] fixed globals and patch for wsgi migration
This commit is contained in:
parent
ddca90ef7b
commit
7798934989
@ -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) \
|
||||
|
30
patches/october_2013/p04_wsgi_migration.py
Normal file
30
patches/october_2013/p04_wsgi_migration.py
Normal file
@ -0,0 +1,30 @@
|
||||
# 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)
|
@ -224,4 +224,5 @@ patch_list = [
|
||||
"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",
|
||||
]
|
@ -75,7 +75,7 @@ def _simulate():
|
||||
|
||||
for i in xrange(runs_for):
|
||||
print current_date.strftime("%Y-%m-%d")
|
||||
webnotes.utils.current_date = current_date
|
||||
webnotes.local.current_date = current_date
|
||||
|
||||
if current_date.weekday() in (5, 6):
|
||||
current_date = webnotes.utils.add_days(current_date, 1)
|
||||
|
@ -6,8 +6,8 @@ import webnotes, os
|
||||
import utilities.demo.make_demo
|
||||
|
||||
def make_demo_app(site=None):
|
||||
webnotes.flags.mute_emails = 1
|
||||
webnotes.init(site=site)
|
||||
webnotes.flags.mute_emails = 1
|
||||
|
||||
utilities.demo.make_demo.make(reset=True, simulate=False)
|
||||
# setup demo user etc so that the site it up faster, while the data loads
|
||||
|
Loading…
x
Reference in New Issue
Block a user