[minor] [patch] removed patches from march to august 2012

This commit is contained in:
Anand Doshi 2013-09-21 13:43:48 +05:30
parent 7cd7fc94ad
commit f0fc9a54ee
68 changed files with 2 additions and 1578 deletions

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,9 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.model import delete_doc
webnotes.conn.sql("update `tabDocType` set module = 'Utilities' where name in ('Question', 'Answer')")
delete_doc('Module Def', 'Knowledge Base')

View File

@ -1,10 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.model import delete_doc
delete_doc('DocType', 'About Us Team')
delete_doc('DocType', 'About Us Settings')
delete_doc('DocType', 'Contact Us Settings')

View File

@ -1,16 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.model.code import get_obj
ns_list = webnotes.conn.sql("""\
SELECT `tabDocField`.`parent`, `tabDocField`.`options`
FROM `tabDocField`, `tabDocType`
WHERE `tabDocField`.`fieldname` = 'naming_series'
AND `tabDocType`.name=`tabDocField`.parent""")
ns_obj = get_obj('Naming Series')
for ns in ns_list:
if ns[0] and isinstance(ns[1], basestring):
ns_obj.set_series_for(ns[0], ns[1].split("\n"))

View File

@ -1,8 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.modules import reload_doc
reload_doc('accounts', 'doctype', 'c_form')

View File

@ -1,7 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("update `tabDocField` set `default` = '' where fieldname = 'cost_center' and parent = 'RV Detail' and `default` = 'Purchase - TC'")

View File

@ -1,16 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
res = webnotes.conn.sql("""select distinct item_code, warehouse from `tabStock Ledger Entry`
where posting_time > '00:00:00' and posting_time < '00:01:00'""", as_dict=1)
webnotes.conn.sql("update `tabStock Ledger Entry` set posting_time = '00:00:00' where posting_time > '00:00:00' and posting_time < '00:01:00'")
from stock.stock_ledger import update_entries_after
for d in res:
update_entries_after({
"item_code": d.item_code,
"warehouse": d.warehouse,
})

View File

@ -1,18 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.model.doc import addchild
from webnotes.model.code import get_obj
webnotes.conn.sql("delete from `tabDocPerm` where role = 'All' and permlevel = 0 and parent in ('Appraisal', 'Ticket', 'Project')")
appr = get_obj('DocType', 'Appraisal', with_children=1)
ch = addchild(appr.doc, 'permissions', 'DocPerm')
ch.permlevel = 0
ch.role = 'Employee'
ch.read = 1
ch.write = 1
ch.save()

View File

@ -1,7 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("update `tabDocPerm` set permlevel = 0 where parent = 'Address'")

View File

@ -1,25 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.model.doc import addchild
from webnotes.model.code import get_obj
webnotes.conn.sql("delete from `tabDocPerm` where role = 'All' and parent = 'Address'")
role1 = ['Sales User', 'Purchase User', 'Accounts User', 'Maintenance User']
role2 = ['Sales Manager', 'Sales Master Manager', 'Purchase Manager', 'Purchase Master Manager', 'Accounts Manager', 'Maintenance Manager']
addr = get_obj('DocType', 'Address', with_children=1)
for d in role1+role2:
ch = addchild(addr.doc, 'permissions', 'DocPerm')
ch.role = d
ch.read = 1
ch.write = 1
ch.create = 1
if d in role2:
ch.cancel = 1
ch.save()

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,37 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
import webnotes.model.doc
webnotes.conn.sql("delete from `tabDocPerm` where parent='Profile' and permlevel=1")
new_perms = [
{
'parent': 'Profile',
'parentfield': 'permissions',
'parenttype': 'DocType',
'role': 'Administrator',
'permlevel': 1,
'read': 1,
'write': 1
},
{
'parent': 'Profile',
'parentfield': 'permissions',
'parenttype': 'DocType',
'role': 'System Manager',
'permlevel': 1,
'read': 1,
'write': 1
},
]
for perms in new_perms:
doc = webnotes.model.doc.Document('DocPerm')
doc.fields.update(perms)
doc.save()
webnotes.conn.commit()
webnotes.conn.begin()
webnotes.reload_doc('core', 'doctype', 'profile')

View File

@ -1,13 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.model.code import get_obj
from selling.doctype.sales_common.sales_common import StatusUpdater
invoices = webnotes.conn.sql("select name from `tabSales Invoice` where docstatus = 1")
for inv in invoices:
inv_obj = get_obj('Sales Invoice', inv[0], with_children=1)
StatusUpdater(inv_obj, 1).update_all_qty()

View File

