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,26 @@
# 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
webnotes.conn.sql("""update `tabAccount`
set account_type = 'Chargeable'
where account_name in ('CENVAT Capital Goods', 'CENVAT Service Tax', 'CENVAT Service Tax Cess 1', 'CENVAT Service Tax Cess 2',
'P L A', 'P L A - Cess Portion', 'VAT', 'TDS (Advertisement)', 'TDS (Commission)', 'TDS (Contractor)', 'TDS (Interest)',
'TDS (Rent)', 'TDS (Salary)')
""")

View File

@@ -0,0 +1,11 @@
from __future__ import unicode_literals
def execute():
"""
Adds various roles to Administrator. This patch is for making master db
ready for on premise installation
"""
import webnotes
from webnotes.model.code import get_obj
from webnotes.model.doc import Document
sc = get_obj('Setup Control', 'Setup Control')
sc.add_roles(Document('Profile', 'Administrator'))

View File

@@ -0,0 +1,37 @@
# 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():
"""
Changes allocated_to option to Profile in
DocType Customer Issue
"""
import webnotes
webnotes.conn.sql("""
UPDATE `tabDocField`
SET options='Profile'
WHERE fieldname='allocated_to'
""")
webnotes.conn.sql("""
DELETE from `tabDocField`
WHERE parent='Customer Issue'
AND label='Make Maintenance Visit'
""")
from webnotes.modules import reload_doc
reload_doc('support', 'doctype', 'customer_issue')

View File

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

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
def execute():
"""
* Reload ToDo
"""
from webnotes.modules import reload_doc
reload_doc('utilities', 'doctype', 'todo_item')

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():
"""
Set docstatus = 2 where status = 'Purchase Returned' for serial no
"""
import webnotes
webnotes.conn.sql("""\
UPDATE `tabSerial No` SET docstatus=2
WHERE status='Purchase Returned'""")

View File

@@ -0,0 +1,20 @@
# 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
webnotes.clear_cache()

View File

@@ -0,0 +1,28 @@
# 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():
sql = webnotes.conn.sql
sql("commit")
sql("set foreign_key_checks=0")
for tab in sql("show tables"):
sql("ALTER TABLE `%s` CONVERT TO CHARACTER SET utf8" % tab[0])
sql("set foreign_key_checks=1")

View File

@@ -0,0 +1,75 @@
# 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():
"""
* Reload Search Criteria "Customer Address Contact"
* SET is_primary_contact=1, is_primary_address=1 WHERE not specified
"""
reload_sc()
patch_primary_contact()
patch_primary_address()
def reload_sc():
from webnotes.modules import reload_doc
reload_doc('selling', 'search_criteria', 'customer_address_contact')
reload_doc('selling', 'Module Def', 'Selling')
def patch_primary_contact():
res = webnotes.conn.sql("""
SELECT name FROM `tabContact`
WHERE customer IN (
SELECT customer FROM `tabContact`
WHERE IFNULL(customer, '')!=''
GROUP BY customer HAVING SUM(IFNULL(is_primary_contact, 0))=0
) OR supplier IN (
SELECT supplier FROM `tabContact`
WHERE IFNULL(supplier, '')!=''
GROUP BY supplier HAVING SUM(IFNULL(is_primary_contact, 0))=0
) OR sales_partner IN (
SELECT sales_partner FROM `tabContact`
WHERE IFNULL(sales_partner, '')!=''
GROUP BY sales_partner HAVING SUM(IFNULL(is_primary_contact, 0))=0
)
""", as_list=1)
names = ", ".join(['"' + unicode(r[0]) + '"' for r in res if r])
if names: webnotes.conn.sql("UPDATE `tabContact` SET is_primary_contact=1 WHERE name IN (%s)" % names)
def patch_primary_address():
res = webnotes.conn.sql("""
SELECT name FROM `tabAddress`
WHERE customer IN (
SELECT customer FROM `tabAddress`
WHERE IFNULL(customer, '')!=''
GROUP BY customer HAVING SUM(IFNULL(is_primary_address, 0))=0
AND SUM(IFNULL(is_shipping_address, 0))=0
) OR supplier IN (
SELECT supplier FROM `tabAddress`
WHERE IFNULL(supplier, '')!=''
GROUP BY supplier HAVING SUM(IFNULL(is_primary_address, 0))=0
AND SUM(IFNULL(is_shipping_address, 0))=0
) OR sales_partner IN (
SELECT sales_partner FROM `tabAddress`
WHERE IFNULL(sales_partner, '')!=''
GROUP BY sales_partner HAVING SUM(IFNULL(is_primary_address, 0))=0
AND SUM(IFNULL(is_shipping_address, 0))=0
)
""", as_list=1)
names = ", ".join(['"' + unicode(r[0]) + '"' for r in res if r])
if names: webnotes.conn.sql("UPDATE `tabAddress` SET is_primary_address=1 WHERE name IN (%s)" % names)

View File

@@ -0,0 +1,21 @@
# 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.model import delete_doc
delete_doc('DocType', 'Purpose of Service')

View File

@@ -0,0 +1,65 @@
# 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.modules import reload_doc
def execute():
delete_fields_dn_detail()
deploy_packing_slip()
del_packing_slip_pf()
def delete_fields_dn_detail():
"""
Delete old fields related to packing slip
"""
from webnotes.model import delete_fields
delete_fields({
'Delivery Note': [
'print_packing_slip', 'shipping_mark', 'packed_by',
'packing_checked_by', 'Text', 'pack_size'
],
'Delivery Note Item': [
'pack_no', 'pack_gross_wt', 'weight_uom',
'pack_nett_wt', 'no_of_packs', 'pack_unit', 'pack_size',
'packed_by', 'packing_checked_by'
]
}, delete=1)
delete_fields({'Item': ['nett_weight', 'gross_weight']}, delete=1)
reload_doc('stock', 'doctype', 'delivery_note')
reload_doc('stock', 'doctype', 'delivery_note_detail')
reload_doc('stock', 'doctype', 'item')
def deploy_packing_slip():
reload_doc('stock', 'doctype', 'packing_slip')
reload_doc('stock', 'doctype', 'packing_slip_detail')
reload_doc('stock', 'Module Def', 'Stock')
reload_doc('stock', 'DocType Mapper', 'Delivery Note-Packing Slip')
def del_packing_slip_pf():
"""
Delete Print Format: 'Delivery Note Packing List Wise'
"""
webnotes.conn.sql("""\
DELETE FROM `tabDocFormat`
WHERE parent='Delivery Note'
AND format='Delivery Note Packing List Wise'""")
from webnotes.model import delete_doc
delete_doc('Print Format', 'Delivery Note Packing List Wise')

