moved directory structure

This commit is contained in:
Rushabh Mehta
2012-09-24 19:13:42 +05:30
parent e47a6779e9
commit 2fa2f7178d
1637 changed files with 47 additions and 11450 deletions

View File

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

View File

@@ -0,0 +1,29 @@
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()
import webnotes.model.sync
webnotes.model.sync.sync('setup', 'notification_control')

View File

@@ -0,0 +1,6 @@
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

@@ -0,0 +1,4 @@
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("delete from __SessionCache")

View File

@@ -0,0 +1,10 @@
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

@@ -0,0 +1,31 @@
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()
import webnotes.model.sync
webnotes.model.sync.sync('core', 'custom_script')

View File

@@ -0,0 +1,6 @@
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

@@ -0,0 +1,6 @@
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

@@ -0,0 +1,23 @@
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()
import webnotes.model.sync
webnotes.model.sync.sync('core', 'profile')

View File

@@ -0,0 +1,5 @@
from __future__ import unicode_literals
def execute():
import webnotes
import webnotes.modules
webnotes.modules.reload_doc('selling', 'search_criteria', 'customer_address_contact')

View File

@@ -0,0 +1,7 @@
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.modules import reload_doc
reload_doc('selling', 'search_criteria', 'itemwise_sales_details')
reload_doc('selling', 'search_criteria', 'itemwise_delivery_details')

View File

@@ -0,0 +1,17 @@
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'
]:
print r.get('name')
webnotes.modules.reload_doc(r.get('module'), 'Print Format', r.get('name'))

View File

@@ -0,0 +1,9 @@
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.model import delete_doc
delete_doc("Search Criteria", "sales_order_pending_items1")
webnotes.conn.sql("update `tabSearch Criteria` set module = 'Selling' where module = 'CRM'")
from webnotes.modules import reload_doc
reload_doc('selling', 'search_criteria', 'sales_order_pending_items')

View File

@@ -0,0 +1,109 @@
from __future__ import unicode_literals
def execute():
import webnotes
import webnotes.model.sync
webnotes.model.sync.sync('support', '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'""")
from webnotes.utils.cache import CacheItem
CacheItem('Communication').clear()
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

@@ -0,0 +1,18 @@
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

@@ -0,0 +1,15 @@
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' : 'Purchase 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

@@ -0,0 +1,100 @@
from __future__ import unicode_literals
def execute():
import webnotes
rendt = {
'Receivable Voucher' : 'Sales Invoice',
'RV Detail' : 'Sales Invoice Item',
'RV Tax Detail' : 'Sales Taxes and Charges',
'Payable Voucher' : 'Purchase Invoice',
'PV Detail' : 'Purchase Invoice Item',
'Purchase Tax Detail' : 'Purchase Taxes and Charges',
'Indent' : 'Purchase Request',
'Indent Detail' : 'Purchase Request Item',
'QA Inspection Report' : 'Quality Inspection',
'Ticket' : 'Task',
'Manage Account' : 'Global Defaults',
'ToDo Item' : 'ToDo',
'Term' : 'Terms and Conditions',
'Static Parameter Detail' : 'SMS Parameter',
'SS Earning Detail' : 'Salary Slip Earning',
'SS Deduction Detail' : 'Salary Slip Deduction',
'Sales Order Detail' : 'Sales Order Item',
'Sales BOM Detail' : 'Sales BOM Item',
'Return Detail' : 'Sales and Purchase Return Item',
'Ref Rate Detail' : 'Item Price',
'Receiver Detail' : 'SMS Receiver',
'Quotation Detail' : 'Quotation Item',
'QA Specification Detail' : 'Quality Inspection Reading',
'Purchase Receipt Detail' : 'Purchase Receipt Item',
'Purchase Other Charges' : 'Purchase Taxes and Charges Master',
'PR Raw Material Detail' : 'Purchase Receipt Item Supplied',
'PP SO Detail' : 'Production Plan Sales Order',
'PP Detail' : 'Production Plan Item',
'PO Raw Material Detail' : 'Purchase Order Item Supplied',
'PO Detail' : 'Purchase Order Item',
'Packing Slip Detail' : 'Packing Slip Item',
'Other Charges' : 'Sales Taxes and Charges Master',
'Order Lost Reason' : 'Quotation Lost Reason',
'Manage Account' : 'Global Defaults',
'Maintenance Visit Detail' : 'Maintenance Visit Purpose',
'Ledger Balance Export' : 'Multi Ledger Report',
'LC PR Detail' : 'Landed Cost Purchase Receipt',
'Landed Cost Detail' : 'Landed Cost Item',
'KRA Template' : 'Appraisal Template',
'KRA Sheet' : 'Appraisal Template Goal',
'Item Specification Detail' : 'Item Quality Inspection Parameter',
'Item Maintenance Detail' : 'Maintenance Schedule Item',
'IR Payment Detail' : 'Payment to Invoice Matching Tool Detail',
'Internal Reconciliation' : 'Payment to Invoice Matching Tool',
'Installed Item Details' : 'Installation Note Item',
'Holiday List Detail' : 'Holiday',
'Follow up' : 'Communication Log',
'Flat BOM Detail' : 'BOM Explosion Item',
'Expense Voucher Detail' : 'Expense Claim Detail',
'Expense Voucher' : 'Expense Claim',
'Expense Type' : 'Expense Claim Type',
'Enquiry Detail' : 'Opportunity Item',
'Enquiry' : 'Opportunity',
'Earning Detail' : 'Salary Structure Earning',
'DocLayerField' : 'Customize Form Field',
'DocLayer' : 'Customize Form',
'Delivery Note Detail' : 'Delivery Note Item',
'Deduction Detail' : 'Salary Structure Deduction',
'Comment Widget Record' : 'Comment',
'BOM Material' : 'BOM Item',
'Bill Of Materials' : 'BOM',
'Appraisal Detail' : 'Appraisal Goal',
'Advance Allocation Detail' : 'Purchase Invoice Advance',
'Advance Adjustment Detail' : 'Sales Invoice Advance',
'Ledger Detail' : 'Multi Ledger Report Detail',
'TA Control' : 'Trend Analyzer Control',
'Sales and Purchase Return Wizard' : 'Sales and Purchase Return Tool',
'Educational Qualifications Detail' : 'Employee Education',
'Delivery Note Packing Detail' : 'Delivery Note Packing Item',
'Experience In Company Detail' : 'Employee Internal Work History',
'Professional Training Details' : 'Employee Training',
'Previous Experience Detail' : 'Employee External Work History',
}
for d in rendt:
webnotes.conn.sql("""
update
`tabSearch Criteria`
set
doc_type = replace(doc_type, %s, %s),
filters = replace(filters, %s, %s),
columns = replace(columns, %s, %s),
parent_doc_type = replace(parent_doc_type, %s, %s),
add_cond = replace(add_cond, %s, %s),
add_col = replace(add_col, %s, %s),
add_tab = replace(add_tab, %s, %s),
dis_filters = replace(dis_filters, %s, %s),
group_by = replace(group_by, %s, %s),
sort_by = replace(sort_by, %s, %s),
report_script = replace(report_script, %s, %s),
server_script = replace(server_script, %s, %s),
custom_query = replace(custom_query, %s, %s)
""", (d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d],
d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d]))

View File

@@ -0,0 +1,9 @@
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

@@ -0,0 +1,31 @@
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()
import webnotes.model.sync
webnotes.model.sync.sync('core', 'print_format')

View File

@@ -0,0 +1,18 @@
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]))