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,3 @@
from __future__ import unicode_literals

View File

@@ -0,0 +1,36 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import patches.jan_mar_2012.website.login
import patches.jan_mar_2012.website.feed
import patches.jan_mar_2012.website.website
import patches.jan_mar_2012.website.cleanups
import patches.jan_mar_2012.website.domain_list
import patches.jan_mar_2012.website.file_data_rename
import patches.jan_mar_2012.website.analytics
import patches.jan_mar_2012.website.allow_product_delete
def execute():
patches.jan_mar_2012.website.login.execute()
patches.jan_mar_2012.website.feed.execute()
patches.jan_mar_2012.website.website.execute()
patches.jan_mar_2012.website.cleanups.execute()
patches.jan_mar_2012.website.domain_list.execute()
patches.jan_mar_2012.website.file_data_rename.execute()
patches.jan_mar_2012.website.analytics.execute()
patches.jan_mar_2012.website.allow_product_delete.execute()

View File

@@ -0,0 +1,25 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
def execute():
"""
Allow deletion of products
"""
import webnotes
webnotes.conn.sql("""UPDATE `tabDocPerm` SET cancel=1
WHERE parent='Product' AND role='Website Manager'
AND permlevel=0""")

View File

@@ -0,0 +1,22 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
def execute():
from webnotes.modules import reload_doc
reload_doc('website', 'doctype', 'website_settings')
reload_doc('website', 'doctype', 'product_settings')

View File

@@ -0,0 +1,48 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
def execute():
from webnotes.model import delete_doc
from webnotes.modules import reload_doc
delete_doc("DocType", "SSO Control")
delete_doc("DocType", "WN ERP Client Control")
delete_doc("DocType", "Production Tips Common")
delete_doc("DocType", "DocTrigger")
delete_doc("Page", "Setup Wizard")
# cleanup control panel
delete_doc("DocType", "Control Panel")
reload_doc("core", "doctype", "control_panel")
webnotes.conn.sql("""delete from tabSingles
where field like 'startup_%' and doctype='Control Panel'""")
webnotes.conn.sql("""delete from __SessionCache""")
webnotes.conn.commit()
# DDLs
# -------------------
webnotes.conn.sql("drop table if exists tabDocTrigger")
try: webnotes.conn.sql("""alter table `tabFile Data` drop column blob_content""")
except: pass
webnotes.conn.sql("""alter table __PatchLog engine=InnoDB""")

View File

@@ -0,0 +1,39 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.modules import reload_doc
reload_doc('website', 'doctype', 'website_settings')
res = webnotes.conn.sql("""\
SELECT name FROM `tabDocPerm`
WHERE parent='Website Settings' AND role='All' AND permlevel=1""")
if not res:
idx = webnotes.conn.sql("""\
SELECT MAX(idx) FROM `tabDocPerm`
WHERE parent='Website Settings'
""")[0][0]
from webnotes.model.doc import Document
d = Document('DocType', 'Website Settings')
perm = d.addchild('permissions', 'DocPerm')
perm.read = 1
perm.role = 'All'
perm.permlevel = 1
perm.idx = idx + 1
perm.save()

View File

@@ -0,0 +1,23 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
from webnotes.model.doc import Document
from webnotes.modules import reload_doc
def execute():
reload_doc('home', 'doctype', 'feed')

View File

@@ -0,0 +1,81 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
def execute():
"""
* Replace / in names with - in tabFile Data
* Change autoname in DocType File Data to FileData-.#####
* Change FileData/ to FileData- in tabSeries
* In each table containing file_list column, replace / with - in the data of that column
"""
replace_name_in_file_data()
change_autoname_in_tabfile_data()
change_file_data_in_tabseries()
replace_file_list_column_entries()
def replace_name_in_file_data():
"""
Change / to - in tabFile Data name column entries
"""
files = webnotes.conn.sql("SELECT name FROM `tabFile Data`")
for f in files:
if "/" in f[0]:
webnotes.conn.sql("UPDATE `tabFile Data` SET name=%s WHERE name=%s", (f[0].replace('/', '-'), f[0]))
def change_autoname_in_tabfile_data():
"""
Change autoname in DocType File Data to FileData-.#####
"""
webnotes.conn.sql("UPDATE `tabDocType` SET autoname='FileData-.#####' WHERE name='File Data'")
def change_file_data_in_tabseries():
"""
Change FileData/ to FileData- in tabSeries
"""
webnotes.conn.sql("UPDATE `tabSeries` SET name='FileData-' WHERE name='FileData/'")
def replace_file_list_column_entries():
"""
In each table containing file_list column, replace / with - in the data of that column
"""
tables = webnotes.conn.sql("SHOW TABLES")
tab_list = []
for tab in tables:
columns = webnotes.conn.sql("DESC `%s`" % tab[0])
if 'file_list' in [c[0] for c in columns]:
tab_list.append(tab[0])
for tab in tab_list:
data = webnotes.conn.sql("SELECT name, file_list FROM `%s`" % tab)
for name, file_list in data:
if file_list and "/" in file_list:
webnotes.conn.sql("UPDATE `%s` SET file_list='%s' WHERE name='%s'" \
% (tab, file_list.replace('/', '-'), name))
singles = webnotes.conn.sql("""SELECT doctype, value FROM `tabSingles`
WHERE field='file_list'""")
for doctype, file_list in singles:
if file_list and "/" in file_list:
webnotes.conn.sql("""UPDATE `tabSingles` SET value='%s'
WHERE doctype='%s' AND field='file_list'"""
% (file_list.replace('/', '-'), doctype))