View File

@@ -0,0 +1,29 @@
# 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():
"""
* Change option of doclayer's doc_type field
* Reload doclayer
"""
webnotes.conn.sql("""
UPDATE `tabDocField` SET options=NULL
WHERE parent='Customize Form' AND fieldname='doc_type'
""")
from webnotes.modules import reload_doc
reload_doc('core', 'doctype', 'doclayer')

View File

@@ -0,0 +1,8 @@
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.modules import reload_doc
webnotes.conn.sql("delete from `tabField Mapper Detail` where from_field = 'transaction_date' and parent in ('Sales Order-Delivery Note', 'Purchase Order-Purchase Receipt')")
reload_doc('stock', 'DocType Mapper', 'Sales Order-Delivery Note')
reload_doc('stock', 'DocType Mapper', 'Purchase Order-Purchase Receipt')

View File

@@ -0,0 +1,30 @@
# 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():
"""
* Change type of mail_port field to int
* reload email settings
"""
import webnotes
webnotes.conn.sql("""
UPDATE `tabDocField` SET fieldtype='Int'
WHERE parent = 'Email Settings' AND fieldname = 'mail_port'
""")
from webnotes.modules import reload_doc
reload_doc('setup', 'doctype', 'email_settings')

View File

@@ -0,0 +1,37 @@
# 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():
"""
* Change DN to PS mapper
+ Set Ref doc should be submitted to 0
+ Set validation logic of DN PS Table mapper record to docstatus=0
"""
import webnotes
webnotes.conn.sql("""\
UPDATE `tabDocType Mapper`
SET ref_doc_submitted=0
WHERE name='Delivery Note-Packing Slip'""")
webnotes.conn.sql("""\
UPDATE `tabTable Mapper Detail`
SET validation_logic='docstatus=0'
WHERE parent='Delivery Note-Packing Slip'
AND docstatus=0
AND from_table='Delivery Note'
AND to_table='Packing Slip'""")

View File

@@ -0,0 +1,44 @@
# 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():
"""
Patch includes:
* Reload of Stock Entry Detail
"""
from webnotes.modules import reload_doc
reload_doc('stock', 'doctype', 'stock_entry_detail')
reload_doc('stock', 'doctype', 'item_supplier')
reload_doc('stock', 'doctype', 'item')
webnotes.conn.sql("""
UPDATE tabDocField SET fieldtype='Float'
WHERE parent='BOM'
AND fieldname IN ('operating_cost', 'raw_material_cost', 'total_cost')
""")
webnotes.conn.sql("""
UPDATE tabDocField SET fieldtype='Float'
WHERE parent='BOM Item'
AND fieldname IN ('qty', 'rate', 'amount', 'qty_consumed_per_unit')
""")
reload_doc('stock', 'doctype', 'stock_entry')
reload_doc('production', 'doctype', 'bill_of_materials')
reload_doc('production', 'doctype', 'bom_material')

View File

@@ -0,0 +1,38 @@
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.model import delete_doc
from webnotes.modules import reload_doc
webnotes.conn.sql("""delete from `tabDocField`
where label in ('Note1', 'OT Notes', 'Note', 'Note HTML', 'Rates HTML')
and parent in ('Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice', 'Purchase Order')""")
del_flds = {
'Sales Order Item': "'delivery_date', 'confirmation_date'",
'Delivery Note': "'supplier', 'supplier_address', 'purchase_receipt_no', 'purchase_order_no', 'transaction_date'",
'Sales Invoice': "'voucher_date'",
'Purchase Invoice': "'voucher_date'",
'Purchase Receipt': "'transaction_date'"
}
del_labels = {
'Delivery Note': "'Supplier Details'",
'Purchase Receipt': "'Get Currrent Stock'"
}
for d in del_flds:
webnotes.conn.sql("delete from `tabDocField` where fieldname in (%s) and parent = '%s'"% (del_flds[d], d))
for d in del_labels:
webnotes.conn.sql("delete from `tabDocField` where label in (%s) and parent = '%s'"% (del_labels[d], d))
delete_doc('DocType', 'Update Delivery Date Detail')
# Reload print formats
reload_doc('accounts', 'Print Format', 'Sales Invoice Classic')
reload_doc('accounts', 'Print Format', 'Sales Invoice Modern')
reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan')

View File

