mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 06:29:20 +00:00
moved directory structure
This commit is contained in:
1
patches/june_2012/__init__.py
Normal file
1
patches/june_2012/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
||||
6
patches/june_2012/alter_tabsessions.py
Normal file
6
patches/june_2012/alter_tabsessions.py
Normal file
@@ -0,0 +1,6 @@
|
||||
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()
|
||||
8
patches/june_2012/barcode_in_feature_setup.py
Normal file
8
patches/june_2012/barcode_in_feature_setup.py
Normal file
@@ -0,0 +1,8 @@
|
||||
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()
|
||||
12
patches/june_2012/cache_item_table.py
Normal file
12
patches/june_2012/cache_item_table.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from __future__ import unicode_literals
|
||||
def execute():
|
||||
"""drop and create __CacheItem table again"""
|
||||
import webnotes
|
||||
webnotes.conn.commit()
|
||||
webnotes.conn.sql("drop table __CacheItem")
|
||||
webnotes.conn.sql("""create table __CacheItem(
|
||||
`key` VARCHAR(180) NOT NULL PRIMARY KEY,
|
||||
`value` LONGTEXT,
|
||||
`expires_on` DATETIME
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8""")
|
||||
webnotes.conn.begin()
|
||||
89
patches/june_2012/cms2.py
Normal file
89
patches/june_2012/cms2.py
Normal file
@@ -0,0 +1,89 @@
|
||||
from __future__ import unicode_literals
|
||||
def execute():
|
||||
import webnotes
|
||||
import webnotes.model.sync
|
||||
|
||||
# sync doctypes required for the patch
|
||||
webnotes.model.sync.sync('website', 'web_cache')
|
||||
webnotes.model.sync.sync('website', 'web_page')
|
||||
webnotes.model.sync.sync('website', 'blog')
|
||||
webnotes.model.sync.sync('website', 'website_settings')
|
||||
webnotes.model.sync.sync('stock', '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.doclist import DocList
|
||||
import webnotes.modules.patch_handler
|
||||
|
||||
for dt in query_map:
|
||||
for result in webnotes.conn.sql(query_map[dt], as_dict=1):
|
||||
try:
|
||||
DocList(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()
|
||||
12
patches/june_2012/copy_uom_for_pur_inv_item.py
Normal file
12
patches/june_2012/copy_uom_for_pur_inv_item.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from __future__ import unicode_literals
|
||||
def execute():
|
||||
import webnotes
|
||||
|
||||
# perform sync
|
||||
import webnotes.model.sync
|
||||
webnotes.model.sync.sync('buying', 'purchase_order_item')
|
||||
webnotes.model.sync.sync('accounts', 'purchase_invoice_item')
|
||||
webnotes.model.sync.sync('stock', '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")
|
||||
18
patches/june_2012/delete_old_parent_entries.py
Normal file
18
patches/june_2012/delete_old_parent_entries.py
Normal file
@@ -0,0 +1,18 @@
|
||||
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])
|
||||
4
patches/june_2012/fetch_organization_from_lead.py
Normal file
4
patches/june_2012/fetch_organization_from_lead.py
Normal file
@@ -0,0 +1,4 @@
|
||||
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")
|
||||
15
patches/june_2012/reports_list_permission.py
Normal file
15
patches/june_2012/reports_list_permission.py
Normal file
@@ -0,0 +1,15 @@
|
||||
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.conn.commit()
|
||||
|
||||
import webnotes.model.sync
|
||||
webnotes.model.sync.sync('core', 'search_criteria')
|
||||
webnotes.model.sync.sync('core', 'report')
|
||||
|
||||
webnotes.conn.begin()
|
||||
7
patches/june_2012/series_unique_patch.py
Normal file
7
patches/june_2012/series_unique_patch.py
Normal file
@@ -0,0 +1,7 @@
|
||||
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()
|
||||
7
patches/june_2012/set_recurring_type.py
Normal file
7
patches/june_2012/set_recurring_type.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
def execute():
|
||||
import webnotes
|
||||
from webnotes.model.sync import sync
|
||||
sync('accounts', 'sales_invoice')
|
||||
|
||||
webnotes.conn.sql("update `tabSales Invoice` set recurring_type = 'Monthly' where ifnull(convert_into_recurring_invoice, 0) = 1")
|
||||
16
patches/june_2012/support_ticket_autoreply.py
Normal file
16
patches/june_2012/support_ticket_autoreply.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from __future__ import unicode_literals
|
||||
def execute():
|
||||
"""New Send Autoreply checkbox in Email Settings"""
|
||||
import webnotes
|
||||
import webnotes.utils
|
||||
|
||||
import webnotes.model.sync
|
||||
webnotes.conn.commit()
|
||||
webnotes.model.sync.sync('setup', '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)
|
||||
Reference in New Issue
Block a user