[merge conflict]

This commit is contained in:
Nabin Hait
2013-06-05 12:37:10 +05:30
220 changed files with 4854 additions and 5516 deletions

View File

@@ -1,5 +1,4 @@
import webnotes, webnotes.utils, os
from webnotes.modules.export_file import export_to_files
def execute():
webnotes.reload_doc("core", "doctype", "file_data")
@@ -71,4 +70,4 @@ def update_for_doc(doctype, doc):
pass
else:
webnotes.conn.sql("""delete from `tabFile Data` where name=%s""",
fileid)
fileid)

View File

@@ -1,10 +1,10 @@
import webnotes
def execute():
for dt, fieldname in \
(("Journal Voucher Detail", "cost_center"),
("Sales Taxes and Charges", "cost_center_other_charges"),
("Purchase Taxes and Charges", "cost_center"), ("Delivery Note Item", "cost_center"),
("Purchase Invoice Item", "cost_center"), ("Sales Invoice Item", "cost_center")):
webnotes.conn.sql_ddl("""alter table `tab%s` alter `%s` drop default""" % (dt, fieldname))
webnotes.reload_doc("Stock", "DocType", "Delivery Note Item")
for dt in ("Journal Voucher Detail", "Sales Taxes and Charges",
"Purchase Taxes and Charges", "Delivery Note Item",
"Purchase Invoice Item", "Sales Invoice Item"):
webnotes.conn.sql_ddl("""alter table `tab%s` alter `cost_center` drop default""" \
% (dt,))
webnotes.reload_doc(webnotes.conn.get_value("DocType", dt, "module"), "DocType", dt)

View File

@@ -0,0 +1,9 @@
import webnotes
def execute():
webnotes.reload_doc("Accounts", "DocType", "Sales Taxes and Charges")
webnotes.conn.sql("""update `tabSales Taxes and Charges`
set cost_center = cost_center_other_charges""")
webnotes.conn.sql_ddl("""alter table `tabSales Taxes and Charges`
drop column cost_center_other_charges""")

View File

@@ -0,0 +1,16 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint
def execute():
for module, doctype in (("Accounts", "Sales Invoice"), ("Selling", "Sales Order"), ("Selling", "Quotation"),
("Stock", "Delivery Note")):
webnotes.reload_doc(module, "DocType", doctype)
webnotes.conn.sql("""update `tab%s`
set net_total_export = round(net_total / if(conversion_rate=0, 1, ifnull(conversion_rate, 1)), 2),
other_charges_total_export = round(grand_total_export - net_total_export, 2)""" %
(doctype,))
for module, doctype in (("Accounts", "Sales Invoice Item"), ("Selling", "Sales Order Item"), ("Selling", "Quotation Item"),
("Stock", "Delivery Note Item")):
webnotes.reload_doc(module, "DocType", doctype)

View File

@@ -0,0 +1,28 @@
import webnotes, markdown2
def execute():
webnotes.reload_doc("utilities", "doctype", "note")
webnotes.reload_doc("utilities", "doctype", "note_user")
for question in webnotes.conn.sql("""select * from tabQuestion""", as_dict=True):
if question.question:
name = question.question[:180]
if webnotes.conn.exists("Note", name):
webnotes.delete_doc("Note", name)
note = webnotes.bean({
"doctype":"Note",
"title": name,
"content": "<hr>".join([markdown2.markdown(c) for c in webnotes.conn.sql_list("""
select answer from tabAnswer where question=%s""", question.name)]),
"owner": question.owner,
"creation": question.creation,
"public": 1
}).insert()
webnotes.delete_doc("DocType", "Question")
webnotes.delete_doc("DocType", "Answer")
webnotes.bean("Style Settings").save()
# update comment delete
webnotes.conn.sql("""update tabDocPerm \
set cancel=1 where parent='Comment' and role='System Manager'""")

View File

@@ -0,0 +1,23 @@
import webnotes, webnotes.defaults
from webnotes.utils import cint
def execute():
webnotes.reload_doc("accounts", "doctype", "pos_setting")
webnotes.conn.sql("""update `tabPOS Setting` set update_stock=%s""",
cint(webnotes.defaults.get_global_default("update_stock")))
webnotes.conn.sql("""delete from `tabSingles`
where doctype='Global Defaults' and field='update_stock'""")
webnotes.conn.sql("""delete from `tabDefaultValue`
where parent='Control Panel' and defkey="update_stock" """)
webnotes.defaults.clear_cache("Control Panel")
webnotes.reload_doc("setup", "doctype", "global_defaults")
# previously, update_stock was valid only when is_pos was checked
# henceforth it is valid, and hence the patch
webnotes.conn.sql("""update `tabSales Invoice` set update_stock=0
where ifnull(is_pos, 0)=0""")

View File

@@ -0,0 +1,23 @@
import webnotes
import json
from webnotes.utils import flt
def execute():
for doctype in ["Purchase Taxes and Charges", "Sales Taxes and Charges"]:
for tax_name, item_wise_tax_detail in \
webnotes.conn.sql("""select name, item_wise_tax_detail from `tab%s`""" % doctype):
if not item_wise_tax_detail or not isinstance(item_wise_tax_detail, basestring):
continue
try:
json.loads(item_wise_tax_detail)
except ValueError:
out = {}
for t in item_wise_tax_detail.split("\n"):
if ":" in t:
account_head, amount = t.split(":")
out[account_head.strip()] = flt(amount.strip())
if out:
webnotes.conn.sql("""update `tab%s` set item_wise_tax_detail=%s
where name=%s""" % (doctype, "%s", "%s"), (json.dumps(out), tax_name))

View File

@@ -240,17 +240,21 @@ patch_list = [
"patches.april_2013.p06_update_file_size",
"patches.april_2013.p05_fixes_in_reverse_modules",
"execute:webnotes.delete_doc('DocType Mapper', 'Delivery Note-Packing Slip')",
"execute:webnotes.reload_doc('Stock', 'DocType', 'Delivery Note Item')",
"patches.april_2013.p07_rename_cost_center_other_charges",
"patches.april_2013.p06_default_cost_center",
"execute:webnotes.reset_perms('File Data')",
"patches.april_2013.p07_update_file_data_2",
"patches.april_2013.rebuild_sales_browser",
"patches.april_2013.p08_price_list_country",
"patches.may_2013.p01_selling_net_total_export",
"patches.may_2013.repost_stock_for_no_posting_time",
"patches.may_2013.p01_conversion_factor_and_aii",
"patches.may_2013.p02_update_valuation_rate",
"patches.may_2013.p03_update_support_ticket",
"patches.may_2013.p04_reorder_level",
"patches.may_2013.p05_update_cancelled_gl_entries",
"patches.may_2013.p06_make_notes",
"patches.may_2013.p07_move_update_stock_to_pos",
"patches.may_2013.p08_change_item_wise_tax",
"patches.june_2013.p01_update_bom_exploded_items",
]