@@ -0,0 +1,68 @@
# 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.code import get_obj
from webnotes.model.doc import addchild
def execute():
"""
* Maps conversion rate in doctype mapper PO-PR
* Maps conversion rate in doctype mapper PO-PV
"""
args = [
{
'parent': 'Purchase Order-Purchase Receipt',
'map': [{
'from_table': 'Purchase Order',
'to_table': 'Purchase Receipt',
'fields': [['conversion_rate', 'conversion_rate', 'Yes']]
}]
},
{
'parent': 'Purchase Order-Purchase Invoice',
'map': [{
'from_table': 'Purchase Order',
'to_table': 'Purchase Invoice',
'fields': [['conversion_rate', 'conversion_rate', 'Yes']]
}]
},
]
for a in args:
for m in a['map']:
match_id = webnotes.conn.sql("""\
SELECT match_id FROM `tabTable Mapper Detail`
WHERE parent=%s AND from_table=%s AND to_table=%s\
""", (a['parent'], m['from_table'], m['to_table']))[0][0]
for f in m['fields']:
res = webnotes.conn.sql("""\
SELECT name FROM `tabField Mapper Detail`
WHERE parent=%s AND from_field=%s AND to_field=%s
AND match_id=%s""", (a['parent'], f[0], f[1], match_id))
if not res:
max_idx = webnotes.conn.sql("""\
SELECT IFNULL(MAX(idx), 0) FROM `tabField Mapper Detail`
WHERE parent=%s""", a['parent'])[0][0]
obj = get_obj('DocType Mapper', a['parent'])
c = addchild(obj.doc, 'field_mapper_details', 'Field Mapper Detail', obj.doclist)
c.from_field = f[0]
c.to_field = f[1]
c.fields['map'] = f[2]
c.match_id = match_id
c.idx = max_idx + 1
c.save()

View File

@@ -0,0 +1,4 @@
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("delete from `tabTable Mapper Detail` where to_table = 'Sales Invoice Item' and parent = 'Delivery Note-Sales Invoice' and validation_logic = 'amount > ifnull(billed_amt, 0) and docstatus = 1'")

View File

@@ -0,0 +1,60 @@
# 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
import _mysql_exceptions
def execute():
from webnotes.modules import reload_doc
reload_doc('accounts', 'page', 'accounts_home')
reload_doc('selling', 'page', 'selling_home')
reload_doc('buying', 'page', 'buying_home')
reload_doc('stock', 'page', 'stock_home')
reload_doc('hr', 'page', 'hr_home')
reload_doc('support', 'page', 'support_home')
reload_doc('production', 'page', 'production_home')
reload_doc('projects', 'page', 'projects_home')
reload_doc('website', 'page', 'website_home')
reload_doc('home', 'page', 'desktop')
reload_doc('utilities', 'page', 'todo')
reload_doc('utilities', 'page', 'calendar')
reload_doc('utilities', 'page', 'messages')
reload_doc('setup', 'page', 'modules_setup')
reload_doc('utilities', 'page', 'users')
reload_doc('home', 'page', 'activity')
reload_doc('home', 'page', 'attributions')
reload_doc('core', 'doctype', 'profile')
# update user_image in profile
for p in webnotes.conn.sql("""select name, file_list from tabProfile
where ifnull(file_list,'')!=''"""):
fid = p[1].split('\n')[0].split(',')[1]
webnotes.conn.set_value('Profile', p[0], 'user_image', fid)
webnotes.conn.set_value('Control Panel', 'Control Panel', 'home_page',
'desktop')
webnotes.conn.commit()
try:
webnotes.conn.sql("""create table __SchedulerLog (
`timestamp` timestamp,
method varchar(200),
error text
) engine=MyISAM""")
except _mysql_exceptions.OperationalError, e:
pass

View File

@@ -0,0 +1,20 @@
# 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
webnotes.conn.sql("update `tabDocField` set no_copy = 1 where fieldname = 'insert_after' and parent = 'Custom Field'")

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
def execute():
import webnotes
from webnotes.model.code import get_obj
from webnotes.modules import reload_doc
sql = webnotes.conn.sql
reload_doc('hr', 'doctype', 'appraisal')
sql("update `tabDocField` set `hidden` = 0 where fieldname = 'group_or_ledger' and parent = 'Cost Center'")
sql("update tabDocPerm set amend = 0 where parent = 'Salary Structure'")
sql("update tabDocPerm set cancel = 1 where parent = 'Company' and role = 'System Manager'")
if sql("select count(name) from `tabDocField` where label = 'View Ledger Entry' and parent = 'Journal Voucher' and fieldtype = 'Button'")[0][0] > 1:
sql("delete from `tabDocField` where label = 'View Ledger Entry' and parent = 'Journal Voucher' and fieldtype = 'Button' limit 1")
if sql("select count(name) from `tabDocField` where label = 'Get Balance' and parent = 'Journal Voucher' and fieldtype = 'Button'")[0][0] > 1:
sql("delete from `tabDocField` where label = 'Get Balance' and parent = 'Journal Voucher' and fieldtype = 'Button' limit 1")
if sql("select count(name) from `tabDocField` where label = 'Get Specification Details' and parent = 'Quality Inspection' and fieldtype = 'Button'")[0][0] > 1:
sql("delete from `tabDocField` where label = 'Get Specification Details' and parent = 'Quality Inspection' and fieldtype = 'Button' limit 1")
reload_doc('stock', 'DocType Mapper', 'Purchase Order-Purchase Receipt')
reload_doc('accounts', 'doctype', 'cost_center')
sql("update `tabDocType` set subject = 'Item Code: %(item_code)s, Warehouse: %(warehouse)s' where name = 'Serial No'")
# Patch for adding packing related columns (packed by, checked by, shipping mark etc)
reload_doc('stock','doctype','delivery_note')
sql("update `tabDocField` set allow_on_submit = 1 where fieldname = 'page_break'")
sql("update `tabDocField` set allow_on_submit = 1 where fieldname in ('indent_details', 'po_details', 'purchase_receipt_details', 'entries', 'sales_order_details', 'delivery_note_details', 'quotation_details') and fieldtype = 'Table'")
from webnotes.session_cache import clear_cache
clear_cache(webnotes.session['user'])
# FEATURES SETUP
#----------------
reload_doc('setup', 'doctype','features_setup')
flds = ['page_break', 'projects', 'packing_details', 'discounts', 'brands', 'item_batch_nos', 'after_sales_installations', 'item_searial_nos', 'item_group_in_details', 'exports', 'imports', 'item_advanced', 'sales_extras', 'more_info', 'quality', 'manufacturing', 'pos', 'item_serial_nos']
st = "'"+"', '".join(flds)+"'"
sql("delete from `tabSingles` where field in (%s) and doctype = 'Features Setup'" % st)
sql("delete from `tabDocField` where fieldname in (%s) and parent = 'Features Setup'" % st)
sql("delete from `tabDefaultValue` where defkey in (%s) and parent = 'Control Panel'" % st)
if not sql("select * from `tabDefaultValue` where defkey like 'fs_%' and parent = 'Control Panel'"):
rs = sql("select fieldname from tabDocField where parent='Features Setup' and fieldname is not null")
fs = get_obj('Features Setup', 'Features Setup')
for d in rs:
fs.doc.fields[d[0]] = 1
fs.doc.save()
fs.validate()

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
def execute():
import webnotes
webnotes.conn.sql("update `tabDocField` set `default` = 1 where fieldname = 'conversion_rate' and parent = 'POS Setting'")
from webnotes.model import delete_doc
delete_doc('DocType', 'POS Settings')