@ -1,19 +0,0 @@
# 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():
from webnotes.widgets.form.assign_to import add
for t in webnotes.conn.sql("""select * from tabTask
where ifnull(allocated_to, '')!=''""", as_dict=1):
add({
'doctype': "Task",
'name': t['name'],
'assign_to': t['allocated_to'],
'assigned_by': t['owner'],
'description': t['subject'],
'date': t['creation'],
"no_notification": True
})

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals
import webnotes
def execute():
webnotes.reload_doc("website", "doctype", "shopping_cart_price_list")
webnotes.reload_doc("selling", "doctype", "shopping_cart_price_list")
for t in [
("Supplier Quotation", "price_list_name", "buying_price_list"),

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,14 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("""\
delete from `tabDocPerm`
where parent in ('Address', 'Contact')""")
webnotes.conn.commit()
webnotes.reload_doc('utilities', 'doctype', 'address')
webnotes.reload_doc('utilities', 'doctype', 'contact')
webnotes.conn.begin()

View File

@ -1,17 +0,0 @@
# 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.conn.commit()
from webnotes.install_lib.install import Installer
Installer(None, None).create_auth_table()
webnotes.conn.begin()
for user, password in webnotes.conn.sql("""select name, password from tabProfile"""):
if password:
webnotes.conn.sql("""insert into __Auth (user, `password`) values (%s, %s)""",
(user, password))

View File

@ -1,7 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("update `tabDocPerm` set permlevel = 0 where parent = 'Bin'")

View File

@ -1,13 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("""update tabAccount set freeze_account='No' where freeze_account is null""")
webnotes.conn.sql("""update `tabPurchase Taxes and Charges`
set category='Valuation and Total' where category='For Both'""")
webnotes.conn.sql("""update `tabPurchase Taxes and Charges`
set category='Valuation' where category='For Valuation'""")
webnotes.conn.sql("""update `tabPurchase Taxes and Charges`
set category='Total' where category='For Total'""")

View File

@ -1,11 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.model import delete_doc
delete_doc('DocType', 'Bulk Rename Tool')
webnotes.conn.commit()
webnotes.conn.sql("drop table `tabBulk Rename Tool`")
webnotes.conn.begin()

View File

@ -1,14 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
"""
deprecate:
* doctype - import data control
* page - import data (old)
"""
import webnotes
from webnotes.model import delete_doc
delete_doc('DocType', 'Import Data Control')
delete_doc('Page', 'Import Data')

View File

@ -1,48 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.utils import flt
wrong_plist = webnotes.conn.sql("""
select dnpi.name, dnpi.parent, dnpi.docstatus, dnpi.serial_no
from `tabDelivery Note Packing Item` dnpi
where ifnull(dnpi.parent, '') != ''
and ifnull(dnpi.parent, '') not like 'old_par%'
and dnpi.parenttype = 'Delivery Note'
and not exists (
select * from `tabDelivery Note Item` dni
where dni.item_code = dnpi.parent_item and
dni.name = dnpi.parent_detail_docname and
dni.parent = dnpi.parent
)
""", as_dict=1)
for d in wrong_plist:
if d['docstatus'] == 2 and d['serial_no']:
for s in d['serial_no'].splitlines():
sle = webnotes.conn.sql("""
select actual_qty, warehouse, voucher_no
from `tabStock Ledger Entry`
where (
serial_no like '%s\n%%'
or serial_no like '%%\n%s'
or serial_no like '%%\n%s\n%%'
or serial_no = '%s'
)
and voucher_no != '%s'
and ifnull(is_cancelled, 'No') = 'No'
order by name desc
limit 1
"""% (s, s, s, s, d['parent']), as_dict=1)
status = 'Not in Use'
if sle and flt(sle[0]['actual_qty']) > 0:
status = 'Available'
elif sle and flt(sle[0]['actual_qty']) < 0:
status = 'Delivered'
webnotes.conn.sql("update `tabSerial No` set status = %s, warehouse = %s where name = %s", (status, sle[0]['warehouse'], s))
webnotes.conn.sql("delete from `tabDelivery Note Packing Item` where name = %s", d['name'])

View File

@ -1,20 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("""update `tabPurchase Order Item` t1, `tabPurchase Order` t2
set t1.project_name = t2.project_name where t1.parent = t2.name
and ifnull(t1.project_name, '') = ''""")
webnotes.conn.sql("""update `tabPurchase Invoice Item` t1, `tabPurchase Invoice` t2
set t1.project_name = t2.project_name where t1.parent = t2.name
and ifnull(t1.project_name, '') = ''""")
webnotes.conn.sql("""update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2
set t1.project_name = t2.project_name where t1.parent = t2.name
and ifnull(t1.project_name, '') = ''""")
webnotes.conn.commit()
webnotes.reload_doc("buying", "doctype", "purchase_order")
webnotes.reload_doc("accounts", "doctype", "purchase_invoice")
webnotes.conn.begin()

View File

@ -1,9 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("""\
update `tabDocPerm` set `match`=NULL
where parent='Event' and role='All' and permlevel=0""")

View File

@ -1,100 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from stock.stock_ledger import update_entries_after
def execute():
# add index
webnotes.conn.commit()
try:
webnotes.conn.sql("""alter table `tabDelivery Note Packing Item`
add index item_code_warehouse (item_code, warehouse)""")
except:
pass
webnotes.conn.begin()
webnotes.conn.auto_commit_on_many_writes = 1
repost_reserved_qty()
cleanup_wrong_sle()
webnotes.conn.auto_commit_on_many_writes = 0
def repost_reserved_qty():
from webnotes.utils import flt
bins = webnotes.conn.sql("select item_code, warehouse, name, reserved_qty from `tabBin`")
i = 0
for d in bins:
i += 1
reserved_qty = webnotes.conn.sql("""
select
sum((dnpi_qty / so_item_qty) * (so_item_qty - so_item_delivered_qty))
from
(
select
qty as dnpi_qty,
(
select qty from `tabSales Order Item`
where name = dnpi.parent_detail_docname
) as so_item_qty,
(
select ifnull(delivered_qty, 0) from `tabSales Order Item`
where name = dnpi.parent_detail_docname
) as so_item_delivered_qty
from
(
select qty, parent_detail_docname
from `tabDelivery Note Packing Item` dnpi_in
where item_code = %s and warehouse = %s
and parenttype="Sales Order"
and exists (select * from `tabSales Order` so
where name = dnpi_in.parent and docstatus = 1 and status != 'Stopped')
) dnpi
) tab
where
so_item_qty >= so_item_delivered_qty
""", (d[0], d[1]))
if flt(d[3]) != flt(reserved_qty[0][0]):
webnotes.conn.sql("""
update `tabBin` set reserved_qty = %s where name = %s
""", (reserved_qty and reserved_qty[0][0] or 0, d[2]))
def cleanup_wrong_sle():
sle = webnotes.conn.sql("""
select item_code, warehouse, voucher_no, name
from `tabStock Ledger Entry` sle
where voucher_type = 'Delivery Note'
and not exists(
select name from `tabDelivery Note Packing Item`
where item_code = sle.item_code
and qty = abs(sle.actual_qty)
and parent = sle.voucher_no
) and not exists (
select name from `tabDelivery Note Item`
where item_code = sle.item_code
and qty = abs(sle.actual_qty)
and parent = sle.voucher_no
)
""")
if sle:
for d in sle:
webnotes.conn.sql("update `tabStock Ledger Entry` set is_cancelled = 'Yes' where name = %s", d[3])
create_comment(d[3])
update_entries_after({
"item_code": d[0],
"warehouse": d[1],
"posting_date": "2012-07-01",
"posting_time": "12:05"
})
def create_comment(dn):
from webnotes.model.doc import Document
cmt = Document('Comment')
cmt.comment = 'Cancelled by administrator due to wrong entry in packing list'
cmt.comment_by = 'Administrator'
cmt.comment_by_fullname = 'Administrator'
cmt.comment_doctype = 'Stock Ledger Entry'
cmt.comment_docname = dn
cmt.save(1)

View File

@ -1,9 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
"""appends from __future__ import unicode_literals to py files if necessary"""
import wnf
wnf.append_future_import()

View File

@ -1,12 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("""update `tabPurchase Taxes and Charges`
set category='Valuation and Total' where category='For Both'""")
webnotes.conn.sql("""update `tabPurchase Taxes and Charges`
set category='Valuation' where category='For Valuation'""")
webnotes.conn.sql("""update `tabPurchase Taxes and Charges`
set category='Total' where category='For Total'""")

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,9 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.commit()
webnotes.conn.sql("alter table `tabSessions` modify user varchar(180)")
webnotes.conn.begin()

View File

@ -1,11 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.model.code import get_obj
fs = get_obj('Features Setup')
fs.doc.fs_item_barcode = 0
fs.doc.save()
fs.validate()

View File

@ -1,89 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
# sync doctypes required for the patch
webnotes.reload_doc('website', 'doctype', 'web_page')
webnotes.reload_doc('website', 'doctype', 'website_settings')
webnotes.reload_doc('stock', 'doctype', 'item')
cleanup()
save_pages()
save_website_settings()
def cleanup():
import webnotes
# delete pages from `tabPage` of module Website or of type Webpage
webnotes.conn.sql("""\
delete from `tabPage`
where module='Website' and ifnull(web_page, 'No') = 'Yes'""")
# change show_in_website value in item table to 0 or 1
webnotes.conn.sql("""\
update `tabItem`
set show_in_website = if(show_in_website = 'Yes', 1, 0)
where show_in_website is not null""")
# move comments from comment_doctype Page to Blog
webnotes.conn.sql("""\
update `tabComment` comm, `tabBlog` blog
set comm.comment_doctype = 'Blog', comm.comment_docname = blog.name
where comm.comment_docname = blog.page_name""")
# delete deprecated pages
import webnotes.model
for page in ['products', 'contact', 'blog', 'about']:
try:
webnotes.model.delete_doc('Page', page)
except Exception, e:
webnotes.modules.patch_handler.log(unicode(e))
import os
import conf
# delete other html files
exception_list = ['app.html', 'unsupported.html', 'blank.html']
conf_dir = os.path.dirname(os.path.abspath(conf.__file__))
public_path = os.path.join(conf_dir, 'public')
for f in os.listdir(public_path):
if f.endswith('.html') and f not in exception_list:
os.remove(os.path.join(public_path, f))
def save_pages():
"""save all web pages, blogs to create content"""
query_map = {
'Web Page': """select name from `tabWeb Page` where docstatus=0""",
'Blog': """\
select name from `tabBlog`
where docstatus = 0 and ifnull(published, 0) = 1""",
'Item': """\
select name from `tabItem`
where docstatus = 0 and ifnull(show_in_website, 0) = 1""",
}
import webnotes
from webnotes.model.bean import Bean
import webnotes.modules.patch_handler
for dt in query_map:
for result in webnotes.conn.sql(query_map[dt], as_dict=1):
try:
Bean(dt, result['name'].encode('utf-8')).save()
except Exception, e:
webnotes.modules.patch_handler.log(unicode(e))
def save_website_settings():
from webnotes.model.code import get_obj
# rewrite pages
get_obj('Website Settings').on_update()
ss = get_obj('Style Settings')
ss.validate()
ss.doc.save()
ss.on_update()

View File

@ -1,13 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.reload_doc('buying', 'doctype', 'purchase_order_item')
webnotes.reload_doc('accounts', 'doctype', 'purchase_invoice_item')
webnotes.reload_doc('stock', 'doctype', 'purchase_receipt_item')
webnotes.conn.sql("update `tabPurchase Invoice Item` t1, `tabPurchase Order Item` t2 set t1.uom = t2.uom where ifnull(t1.po_detail, '') != '' and t1.po_detail = t2.name")
webnotes.conn.sql("update `tabPurchase Invoice Item` t1, `tabPurchase Receipt Item` t2 set t1.uom = t2.uom where ifnull(t1.pr_detail, '') != '' and t1.pr_detail = t2.name")

View File

@ -1,21 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
"""delete entries of child table having parent like old_par%% or ''"""
import webnotes
res = webnotes.conn.sql("""\
select dt.name from `tabDocType` dt
where ifnull(dt.istable, 0)=1 and
exists (
select * from `tabDocField` df
where df.fieldtype='Table' and
df.options=dt.name
)""")
for r in res:
if r[0]:
webnotes.conn.sql("""\
delete from `tab%s`
where (ifnull(parent, '')='' or parent like "old_par%%") and
ifnull(parenttype, '')!=''""" % r[0])

View File

@ -1,7 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("update `tabQuotation` t1, `tabLead` t2 set t1.organization = t2.company_name where ifnull(t1.lead, '') != '' and t1.quotation_to = 'Lead' and ifnull(t1.organization, '') = '' and t1.lead = t2.name")

View File

@ -1,12 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
"""allow read permission to all for report list"""
import webnotes
webnotes.conn.sql("""\
delete from `tabDocPerm`
where parent in ('Report', 'Search Criteria')""")
webnotes.reload_doc('core', 'doctype', 'report')

View File

@ -1,10 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
"""add unique constraint to series table's name column"""
import webnotes
webnotes.conn.commit()
webnotes.conn.sql("alter table `tabSeries` add unique (name)")
webnotes.conn.begin()

View File

@ -1,9 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.reload_doc('accounts', 'doctype', 'sales_invoice')
webnotes.conn.sql("update `tabSales Invoice` set recurring_type = 'Monthly' where ifnull(convert_into_recurring_invoice, 0) = 1")

View File

@ -1,18 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
"""New Send Autoreply checkbox in Email Settings"""
import webnotes
import webnotes.utils
webnotes.conn.commit()
webnotes.reload_doc('setup', 'doctype', 'email_settings')
webnotes.conn.begin()
sync_support_mails = webnotes.utils.cint(webnotes.conn.get_value('Email Settings',
None, 'sync_support_mails'))
if sync_support_mails:
webnotes.conn.set_value('Email Settings', None, 'send_autoreply', 1)

View File

@ -4,7 +4,7 @@
import webnotes
def execute():
webnotes.reload_doc("website", "doctype", "shopping_cart_settings")
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

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,46 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
# do not run this patch
from __future__ import unicode_literals
def execute():
import webnotes
import webnotes.modules
forbidden = ['%', "'", '"', '#', '*', '?', '`', '(', ')', '<', '>', '-',
'\\', '/', '.', '&', '!', '@', '$', '^', '+']
doctype_list = webnotes.conn.sql("SELECT name, module FROM `tabDocType`")
for doctype, module in doctype_list:
docfield_list = webnotes.conn.sql("""\
SELECT name, label, fieldtype FROM `tabDocField`
WHERE parent = %s AND IFNULL(fieldname, '') = ''""", doctype)
field_type_count = {}
count = 0
for name, label, fieldtype in docfield_list:
fieldname = None
if label:
temp_label = label
if len(temp_label)==1:
temp_label = fieldtype + temp_label
fieldname = temp_label.lower().replace(' ', '_')
if "<" in fieldname:
count = field_type_count.setdefault(fieldtype, 0)
fieldname = fieldtype.lower().replace(' ', '_') + str(count)
field_type_count[fieldtype] = count + 1
elif fieldtype:
count = field_type_count.setdefault(fieldtype, 0)
fieldname = fieldtype.lower().replace(' ', '_') + str(count)
field_type_count[fieldtype] = count + 1
if fieldname:
for f in forbidden: fieldname = fieldname.replace(f, '')
fieldname = fieldname.replace('__', '_')
if fieldname.endswith('_'):
fieldname = fieldname[:-1]
if fieldname.startswith('_'):
fieldname = fieldname[1:]
#print fieldname
webnotes.conn.sql("""\
UPDATE `tabDocField` SET fieldname = %s
WHERE name = %s""", (fieldname, name))
webnotes.modules.export_doc('DocType', doctype)

View File

@ -1,81 +0,0 @@
# 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():
"""
* Remove unnecessary doctype properties
* Remove docfield property setters if fieldname doesn't exist
* Remove prev_field properties if value fieldname doesn't exist
"""
change_property_setter_fieldnames()
clean_doctype_properties()
clean_docfield_properties()
def change_property_setter_fieldnames():
webnotes.reload_doc('core', 'doctype', 'property_setter')
docfield_list = webnotes.conn.sql("""\
SELECT name, fieldname FROM `tabDocField`""", as_list=1)
custom_field_list = webnotes.conn.sql("""\
SELECT name, fieldname FROM `tabCustom Field`""", as_list=1)
field_list = docfield_list + custom_field_list
property_setter_list = webnotes.conn.sql("""\
SELECT name, doc_name, value, property
FROM `tabProperty Setter`
WHERE doctype_or_field='DocField'""")
field_dict = dict(field_list)
for name, doc_name, value, prop in property_setter_list:
if doc_name in field_dict:
webnotes.conn.sql("""\
UPDATE `tabProperty Setter`
SET field_name = %s
WHERE name = %s""", (field_dict.get(doc_name), name))
if value in field_dict and prop=='previous_field':
webnotes.conn.sql("""\
UPDATE `tabProperty Setter`
SET value = %s
WHERE name = %s""", (field_dict.get(value), name))
def clean_doctype_properties():
desc = webnotes.conn.sql("DESC `tabDocType`", as_dict=1)
property_list = '", "'.join([d.get('Field') for d in desc])
webnotes.conn.sql("""\
DELETE FROM `tabProperty Setter`
WHERE doctype_or_field = 'DocType'
AND property NOT IN ("%s")""" % property_list)
def clean_docfield_properties():
delete_list_1 = webnotes.conn.sql("""\
SELECT name FROM `tabProperty Setter` ps
WHERE doctype_or_field = 'DocField'
AND NOT EXISTS (
SELECT fieldname FROM `tabDocField` df
WHERE df.parent = ps.doc_type
AND df.fieldname = ps.field_name
) AND NOT EXISTS (
SELECT fieldname FROM `tabCustom Field` cf
WHERE cf.dt = ps.doc_type
AND cf.fieldname = ps.field_name
)""")
delete_list_2 = webnotes.conn.sql("""\
SELECT name FROM `tabProperty Setter` ps
WHERE doctype_or_field = 'DocField'
AND property = 'previous_field'
AND NOT EXISTS (
SELECT fieldname FROM `tabDocField` df
WHERE df.parent = ps.doc_type
AND df.fieldname = ps.value
) AND NOT EXISTS (
SELECT fieldname FROM `tabCustom Field` cf
WHERE cf.dt = ps.doc_type
AND cf.fieldname = ps.value
)""")
delete_list = [d[0] for d in delete_list_1] + [d[0] for d in delete_list_2]
webnotes.conn.sql("""\
DELETE FROM `tabProperty Setter`
WHERE NAME IN ("%s")""" % '", "'.join(delete_list))

View File

@ -1,11 +0,0 @@
# 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.conn.sql("""\
DELETE FROM `tabSingles`
WHERE doctype = 'Control Panel'
AND field IN ("sync_with_gateway", "mail_password", "auto_email_id",
"mail_port", "outgoing_mail_server", "mail_login", "use_ssl")""")

View File

@ -1,118 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
# do not run this patch
from __future__ import unicode_literals
field_list = [
['Contact', 'notes'],
['Contact', 'birthday'],
['Contact', 'anniversary'],
['Customer', 'state_tax_type'],
['Customer', 'tin_no'],
['Customer', 'excise_registration_number'],
['Customer', 'customer_discount_details'],
['Customer', 'notes'],
['Customer', 'follow_up_section'],
['Customer', 'follow_up'],
['Delivery Note', 'shipping_contact_no'],
['Delivery Note', 'shipping_tin_no'],
['Delivery Note', 'shipping_excise_no'],
['Delivery Note', 'tin_no'],
['Delivery Note', 'excise_no'],
['Delivery Note Detail', 'cetsh_number'],
['Item', 'base_material'],
['Item', 'tool_type'],
['Item', 'no_of_flutes'],
['Item', 'special_treatment'],
['Item', 'length'],
['Item', 'width'],
['Item', 'height_dia'],
['Item', 'pl_item'],
['Item', 'cetsh_number'],
['Item', 'stock_maintained'],
['Item', 'is_rm'],
['Journal Voucher Detail', 'line_remarks'],
['Lead', 'designation'],
['Purchase Order', 'challan_number'],
['Quotation', 'cust_enq_no'],
['Quotation', 'enq_date'],
['Quotation', 'quote_valid'],
['Quotation', 'due_date'],
['Receivable Voucher', 'voucher_time'],
['Receivable Voucher', 'removal_time'],
['Receivable Voucher', 'removal_date'],
['Receivable Voucher', 'shipping_address'],
['Receivable Voucher', 'shipping_location'],
['Receivable Voucher', 'ship_to'],
['Receivable Voucher', 'shipping_contact_no'],
['Receivable Voucher', 'shipping_excise_no'],
['Receivable Voucher', 'shipping_tin_no'],
['Receivable Voucher', 'po_no'],
['Receivable Voucher', 'po_date'],
['Receivable Voucher', 'lr_no'],
['Receivable Voucher', 'transporters'],
['Receivable Voucher', 'ship_terms'],
['Receivable Voucher', 'tin_no'],
['Receivable Voucher', 'excise_no'],
['RV Detail', 'cetsh_number'],
['Sales Order', 'shipping_contact_no'],
['Sales Order', 'shipping_tin_no'],
['Sales Order', 'shipping_excise_no'],
['Sales Order', 'tin_no'],
['Sales Order', 'excise_number'],
['Sales Order Detail', 'cetsh_number'],
['Sales Order Detail', 'prd_notes'],
['Shipping Address', 'phone_no'],
['Shipping Address', 'tin_no'],
['Shipping Address', 'excise_no'],
['Stock Entry', 'process_custom'],
['Stock Entry', 'city'],
['Stock Entry', 'address_line_2'],
['Stock Entry', 'address_line_1'],
['Stock Entry', 'comp_other'],
['Stock Entry', 'mobile_no'],
['Stock Entry', 'phone_no'],
['Stock Entry', 'country'],
['Stock Entry', 'state'],
['Stock Entry', 'challan_number'],
['Stock Entry Detail', 'machine'],
['Stock Entry Detail', 'worker'],
['Supplier', 'notes'],
['Supplier', 'purchase_other_charges'],
['Supplier', 'tax_details'],
['Supplier', 'tin_number'],
['Supplier', 'excise_regd_number'],
['Supplier', 'service_tax_regd_number'],
['Warehouse', 'comp_other'],
['Warehouse', 'process'],
['Warehouse', 'country'],
['Warehouse', 'tax_registration_number'],
['Warehouse Type', 'process'],
['Workstation', 'maintenance_data'],
]
import webnotes
from webnotes.model.code import get_obj
from webnotes.model.doc import Document
def execute():
webnotes.reload_doc('core', 'doctype', 'custom_field')
for f in field_list:
res = webnotes.conn.sql("""SELECT name FROM `tabCustom Field`
WHERE dt=%s AND fieldname=%s""", (f[0], f[1]))
if res: continue
docfield = webnotes.conn.sql("""SELECT * FROM `tabDocField`
WHERE parent=%s AND fieldname=%s""", (f[0], f[1]), as_dict=1)
if not docfield: continue
custom_field = docfield[0]
# scrub custom field dict
custom_field['dt'] = custom_field['parent']
del custom_field['parent']
d = Document('Custom Field', fielddata=custom_field)
d.name = custom_field['dt'] + '-' + custom_field['fieldname']
d.save(1, ignore_fields=1)
#obj = get_obj(doc=d)
#obj.on_update()

View File

@ -1,12 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("DELETE FROM `tabDocField` WHERE options='DocFormat'")
webnotes.conn.sql("DELETE FROM `tabDocField` WHERE parent='DocFormat'")
webnotes.conn.sql("DELETE FROM `tabDocType` WHERE name='DocFormat'")
webnotes.conn.commit()
webnotes.conn.sql("DROP TABLE `tabDocFormat`")
webnotes.conn.begin()

View File

@ -1,147 +0,0 @@
# 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():
"""
* Custom Field changes
* Add file_list to required tables
* Change floats/currency to decimal(18, 6)
* Remove DocFormat from DocType's fields
* Remove 'no_column' from DocField
* Drop table DocFormat
"""
import webnotes.model.sync
webnotes.model.sync.sync_all(force=1)
handle_custom_fields()
create_file_list()
# do at last - needs commit due to DDL statements
change_to_decimal()
def handle_custom_fields():
"""
* Assign idx to custom fields
* Create property setter entry of previous field
* Remove custom fields from tabDocField
"""
cf = get_cf()
assign_idx(cf)
create_prev_field_prop_setter(cf)
remove_custom_from_docfield(cf)
def get_cf():
return webnotes.conn.sql("""\
SELECT * FROM `tabCustom Field`
WHERE docstatus < 2""", as_dict=1)
def assign_idx(cf):
from webnotes.model.doctype import get
from webnotes.utils import cint
#print len(cf)
for f in cf:
#print f.get('dt'), f.get('name')
if f.get('idx'): continue
temp_doclist = get(f.get('dt'), form=0)
#print len(temp_doclist)
max_idx = max(d.idx for d in temp_doclist if d.doctype=='DocField')
if not max_idx: continue
webnotes.conn.sql("""\
UPDATE `tabCustom Field` SET idx=%s
WHERE name=%s""", (cint(max_idx)+1, f.get('name')))
def create_prev_field_prop_setter(cf):
from webnotes.model.doc import Document
from core.doctype.custom_field.custom_field import get_fields_label
for f in cf:
idx_label_list, field_list = get_fields_label(f.get('dt'), 0)
temp_insert_after = (f.get('insert_after') or '').split(" - ")
if len(temp_insert_after)<=1: continue
similar_idx_label = [il for il in idx_label_list \
if temp_insert_after[0] in il]
if not similar_idx_label: continue
label_index = idx_label_list.index(similar_idx_label[0])
if label_index==-1: return
webnotes.conn.sql("""\
UPDATE `tabCustom Field`
SET insert_after = %s
WHERE name = %s""", (similar_idx_label[0], f.get('name')))
prev_field = field_list[label_index]
res = webnotes.conn.sql("""\
SELECT name FROM `tabProperty Setter`
WHERE doc_type = %s
AND field_name = %s
AND property = 'previous_field'""", (f.get('dt'), f.get('fieldname')))
if not res:
ps = Document('Property Setter', fielddata = {
'doctype_or_field': 'DocField',
'doc_type': f.get('dt'),
'field_name': f.get('fieldname'),
'property': 'previous_field',
'value': prev_field,
'property_type': 'Data',
'select_doctype': f.get('dt')
})
ps.save(1)
def remove_custom_from_docfield(cf):
for f in cf:
webnotes.conn.sql("""\
DELETE FROM `tabDocField`
WHERE parent=%s AND fieldname=%s""", (f.get('dt'),
f.get('fieldname')))
def create_file_list():
should_exist = ['Website Settings', 'Web Page', 'Timesheet', 'Task',
'Support Ticket', 'Supplier', 'Style Settings', 'Stock Reconciliation',
'Stock Entry', 'Serial No', 'Sales Order', 'Sales Invoice',
'Quotation', 'Question', 'Purchase Receipt', 'Purchase Order',
'Project', 'Profile', 'Production Order', 'Product', 'Print Format',
'Price List', 'Purchase Invoice', 'Page',
'Maintenance Visit', 'Maintenance Schedule', 'Letter Head',
'Leave Application', 'Lead', 'Journal Voucher', 'Item', 'Material Request',
'Expense Claim', 'Opportunity', 'Employee', 'Delivery Note',
'Customer Issue', 'Customer', 'Contact Us Settings', 'Company',
'Bulk Rename Tool', 'Blog', 'BOM', 'About Us Settings']
from webnotes.model.code import get_obj
for dt in should_exist:
obj = get_obj('DocType', dt, with_children=1)
obj.doc.allow_attach = 1
obj.doc.save()
obj.make_file_list()
from webnotes.model.db_schema import updatedb
updatedb(obj.doc.name)
webnotes.clear_cache(doctype=obj.doc.name)
def change_to_decimal():
webnotes.conn.commit()
tables = webnotes.conn.sql("SHOW TABLES")
alter_tables_list = []
for tab in tables:
if not tab: continue
desc = webnotes.conn.sql("DESC `%s`" % tab[0], as_dict=1)
flist = []
for d in desc:
if d.get('Type')=='decimal(14,2)':
flist.append(d.get('Field'))
if flist:
#print tab[0], flist
statements = ("MODIFY `%s` decimal(18,6)" % f for f in flist)
statements = ", \n".join(statements)
alter_tables_list.append("ALTER TABLE `%s` \n%s\n" % (tab[0],
statements))
#print "\n\n".join(alter_tables_list)
for at in alter_tables_list:
webnotes.conn.sql(at)
webnotes.conn.begin()

View File

@ -1,18 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("""
UPDATE `tabDocField`
SET fieldtype = 'Link', options = 'Deduction Type'
WHERE parent = 'Deduction Detail'
AND fieldname = 'd_type'
""")
webnotes.conn.sql("""
UPDATE `tabDocField`
SET fieldtype = 'Link', options = 'Earning Type'
WHERE parent = 'Earning Detail'
AND fieldname = 'e_type'
""")

View File

@ -1,27 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
# dont run this patch
from __future__ import unicode_literals
def execute():
import webnotes
import webnotes.model.doctype
from webnotes.utils import cint
from webnotes.model.doc import Document
from webnotes.model.code import get_obj
doctype_list = webnotes.conn.sql("SELECT name FROM `tabDocType`")
for dt in doctype_list:
doclist = webnotes.model.doctype.get(dt[0], form=0)
is_submittable = 0
for d in doclist:
if d.doctype == 'DocPerm' and d.fields.get('permlevel') == 0 \
and cint(d.fields.get('submit')) == 1:
is_submittable = 1
break
if is_submittable:
dt_doc = Document('DocType', doclist[0].name)
dt_doc.is_submittable = 1
dt_doc.save()
obj = get_obj(doc=dt_doc)
obj.make_amendable()
obj.on_update()

View File

@ -1,7 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
from webnotes.modules import reload_doc
reload_doc('accounts', 'Print Format', 'POS Invoice')

View File

@ -1,21 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
doctype_list = webnotes.conn.sql("""SELECT name FROM `tabDocType`
WHERE docstatus<2 AND IFNULL(issingle, 0)=0
AND IFNULL(istable, 0)=0""")
webnotes.conn.commit()
for d in doctype_list:
add_col = True
desc = webnotes.conn.sql("DESC `tab%s`" % d[0], as_dict=1)
for td in desc:
if td.get('Field')=='_user_tags':
add_col = False
if add_col:
webnotes.conn.sql("alter table `tab%s` add column `_user_tags` varchar(180)" % d[0])
webnotes.conn.begin()

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,31 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("""
delete from `tabSingles`
where doctype='Notification Control'
and field in (
'payable_voucher',
'payment_received_message',
'payment_sent_message',
'enquiry')
""")
ren_list = [
['expense_voucher', 'expense_claim'],
['receivable_voucher', 'sales_invoice'],
['enquiry', 'opportunity'],
]
for r in ren_list:
webnotes.conn.sql("""
update `tabSingles`
set field=%s
where field=%s
and doctype='Notification Control'
""", (r[1], r[0]))
webnotes.conn.commit()
webnotes.conn.begin()
webnotes.reload_doc('setup', 'doctype', 'notification_control')

View File

@ -1,9 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("delete from `tabProperty Setter` where property in ('width', 'previous_field')")
webnotes.conn.sql("delete from `tabSingles` where field = 'footer_font_color' and doctype = 'Style Settings'")

View File

@ -1,7 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("delete from __SessionCache")

View File

@ -1,13 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.model.doc import Document
if not webnotes.conn.sql("select name from `tabRole` where name = 'Report Manager'"):
r = Document('Role')
r.role_name = 'Report Manager'
r.module = 'Core'
r.save()

View File

@ -1,33 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
"""Make server custom script readonly for system manager"""
import webnotes.model.doc
new_perms = [
{
'parent': 'Custom Script',
'parentfield': 'permissions',
'parenttype': 'DocType',
'role': 'System Manager',
'permlevel': 1,
'read': 1,
},
{
'parent': 'Custom Script',
'parentfield': 'permissions',
'parenttype': 'DocType',
'role': 'Administrator',
'permlevel': 1,
'read': 1,
'write': 1
},
]
for perms in new_perms:
doc = webnotes.model.doc.Document('DocPerm')
doc.fields.update(perms)
doc.save()
webnotes.conn.commit()
webnotes.conn.begin()
webnotes.reload_doc('core', 'doctype', 'custom_script')

View File

@ -1,9 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("delete from `tabCustomize Form Field`")
webnotes.conn.sql("""delete from `tabSingles`
where doctype='Customize Form'""")

View File

@ -1,9 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
sr = webnotes.conn.sql("select max(name) from `tabPage Role`")
if sr and sr[0][0].startswith('PR'):
webnotes.conn.sql("update tabSeries set current = %s where name = 'PR'", int(sr[0][0][2:]))

View File

@ -1,25 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
"""Make profile readonly for role All"""
import webnotes.model.doc
webnotes.conn.sql("delete from `tabDocPerm` where parent='Profile' and role='All'")
new_perms = [
{
'parent': 'Profile',
'parentfield': 'permissions',
'parenttype': 'DocType',
'role': 'All',
'permlevel': 0,
'read': 1,
},
]
for perms in new_perms:
doc = webnotes.model.doc.Document('DocPerm')
doc.fields.update(perms)
doc.save()
webnotes.conn.commit()
webnotes.conn.begin()
webnotes.reload_doc('core', 'doctype', 'profile')

View File

@ -1,19 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
import webnotes.modules
res = webnotes.conn.sql("""\
select module, name, standard from `tabPrint Format`
where name like 'Sales Invoice%'""", as_dict=1)
for r in res:
if r.get('standard')=='Yes' and \
r.get('name') in [
'Sales Invoice Classic',
'Sales Invoice Spartan',
'Sales Invoice Modern'
]:
webnotes.modules.reload_doc(r.get('module'), 'Print Format', r.get('name'))

View File

@ -1,110 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.reload_doc('support', 'doctype', 'communication')
webnotes.conn.commit()
webnotes.conn.begin()
# change doctype property setter and custom fields, and save them
move_customizations()
try:
remove_communication_log()
except Exception, e:
if e.args[0] != 1146:
raise e
def move_customizations():
import webnotes.model.doc
import webnotes.model.doctype
res = webnotes.conn.sql("""\
delete from `tabProperty Setter`
where property='previous_field'
and doc_type = 'Communication Log'""")
res = webnotes.conn.sql("""\
select name from `tabCustom Field`
where dt='Communication Log'""")
for r in res:
d = webnotes.model.doc.Document('Custom Field', r[0])
d.dt = 'Communication'
d.save()
from webnotes.model.db_schema import updatedb
updatedb('Communication')
res = webnotes.conn.sql("""\
select field_name from `tabProperty Setter`
where doc_type='Communication Log' and field_name is not null""")
doclist = webnotes.model.doctype.get('Communication', 0)
field_list = [d.fieldname for d in doclist if d.doctype=='DocField']
for r in res:
if r[0] in field_list:
webnotes.conn.sql("""\
update `tabProperty Setter`
set doc_type = 'Communication'
where field_name=%s and doc_type='Communication Log'""", r[0])
webnotes.conn.sql("""\
delete from `tabProperty Setter`
where doc_type='Communication Log'""")
webnotes.clear_cache(doctype="Communication")
def remove_communication_log():
import webnotes
import webnotes.model
import webnotes.model.doc
import webnotes.model.doctype
webnotes.conn.auto_commit_on_many_writes = True
# get all communication log records
comm_log_list = webnotes.conn.sql("select * from `tabCommunication Log`",
as_dict=1)
field_list = [d.fieldname for d in \
webnotes.model.doctype.get('Communication', 0) \
if d.doctype=='DocField']
# copy it to communication
for comm_log in comm_log_list:
d = webnotes.model.doc.Document('Communication')
for key in comm_log.keys():
if key not in webnotes.model.default_fields:
d.fields[key] = comm_log[key]
parenttype = (comm_log.get('parenttype') or '').lower()
if parenttype in field_list:
d.fields[parenttype] = comm_log.get('parent')
d.naming_series = 'COMM-'
d.subject = 'Follow Up'
d.content = comm_log.get('notes') or ''
d.medium = comm_log.get('follow_up_type') or ''
d.sales_person = comm_log.get('follow_up_by')
d.communication_date = comm_log.get('date')
d.category = 'Miscellaneous'
d.action = 'No Action'
d.save(ignore_fields=1)
# delete records with parent type "Customer", "Lead", "Supplier"
webnotes.conn.sql("""\
delete from `tabCommunication Log`
where parenttype in ('Customer', 'Lead', 'Supplier',
'Opportunity', 'Quotation')""")
# if all records deleted, drop table communication log
# and delete doctype communication log
# if for some reason, records remain, dont drop table and dont delete doctype
count = webnotes.conn.sql("select count(*) from `tabCommunication Log`")[0][0]
if not count:
webnotes.model.delete_doc('DocType', 'Communication Log')
webnotes.conn.commit()
webnotes.conn.sql("drop table `tabCommunication Log`")
webnotes.conn.begin()

View File

@ -1,21 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
"""
* Replace EURO with EUR
* Delete EURO from tabCurrency
"""
import webnotes
tables = webnotes.conn.sql("show tables")
for (tab,) in tables:
desc = webnotes.conn.sql("desc `%s`" % tab, as_dict=1)
for d in desc:
if "currency" in d.get('Field'):
field = d.get('Field')
webnotes.conn.sql("""\
update `%s` set `%s`='EUR'
where `%s`='EURO'""" % (tab, field, field))
webnotes.conn.sql("update `tabSingles` set value='EUR' where value='EURO'")
webnotes.conn.sql("delete from `tabCurrency` where name='EURO'")

View File

@ -1,18 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
dt_list = webnotes.conn.sql("select parent, fieldname from `tabDocField` where fieldname in ('against_doctype', 'prevdoc_doctype')")
ren_dt = {
'Indent' : 'Material Request',
'Enquiry' : 'Opportunity',
'Receivable Voucher' : 'Sales Invoice',
'Payable Voucher' : 'Purchase Invoice'
}
for d in ren_dt:
for dt in dt_list:
webnotes.conn.sql("update `tab%s` set %s = '%s' where %s = '%s'" % (dt[0], dt[1], ren_dt[d], dt[1], d))

View File

@ -1,12 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.model.code import get_obj
gd = get_obj('Global Defaults')
gd.doc.maintain_same_rate = 1
gd.doc.save()
gd.on_update()

View File

@ -1,33 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
"""Make standard print formats readonly for system manager"""
import webnotes.model.doc
new_perms = [
{
'parent': 'Print Format',
'parentfield': 'permissions',
'parenttype': 'DocType',
'role': 'System Manager',
'permlevel': 1,
'read': 1,
},
{
'parent': 'Print Format',
'parentfield': 'permissions',
'parenttype': 'DocType',
'role': 'Administrator',
'permlevel': 1,
'read': 1,
'write': 1
},
]
for perms in new_perms:
doc = webnotes.model.doc.Document('DocPerm')
doc.fields.update(perms)
doc.save()
webnotes.conn.commit()
webnotes.conn.begin()
webnotes.reload_doc('core', 'doctype', 'print_format')

View File

@ -1,21 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.modules import reload_doc
reload_doc('stock', 'doctype', 'stock_reconciliation')
sr = webnotes.conn.sql("select name, file_list from `tabStock Reconciliation` where docstatus = 1")
for d in sr:
if d[1]:
filename = d[1].split(',')[1]
from webnotes.utils import file_manager
fn, content = file_manager.get_file(filename)
if not isinstance(content, basestring) and hasattr(content, 'tostring'):
content = content.tostring()
webnotes.conn.sql("update `tabStock Reconciliation` set diff_info = %s where name = %s and ifnull(diff_info, '') = ''", (content, d[0]))

View File

@ -10,60 +10,6 @@ patch_list = [
"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",
"patches.mar_2012.clean_property_setter",
"patches.april_2012.naming_series_patch",
"patches.mar_2012.cleanup_control_panel",
"patches.mar_2012.doctype_get_refactor",
"patches.mar_2012.delete_docformat",
"patches.mar_2012.usertags",
"patches.april_2012.reload_c_form",
"patches.april_2012.after_sync_cleanup",
"patches.april_2012.remove_default_from_rv_detail",
"patches.april_2012.update_role_in_address",
"patches.april_2012.update_permlevel_in_address",
"patches.april_2012.update_appraisal_permission",
"patches.april_2012.repost_stock_for_posting_time",
"patches.may_2012.cleanup_property_setter",
"patches.may_2012.rename_prev_doctype",
"patches.may_2012.cleanup_notification_control",
"patches.may_2012.stock_reco_patch",
"patches.may_2012.page_role_series_fix",
"patches.may_2012.reload_sales_invoice_pf",
"patches.may_2012.std_pf_readonly",
"patches.may_2012.customize_form_cleanup",
"patches.may_2012.cs_server_readonly",
"patches.may_2012.clear_session_cache",
"patches.may_2012.same_purchase_rate_patch",
"patches.may_2012.create_report_manager_role",
"patches.may_2012.profile_perm_patch",
"patches.may_2012.remove_euro_currency",
"patches.may_2012.remove_communication_log",
"patches.june_2012.barcode_in_feature_setup",
"patches.june_2012.copy_uom_for_pur_inv_item",
"patches.june_2012.fetch_organization_from_lead",
"patches.june_2012.reports_list_permission",
"patches.june_2012.support_ticket_autoreply",
"patches.june_2012.series_unique_patch",
"patches.june_2012.set_recurring_type",
"patches.june_2012.alter_tabsessions",
"patches.june_2012.delete_old_parent_entries",
"patches.april_2012.delete_about_contact",
"patches.july_2012.reload_pr_po_mapper",
"patches.july_2012.address_contact_perms",
"patches.july_2012.packing_list_cleanup_and_serial_no",
"patches.july_2012.deprecate_import_data_control",
"patches.july_2012.default_freeze_account",
"patches.july_2012.update_purchase_tax",
"patches.june_2012.cms2",
"patches.july_2012.auth_table",
"patches.july_2012.remove_event_role_owner_match",
"patches.july_2012.deprecate_bulk_rename",
"patches.july_2012.bin_permission",
"patches.july_2012.project_patch_repeat",
"patches.july_2012.repost_stock_due_to_wrong_packing_list",
"patches.august_2012.task_allocated_to_assigned",
"patches.august_2012.change_profile_permission",
"patches.august_2012.repost_billed_amt",
"patches.september_2012.stock_report_permissions_for_accounts",
"patches.september_2012.communication_delete_permission",
"patches.september_2012.all_permissions_patch",