View File

@@ -0,0 +1,67 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
def execute():
"""rename from getfle"""
l = [
('Quotation Item', 'description'),
('Sales Order Item', 'description'),
('Delivery Note Item', 'description'),
('Sales Invoice Item', 'description'),
('Item', 'description_html'),
('Letter Head', 'content')
]
import re
for table in l:
for item in webnotes.conn.sql("""select name, %s from `tab%s`
where %s like '%s'""" % (table[1], table[0], table[1], '%cgi-bin/getfile.cgi%')):
txt = re.sub('\&acx=[^"\']*', '', item[1])\
.replace('cgi-bin/getfile.cgi?name=', 'files/')\
.replace('FileData/', 'FileData-')
txt = get_file_id(txt)
webnotes.conn.sql("""update `tab%s` set %s=%s where name=%s""" % \
(table[0], table[1], '%s', '%s'), (txt, item[0]))
# control panel, client name
txt = webnotes.conn.get_value('Control Panel',None,'client_name')
if txt:
txt = get_file_id(txt)
webnotes.conn.set_value('Control Panel', None, 'client_name', txt.replace('index.cgi?cmd=get_file&fname=', 'files/'))
def get_file_id(txt):
"""old file links may be from fileid or filename"""
import re
match = re.search('files/([^"\']*)', txt)
if not match:
print txt
return txt
fname = match.groups()[0]
if not fname.startswith('FileData'):
fid = webnotes.conn.sql("""select name from `tabFile Data`
where file_name=%s""", fname)
if fid:
fid = fid[0][0].replace('/', '-')
txt = txt.replace(fname, fid)
return txt

View File

@@ -0,0 +1,36 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
from webnotes.model.doc import Document
from webnotes.modules import reload_doc
def execute():
add_default_home_page()
reload_doc('setup','doctype','manage_account')
def add_default_home_page():
if not webnotes.conn.sql("""select name from `tabDefault Home Page`
where role='Guest' and home_page='Login Page'"""):
d = Document('Default Home Page')
d.parent = 'Control Panel'
d.parenttype = 'Control Panel'
d.parentfield = 'default_home_pages'
d.role = 'Guest'
d.home_page = 'Login Page'
d.save(1)

View File

@@ -0,0 +1,89 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# website patch
from __future__ import unicode_literals
import webnotes
from webnotes.model.doc import Document
def execute():
add_website_manager()
from webnotes.modules import reload_doc
from webnotes.model import delete_doc
# cleanup page
delete_doc("DocType", "Page")
reload_doc("core", "doctype", "page")
reload_doc('setup', 'doctype', 'item_group')
delete_doc('Website', 'Module Def', 'Website')
reload_doc('website', 'Module Def', 'Website')
reload_doc('website', 'Role', 'Website Manager')
reload_doc('website', 'Role', 'Blogger')
webnotes.conn.sql("""delete from `tabModule Def Role` where parent='Website'""")
d = Document('Module Def Role')
d.parent = 'Website'
d.role = 'Website Manager'
d.save()
reload_doc('website', 'doctype', 'about_us_settings')
reload_doc('website', 'doctype', 'about_us_team')
reload_doc('website', 'doctype', 'blog')
reload_doc('website', 'doctype', 'contact_us_settings')
reload_doc('website', 'doctype', 'product')
reload_doc('website', 'doctype', 'product_group')
reload_doc('website', 'doctype', 'products_settings')
reload_doc('website', 'doctype', 'related_page')
reload_doc('website', 'doctype', 'style_settings')
reload_doc('website', 'doctype', 'top_bar_item')
reload_doc('website', 'doctype', 'web_page')
reload_doc('website', 'doctype', 'website_settings')
reload_doc('website', 'page', 'about')
reload_doc('website', 'page', 'blog')
reload_doc('website', 'page', 'contact')
reload_doc('website', 'page', 'products')
reload_doc('website', 'page', 'unsubscribe')
create_home_page()
add_website_manager()
def create_home_page():
"""create a dummy home page"""
from webnotes.model.code import get_obj
if not webnotes.conn.sql("""select name from `tabWeb Page` where name='home'"""):
d = Document('Web Page')
d.title = 'Home'
d.head_section = "<h1>Your Headline</h1>"
d.main_section = "<p>Some introduction about your company</p>"
d.side_section = "<p>Links to other pages</p>"
d.save()
obj = get_obj(doc = d)
obj.validate()
obj.doc.save()
def add_website_manager():
"""add website manager to system manager"""
for i in webnotes.conn.sql("""select distinct parent from tabUserRole
where role='System Manager'"""):
if not webnotes.conn.sql("""select parent from tabUserRole
where role='Website Manager' and parent=%s""", i[0]):
d = Document('UserRole')
d.parent = i[0]
d.role = 'Website Manager'
d.save(1)