View File

@@ -0,0 +1,37 @@
# 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():
"""
To Hide Net Total, Grand Total Export and Rounded Total Export on checking print hide
Uncheck print_hide for fields:
net_total, grand_total_export and rounded_total_export
For DocType(s):
* Sales Invoice
* Sales Order
* Delivery Note
* Quotation
"""
webnotes.conn.sql("""\
UPDATE tabDocField
SET print_hide = 0
WHERE fieldname IN ('net_total', 'grand_total_export', 'rounded_total_export')
AND parent IN ('Sales Invoice', 'Sales Order', 'Delivery Note', 'Quotation')
""")

View File

@@ -0,0 +1,86 @@
# 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
from webnotes.model import delete_doc
sql = webnotes.conn.sql
# Production Planning Tool
#---------------------------------------------------------------
#delete_doc('DocType', 'Production Plan Item')
#delete_doc('DocType', 'Production Plan Sales Order')
#delete_doc('DocType', 'Production Planning Tool')
sql("delete from `tabDocField` where parent in ('Production Planning Tool', 'Production Plan Item', 'Production Plan Sales Order')")
reload_doc('production', 'doctype', 'production_planning_tool')
reload_doc('production', 'doctype', 'pp_detail')
reload_doc('production', 'doctype', 'pp_so_detail')
# Production Order
#---------------------------------------------------------------
reload_doc('production', 'doctype', 'production_order')
sql("""delete from `tabDocField` where parent = 'Production Order'
and (label in ('Material Transfer', 'Backflush', 'Stop Production Order', 'Unstop Production Order')
or fieldname = 'transaction_date')
""")
# BOM
#---------------------------------------------------------------
reload_doc('production', 'doctype', 'bill_of_materials')
reload_doc('production', 'doctype', 'bom_material')
reload_doc('production', 'doctype', 'bom_operation')
reload_doc('production', 'doctype', 'flat_bom_detail')
#copy values
sql("""update `tabBOM` set rm_cost_as_per = 'Valuation Rate',
raw_material_cost = dir_mat_as_per_mar, total_cost = cost_as_per_mar, costing_date = cost_as_on""")
sql("update `tabBOM Item` set rate = moving_avg_rate, amount = amount_as_per_mar")
sql("update `tabBOM Explosion Item` set rate = moving_avg_rate, amount = amount_as_per_mar")
# delete depricated flds from bom
sql(""" delete from `tabDocField` where parent = 'BOM'
and (
label in ('TreeView1', 'Set as Default BOM', 'Activate BOM', 'Inactivate BOM')
or fieldname in ('cost_as_per_mar', 'cost_as_per_lpr', 'cost_as_per_sr', 'cost_as_on',
'dir_mat_as_per_mar', 'dir_mat_as_per_lpr', 'dir_mat_as_per_sr')
)
""")
# delete depricated flds from bom operation
sql("delete from `tabDocField` where parent = 'BOM Operation' and fieldname in ('details', 'workstation_capacity')")
# delete depricated flds from bom material
sql("""delete from `tabDocField` where parent = 'BOM Item'
and fieldname in ('dir_mat_as_per_mar', 'dir_mat_as_per_sr', 'dir_mat_as_per_lpr', 'operating_cost', 'value_as_per_mar',
'value_as_per_sr', 'value_as_per_lpr', 'moving_avg_rate', 'standard_rate', 'last_purchase_rate', 'amount_as_per_sr',
'amount_as_per_lpr', 'amount_as_per_mar')
""")
# delete depricated flds from flat bom
sql("""delete from tabDocField where parent = 'BOM Explosion Item'
and fieldname in ('moving_avg_rate', 'standard_rate', 'last_purchase_rate', 'amount_as_per_mar',
'amount_as_per_sr', 'amount_as_per_lpr', 'flat_bom_no', 'bom_mat_no', 'is_pro_applicable')
""")

View File

@@ -0,0 +1,21 @@
# 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('core', 'doctype', 'doctype')

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
def execute():
import webnotes
from webnotes.modules import reload_doc
reload_doc('stock', 'doctype', 'item')
webnotes.conn.sql("update `tabItem` set re_order_qty = min_order_qty")

View File

@@ -0,0 +1,10 @@
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.modules import reload_doc
reload_doc('stock', 'DocType Mapper', 'Sales Order-Delivery Note')
reload_doc('accounts', 'DocType Mapper', 'Sales Order-Sales Invoice')
reload_doc('accounts', 'DocType Mapper', 'Delivery Note-Sales Invoice')
webnotes.conn.sql("delete from `tabField Mapper Detail` where parent = 'Sales Order-Delivery Note' and from_field = 'basic_rate' and to_field = 'basic_rate'")

View File

@@ -0,0 +1,21 @@
# 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('stock', 'DocType Mapper', 'Purchase Order-Purchase Receipt')

View File

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

View File

@@ -0,0 +1,4 @@
from __future__ import unicode_literals
def execute():
pass

View File

@@ -0,0 +1,41 @@
# 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/>.
# TODO take backup before running this patch
from __future__ import unicode_literals
def execute():
"""
* Restore archived data from arc tables
* Drop arc tables
"""
import webnotes
from webnotes.utils import archive
arc_tables = webnotes.conn.sql('show tables like "arc%"')
try:
webnotes.conn.auto_commit_on_many_writes = 1
for tab in arc_tables:
tab = tab[0]
dt = tab[3:]
res = webnotes.conn.sql("SELECT name FROM `%s`" % tab)
for dn in res:
archive.archive_doc(dt, dn[0], restore=1)
except Exception, e:
raise e
else:
webnotes.conn.commit()
for tab in arc_tables:
webnotes.conn.sql("DROP TABLE `%s`" % tab[0])
webnotes.conn.begin()

View File

@@ -0,0 +1,31 @@
# 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():
"""
Remove One Get TDS button, which is appearing twice in JV
"""
import webnotes
webnotes.conn.sql("""
DELETE from `tabDocField`
WHERE parent='Journal Voucher'
AND label='Get TDS'
AND fieldtype='Button'
""")
from webnotes.modules import reload_doc
reload_doc('accounts', 'doctype', 'journal_voucher')

View File

@@ -0,0 +1,4 @@
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("update `tabDocField` set `default`='' where parent = 'Sales Invoice' and fieldname = 'naming_series' and `default` = 'INV'")

View File

@@ -0,0 +1,437 @@
from __future__ import unicode_literals
import webnotes
import conf
import webnotes.model
from webnotes.model.code import get_obj
from wnf import replace_code
from termcolor import colored
from webnotes.modules import reload_doc
from webnotes.utils import make_esc
import os
def execute1():
#rendt = get_dt_to_be_renamed()
#rename_dt_files(rendt)
#update_local_file_system()
replace_labels_with_fieldnames()
def execute():
#---------------------------------------------------
# doctype renaming
rendt = get_dt_to_be_renamed()
# Rename dt in db
rename_in_db(rendt, 'DocType', 1)
# Upadte dt in records
update_dt_in_records(rendt)
#---------------------------------------------------
# Dt Mapper renaming
ren_mapper = get_mapper_to_be_renamed()
# Rename mapper in db
rename_in_db(ren_mapper, 'DocType Mapper', 0)
#---------------------------------------------------
# GL Mapper renaming
gl_mapper = {'Receivable Voucher': 'Sales Invoice', 'Payable Voucher': 'Purchase Invoice'}
rename_in_db(gl_mapper, 'GL Mapper', 0)
#---------------------------------------------------
# remove dt label
webnotes.conn.sql("""delete from `tabDocType Label` where name in ('Ticket', 'Receivable Voucher',
'QA Inspection Report', 'Payable Voucher', 'Manage Account', 'Indent', 'DocLayer')""")
#---------------------------------------------------
# Reload mapper from file
for d in ren_mapper:
mod = '_'.join(webnotes.conn.sql("select module from `tabDocType Mapper` where name = %s",
ren_mapper[d])[0][0].lower().split())
reload_doc(mod, 'DocType Mapper', ren_mapper[d])
delete_search_criteria()
change_report_module()
# reload custom search criteria
#for d in webnotes.conn.sql("""select name, module from
# `tabSearch Criteria` where ifnull(standard, 'No') = 'Yes' and ifnull(disabled, 0) = 0"""):
#
for path, folders, files in os.walk(conf.modules_path):
if not path.endswith('search_criteria'): continue
module = path.split(os.sep)[-2]
for sc in folders:
try:
reload_doc(module, 'search_criteria', sc)
print module, sc
except Exception, e:
print "did not reload: " + str(d)
webnotes.conn.sql("""DELETE FROM `tabPrint Format`
WHERE name IN ('Delivery Note Format', 'Purchase Order Format',
'Quotation Format', 'Receivable Voucher Format', 'Sales Order',
'SalesInvoiceModern_test', 'SalesInvoiceStdNew',
'Service Order Format', 'Service Quotation Format')""")
# reload custom print format
for d in webnotes.conn.sql("""select name, module from `tabPrint Format`
where ifnull(standard, 'No') = 'Yes'"""):
try:
reload_doc(d[1], 'Print Format', d[0])
except Exception, e:
print "did not reload: " + str(d)
# Reload GL Mapper
for d in webnotes.conn.sql("select name from `tabGL Mapper`"):
reload_doc('accounts', 'GL Mapper', d[0])
reload_doc('accounts', 'GL Mapper', 'Purchase Invoice with write off')
webnotes.conn.sql("update `tabDocType` set module = 'Utilities' where module = 'Knowledge Base'")
webnotes.conn.sql("update `tabPage` set module = 'Utilities' where module = 'Knowledge Base'")
def delete_search_criteria():
webnotes.conn.sql("""DELETE FROM `tabSearch Criteria`
WHERE name IN ('', 'bills-to_be_paid',
'bills-to_be_submitted', 'cenvat_credit_-_input_or_capital_goods',
'appraisal_custom', 'custom_test', 'custom_test1', 'delivery_note-to_be_billed',
'delivery_note-to_be_submitted', 'delivery_notes',
'employee_leave_balance_report', 'flat_bom_report',
'general_ledger1', 'lead_interested',
'payables_-_as_on_outstanding', 'periodical_budget_report',
'projectwise_delivered_qty_and_costs_as_per_purchase_cost',
'projectwise_pending_qty_and_costs_as_per_purchase_cost', 'sales',
'sales_order1', 'sales_order_pending_items',
'territory_wise_sales_-_target_vs_actual_', 'test_report',
'lease_agreement_list', 'lease_monthly_future_installment_inflows',
'lease_over_due_list', 'lease_overdue_age_wise',
'lease_receipt_summary_month_wise', 'lease_receipts_client_wise',
'lease_yearly_future_installment_inflows',
'monthly_ledger_summary_report', 'payables_-_as_on_outstanding',
'payment_report', 'progressive_total_excise_duty',
'service_tax_credit_account_-_inputs',
'total_amout_collection_for_a_period_-_customerwise',
'invoices-to_be_submitted', 'invoices-to_receive_payment',
'opportunity-quotations_to_be_sent', 'purchase_order-to_be_billed',
'purchase_order-to_be_submitted',
'purchase_order-to_receive_items',
'purchase_request-purchase_order_to_be_made',
'purchase_request-to_be_submitted',
'sales-order_to_be_submitted', 'sales_order-overdue',
'sales_order-to_be_billed', 'sales_order-to_be_delivered',
'sales_order-to_be_submitted', 'task-open', 'appraisal_custom',
'employee_details', 'employee_in_company_experience',
'employee_leave_balance_report', 'employeewise_leave_transaction_details',
'pending_appraisals', 'pending_expense_claims', 'delivery_plan', 'flat_bom_report',
'dispatch_report', 'projectwise_delivered_qty_and_costs_as_per_purchase_cost',
'projectwise_pending_qty_and_costs_as_per_purchase_cost', 'custom_test', 'custom_test1',
'delivery_notes', 'delivery_note_disabled', 'lead', 'lead_interested', 'lead_report',
'periodic_sales_summary', 'monthly_despatched_trend', 'sales', 'sales_order',
'sales_order1', 'sales_agentwise_commission', 'test_report',
'territory_wise_sales_-_target_vs_actual_',
'pending_po_items_to_bill1', 'pending_po_items_to_receive1',
'expense_vouchers', 'pending_expense_vouchers', 'shortage_to_indent')""")
webnotes.conn.sql("""
DELETE FROM `tabSearch Criteria`
WHERE name IN ('monthly_transaction_summary', 'trend_analyzer',
'yearly_transaction_summary', 'invoices-overdue', 'lead-to_follow_up',
'opportunity-to_follow_up', 'serial_no-amc_expiring_this_month',
'serial_no-warranty_expiring_this_month')
AND IFNULL(standard, 'No') = 'Yes'
""")
def change_report_module():
reports = {'itemwise_receipt_details': 'Stock'}
for k in reports:
webnotes.conn.sql("update `tabSearch Criteria` set module = %s where name = %s", (reports[k], k))
def rename_in_db(ren_data, data_type, is_doctype):
for d in ren_data:
print colored('Renaming... ' + d + ' --> '+ ren_data[d], 'yellow')
#rename
try:
webnotes.model.rename(data_type, d, ren_data[d], is_doctype)
except Exception, e:
if e.args[0]!=1050:
raise e
else:
print e
pass
def update_dt_in_records(rendt):
for d in rendt:
# Feed, property setter, search criteria, gl mapper, form 16A, naming series options, doclayer - dodtype is not mentioed in options
dt_list = webnotes.conn.sql("""select t1.parent, t1.fieldname from
tabDocField t1, tabDocType t2 where t1.parent = t2.name and
t1.fieldname in ('dt', 'doctype', 'doc_type', 'dt_type') and
ifnull(t1.options, '') = '' and ifnull(t2.issingle, 0) = 0 and
t1.parent in ('Custom Field', 'Custom Script', 'Property Setter')""")
for dt in dt_list:
webnotes.conn.sql("update `tab%s` set %s = replace(%s, '%s', '%s') where %s = '%s'" % (dt[0], dt[1], dt[1], d, rendt[d], dt[1], d))
# gl mapper, gl entry
webnotes.conn.sql("update `tabGL Mapper Detail` set against_voucher_type = replace(against_voucher_type, '%s', '%s') where against_voucher_type like '%%%s%%'" % (d, rendt[d], d))
webnotes.conn.sql("update `tabGL Entry` set against_voucher_type = replace(against_voucher_type, '%s', '%s') where against_voucher_type = '%s'" % (d, rendt[d], d))
webnotes.conn.sql("update `tabGL Entry` set voucher_type = replace(voucher_type, '%s', '%s') where voucher_type = '%s'" % (d, rendt[d], d))
# Stock ledger entry
webnotes.conn.sql("update `tabStock Ledger Entry` set voucher_type = replace(voucher_type, '%s', '%s') where voucher_type = '%s'" % (d, rendt[d], d))
# Custom fld: options
webnotes.conn.sql("update `tabCustom Field` set options = replace(options, %s, %s) where fieldtype in ('Link', 'Select', 'Table')", (d, rendt[d]))
#Property Setter: value (if property=options)
webnotes.conn.sql("update `tabProperty Setter` set value = replace(value, %s, %s) where property = 'Options'", (d, rendt[d]))
# custom script: script
webnotes.conn.sql("update `tabCustom Script` set script = replace(script, %s, %s)", (d, rendt[d]))
# print format: html
webnotes.conn.sql("update `tabPrint Format` set html = replace(html, %s, %s) where ifnull(standard, 'Yes') = 'No'", (d, rendt[d]))
# custom report: doc_type, filters, columns, parent_doc_type, add_cond, add_col, add_tab,
# dis_filters, group_by, sort_by, report_script, server_script, custom_query
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)
where
ifnull(standard, 'Yes') = 'No'
""", (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], ))
def get_dt_to_be_renamed():
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',
}
return rendt
def get_mapper_to_be_renamed():
ren_map = {
'Sales Order-Receivable Voucher' : 'Sales Order-Sales Invoice',
'Sales Order-Indent' : 'Sales Order-Purchase Request',
'Receivable Voucher-Delivery Note' : 'Sales Invoice-Delivery Note',
'Purchase Receipt-Payable Voucher' : 'Purchase Receipt-Purchase Invoice',
'Purchase Order-Payable Voucher' : 'Purchase Order-Purchase Invoice',
'Project-Receivable Voucher' : 'Project-Sales Invoice',
'Lead-Enquiry' : 'Lead-Opportunity',
'KRA Template-Appraisal' : 'Appraisal Template-Appraisal',
'Indent-Purchase Order' : 'Purchase Request-Purchase Order',
'Enquiry-Quotation' : 'Opportunity-Quotation',
'Delivery Note-Receivable Voucher' : 'Delivery Note-Sales Invoice'
}
return ren_map
#--------------------------------------------------------------------------------------------------------
def update_local_file_system():
""" RUN ONLY IN LOCAL"""
# doctype renaming
rendt = get_dt_to_be_renamed()
# replace dt in js/py file
update_file_content(rendt)
# git mv
rename_dt_files(rendt)
# Mapper renaming
ren_mapper = get_mapper_to_be_renamed()
rename_mapper_files(ren_mapper)
os.system('git mv erpnext/accounts/GL\ Mapper/Payable\ Voucher erpnext/accounts/GL\ Mapper/Purchase\ Invoice')
os.system('git mv erpnext/accounts/GL\ Mapper/Purchase\ Invoice/Payable\ Voucher.txt erpnext/accounts/GL\ Mapper/Purchase\ Invoice/Purchase\ Invoice.txt')
os.system('git mv erpnext/accounts/GL\ Mapper/Receivable\ Voucher erpnext/accounts/GL\ Mapper/Sales\ Invoice')
os.system('git mv erpnext/accounts/GL\ Mapper/Sales\ Invoice/Receivable\ Voucher.txt erpnext/accounts/GL\ Mapper/Sales\ Invoice/Sales\ Invoice.txt')
# git rm production dt mapper
os.system('git rm -r erpnext/production/DocType\ Mapper/')
def update_file_content(rendt):
for d in rendt:
print colored('Renaming... ' + d + ' --> '+ rendt[d], 'yellow')
for extn in ['js', 'py', 'txt', 'html']:
res = replace_code('/var/www/erpnext/', d, rendt[d], extn)
if res == 'skip':
break
def rename_dt_files(rendt):
for d in rendt:
mod = webnotes.conn.sql("select module from tabDocType where name = %s", rendt[d])[0][0]
if mod == 'Core':
os.chdir('/var/www/erpnext/lib/')
path = 'py/core/doctype/'
else:
os.chdir('/var/www/erpnext/')
path = 'erpnext/' + '_'.join(mod.lower().split()) + '/doctype/'
old = '_'.join(d.lower().split())
new = '_'.join(rendt[d].lower().split())
print 'git mv ' + path + old + ' ' + path + new
# rename old dir
os.system('git mv ' + path + old + ' ' + path + new)
# rename all files in that dir
for extn in ['js', 'py', 'txt', 'html']:
if os.path.exists(path + new + '/'+ old + '.' +extn):
os.system('git mv ' + path + new + '/'+ old + '.' +extn + ' ' + path + new + '/' + new + '.' +extn)
print 'git mv ' + path + new + '/'+ old + '.' +extn + ' ' + path + new + '/' + new + '.' +extn
def rename_mapper_files(ren_mapper):
for d in ren_mapper:
# module
mod = '_'.join(webnotes.conn.sql("select module from `tabDocType Mapper` where name = %s", ren_mapper[d])[0][0].lower().split())
path = 'erpnext/' + mod + '/DocType Mapper/'
# rename old dir
esc = make_esc('$ ')
os.system('git mv ' + esc(path + d) + ' ' + esc(path + ren_mapper[d]))
print 'git mv ' + esc(path + d) + ' ' + esc(path + ren_mapper[d])
os.system('git mv ' + esc(path + ren_mapper[d] + '/'+ d + '.txt')
+ ' ' + esc(path + ren_mapper[d] + '/' + ren_mapper[d] + '.txt'))
print 'git mv ' + esc(path + ren_mapper[d] + '/'+ d + '.txt') + ' ' + esc(path + ren_mapper[d] + '/' + ren_mapper[d] + '.txt')
def replace_labels_with_fieldnames():
"""
This is used for replacing instances like cur_frm.cscript['LABEL'] with
cur_frm.cscript.FIELDNAME in js files
"""
doctype = {}
doctype.update(prepare_dict_of_label_fieldname('/var/www/erpnext/erpnext/'))
doctype.update(prepare_dict_of_label_fieldname('/var/www/erpnext/lib/py'))
#print doctype
for doc in doctype:
label_fieldname = doctype[doc]
for d in label_fieldname:
#label = "cur_frm.cscript['%s']" % d
#fieldname = "cur_frm.cscript.%s" % label_fieldname[d]
label = d
fieldname = label_fieldname[d]
print colored('Changing... ' + doc + ': ' + label + ' --> '+ fieldname, 'yellow')
#res = replace_code('/var/www/erpnext/', label, fieldname, 'js')
res = replace_code('/var/www/erpnext/', label, fieldname, 'js',
'hide_field\(.*%s' % label)
if res == 'skip':
break
def prepare_dict_of_label_fieldname(module_path):
from webnotes.model.utils import peval_doclist
from webnotes.model.sync import get_file_path
doctype = {}
for path, folders, files in os.walk(module_path):
if path == module_path:
modules_list = folders
for f in files:
if f.endswith(".txt"):
rel_path = os.path.relpath(path, conf.modules_path)
path_tuple = rel_path.split(os.sep)
if (len(path_tuple)==3 and path_tuple[0] in modules_list and
path_tuple[1] == 'doctype'):
file_name = f[:-4]
with open(get_file_path(path_tuple[0], file_name), 'r') as fn:
doclist = peval_doclist(fn.read())
doctype[file_name] = dict(([d.get('label'),d.get('fieldname')] \
for d in doclist if d.get('doctype')=='DocField'))
return doctype

View File

@@ -0,0 +1,35 @@
# 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
opts = webnotes.conn.sql("""\
SELECT options FROM `tabDocField`
WHERE parent='Serial No' AND fieldname='status' AND
fieldtype='Select'""")
if opts and opts[0][0]:
opt_list = opts[0][0].split("\n")
if not "Purchase Returned" in opt_list:
webnotes.conn.sql("""
UPDATE `tabDocField` SET options=%s
WHERE parent='Serial No' AND fieldname='status' AND
fieldtype='Select'""", "\n".join(opt_list + ["Purchase Returned"]))
webnotes.conn.commit()
webnotes.conn.begin()
from webnotes.modules import reload_doc
reload_doc('stock', 'doctype', 'serial_no')

View File

@@ -0,0 +1,55 @@
# 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.modules import reload_doc
def execute():
"""
* Reload Sales Taxes and Charges
* Reload Support Ticket
* Run Install Print Format Patch
* Reload Customize Form
"""
reload_doc('accounts', 'doctype', 'rv_tax_detail')
reload_doc('support', 'doctype', 'support_ticket')
reload_print_formats()
reload_doc('core', 'doctype', 'doclayer')
def reload_print_formats():
"""
Reloads the following print formats:
* Sales Invoice Classic/Modern/Spartan
* Sales Order Classic/Modern/Spartan
* Delivery Note Classic/Modern/Spartan
* Quotation Classic/Modern/Spartan
"""
reload_doc('accounts', 'Print Format', 'Sales Invoice Classic')
reload_doc('accounts', 'Print Format', 'Sales Invoice Modern')
reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan')
reload_doc('selling', 'Print Format', 'Sales Order Classic')
reload_doc('selling', 'Print Format', 'Sales Order Modern')
reload_doc('selling', 'Print Format', 'Sales Order Spartan')
reload_doc('selling', 'Print Format', 'Quotation Classic')
reload_doc('selling', 'Print Format', 'Quotation Modern')
reload_doc('selling', 'Print Format', 'Quotation Spartan')
reload_doc('stock', 'Print Format', 'Delivery Note Classic')
reload_doc('stock', 'Print Format', 'Delivery Note Modern')
reload_doc('stock', 'Print Format', 'Delivery Note Spartan')

View File

@@ -0,0 +1,7 @@
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.modules import reload_doc
reload_doc('stock', 'doctype', 'stock_entry')
webnotes.conn.sql("update `tabDocField` set options = concat(options, '\nOthers') where fieldname = 'purpose' and parent = 'Stock Entry'")

View File

@@ -0,0 +1,24 @@
# 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
webnotes.conn.sql("""
update `tabDocField` set `default` = 'No'
where parent in ('Purchase Order', 'Purchase Receipt')
and fieldname = 'is_subcontracted'
""")

View File

@@ -0,0 +1,54 @@
from __future__ import unicode_literals
import webnotes
sql = webnotes.conn.sql
from webnotes.model import delete_doc
def execute():
del_rec = {
'DocType' : ['Update Series', 'File', 'File Browser Control', 'File Group',
'Tag Detail', 'DocType Property Setter', 'Company Group', 'Widget Control',
'Update Delivery Date Detail', 'Update Delivery Date',
'Tag Detail', 'Supplier rating', 'Stylesheet', 'Question Tag',
'PRO PP Detail', 'PRO Detail', 'PPW Detail', 'PF Detail',
'Personalize', 'Patch Util', 'Page Template', 'Module Def Role',
'Module Def Item', 'File Group', 'File Browser Control', 'File',
'Educational Qualifications', 'Earn Deduction Detail',
'DocType Property Setter', 'Contact Detail', 'BOM Report Detail',
'BOM Replace Utility Detail', 'BOM Replace Utility',
'Absent Days Detail', 'Activity Dashboard Control', 'Raw Materials Supplied',
'Setup Wizard Control', 'Company Group', 'Lease Agreement', 'Lease Installment',
'Terms and Conditions', 'Time Sheet', 'Time Sheet Detail', 'Naming Series Options',
'Invest 80 Declaration Detail', 'IT Checklist', 'Chapter VI A Detail', 'Declaration Detail',
'Personalize', 'Salary Slip Control Panel', 'Question Control'
],
'Page' : ['File Browser', 'Bill of Materials', 'question-view'],
'DocType Mapper': ['Production Forecast-Production Planning Tool', 'Production Forecast-Production Plan', 'Sales Order-Production Plan'],
}
for d in del_rec:
for r in del_rec[d]:
print 'Deleted', d, ' - ', r
if d=='DocType':
sql("delete from tabFeed where doc_type=%s", r)
delete_doc(d, r)
sql("delete from tabDocField where label='Repair Purchase Request' and parent = 'Purchase Request'")
drop_tables()
def drop_tables():
webnotes.conn.commit()
from webnotes.model.db_schema import remove_all_foreign_keys
remove_all_foreign_keys()
count = 0
tab_list = sql("SHOW TABLES")
for tab in tab_list:
if tab[0].startswith('_') or tab[0] in ('tabSingles', 'tabSessions', 'tabSeries'): continue
res = sql("SELECT COUNT(*) FROM `tabDocType` WHERE name = %s", tab[0][3:])
if not res[0][0]:
count += 1
print tab[0]
sql("DROP TABLE `%s`" % tab[0])
print count
webnotes.conn.begin()

View File

@@ -0,0 +1,4 @@
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("update `tabDocField` set options = replace(options, 'Others', 'Other') where fieldname = 'purpose' and parent = 'Stock Entry'")

View File

@@ -0,0 +1,7 @@
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("update `tabDocField` set options = 'BOM' where fieldname = 'bom_no' and parent = 'Stock Entry'")
from webnotes.modules import reload_doc
reload_doc('stock', 'doctype', 'stock_entry')

View File

@@ -0,0 +1,4 @@
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("update `tabDocPerm` set cancel = 1 where parent = 'Stock Reconciliation' and ifnull(submit, 0) = 1")

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)