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,12 @@
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("""\
delete from `tabDocPerm`
where parent in ('Address', 'Contact')""")
webnotes.conn.commit()
import webnotes.model.sync
webnotes.model.sync.sync('utilities', 'address')
webnotes.model.sync.sync('utilities', 'contact')
webnotes.conn.begin()

View File

@@ -0,0 +1,14 @@
from __future__ import unicode_literals
import webnotes
def execute():
webnotes.conn.commit()
from webnotes.install_lib.install import Installer
Installer(None, None).create_auth_table()
webnotes.conn.begin()
for user, password in webnotes.conn.sql("""select name, password from tabProfile"""):
if password:
webnotes.conn.sql("""insert into __Auth (user, `password`) values (%s, %s)""",
(user, password))

View File

@@ -0,0 +1,4 @@
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("update `tabDocPerm` set permlevel = 0 where parent = 'Bin'")

View File

@@ -0,0 +1,12 @@
from __future__ import unicode_literals
def execute():
"""allocate read write permission to guest for doctype 'Blog'"""
import webnotes
webnotes.conn.sql("""delete from `tabDocPerm` where parent = 'Blog'""")
webnotes.conn.commit()
import webnotes.model.sync
webnotes.model.sync.sync('website', 'blog', 1)
webnotes.conn.begin()

View File

@@ -0,0 +1,10 @@
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("""update tabAccount set freeze_account='No' where freeze_account is null""")
webnotes.conn.sql("""update `tabPurchase Taxes and Charges`
set category='Valuation and Total' where category='For Both'""")
webnotes.conn.sql("""update `tabPurchase Taxes and Charges`
set category='Valuation' where category='For Valuation'""")
webnotes.conn.sql("""update `tabPurchase Taxes and Charges`
set category='Total' where category='For Total'""")

View File

@@ -0,0 +1,8 @@
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.model import delete_doc
delete_doc('DocType', 'Bulk Rename Tool')
webnotes.conn.commit()
webnotes.conn.sql("drop table `tabBulk Rename Tool`")
webnotes.conn.begin()

View File

@@ -0,0 +1,11 @@
from __future__ import unicode_literals
def execute():
"""
deprecate:
* doctype - import data control
* page - import data (old)
"""
import webnotes
from webnotes.model import delete_doc
delete_doc('DocType', 'Import Data Control')
delete_doc('Page', 'Import Data')

View File

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

View File

@@ -0,0 +1,19 @@
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("""update `tabPurchase Order Item` t1, `tabPurchase Order` t2
set t1.project_name = t2.project_name where t1.parent = t2.name
and ifnull(t1.project_name, '') = ''""")
webnotes.conn.sql("""update `tabPurchase Invoice Item` t1, `tabPurchase Invoice` t2
set t1.project_name = t2.project_name where t1.parent = t2.name
and ifnull(t1.project_name, '') = ''""")
webnotes.conn.sql("""update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2
set t1.project_name = t2.project_name where t1.parent = t2.name
and ifnull(t1.project_name, '') = ''""")
webnotes.conn.commit()
from webnotes.model.sync import sync
sync("buying", "purchase_order")
sync("buying", "purchase_request")
sync("accounts", "purchase_invoice")
webnotes.conn.begin()

View File

@@ -0,0 +1,5 @@
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.modules import reload_doc
reload_doc('buying', 'DocType Mapper', 'Purchase Request-Purchase Order')

View File

@@ -0,0 +1,6 @@
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("""\
update `tabDocPerm` set `match`=NULL
where parent='Event' and role='All' and permlevel=0""")

View File

@@ -0,0 +1,95 @@
from __future__ import unicode_literals
import webnotes
def execute():
# add index
webnotes.conn.commit()
try:
webnotes.conn.sql("""create index item_code_warehouse
on `tabDelivery Note Packing Item` (item_code, warehouse)""")
except:
pass
webnotes.conn.begin()
webnotes.conn.auto_commit_on_many_writes = 1
repost_reserved_qty()
cleanup_wrong_sle()
webnotes.conn.auto_commit_on_many_writes = 0
def repost_reserved_qty():
from webnotes.utils import flt
bins = webnotes.conn.sql("select item_code, warehouse, name, reserved_qty from `tabBin`")
i = 0
for d in bins:
i += 1
print i
reserved_qty = webnotes.conn.sql("""
select sum((dnpi_qty / so_item_qty) * (so_item_qty - so_item_delivered_qty))
from (select
qty as dnpi_qty,
(
select qty from `tabSales Order Item`
where name = dnpi.parent_detail_docname
) as so_item_qty,
(
select ifnull(delivered_qty, 0) from `tabSales Order Item`
where name = dnpi.parent_detail_docname
) as so_item_delivered_qty
from
(
select qty, parent_detail_docname
from `tabDelivery Note Packing Item` dnpi_in
where item_code = %s and warehouse = %s
and parenttype="Sales Order"
and exists (select * from `tabSales Order` so
where name = dnpi_in.parent and docstatus = 1 and status != 'Stopped')
) dnpi) tab
where so_item_qty >= so_item_delivered_qty""", (d[0], d[1]))
if flt(d[3]) != flt(reserved_qty[0][0]):
print d[3], reserved_qty[0][0]
webnotes.conn.sql("""
update `tabBin` set reserved_qty = %s where name = %s
""", (reserved_qty and reserved_qty[0][0] or 0, d[2]))
def cleanup_wrong_sle():
sle = webnotes.conn.sql("""
select item_code, warehouse, voucher_no, name
from `tabStock Ledger Entry` sle
where voucher_type = 'Delivery Note'
and not exists(
select name from `tabDelivery Note Packing Item`
where item_code = sle.item_code
and qty = abs(sle.actual_qty)
and parent = sle.voucher_no
) and not exists (
select name from `tabDelivery Note Item`
where item_code = sle.item_code
and qty = abs(sle.actual_qty)
and parent = sle.voucher_no
)
""")
if sle:
print sle
for d in sle:
webnotes.conn.sql("update `tabStock Ledger Entry` set is_cancelled = 'Yes' where name = %s", d[3])
create_comment(d[3])
repost_bin(d[0], d[1])
def create_comment(dn):
from webnotes.model.doc import Document
cmt = Document('Comment')
cmt.comment = 'Cancelled by administrator due to wrong entry in packing list'
cmt.comment_by = 'Administrator'
cmt.comment_by_fullname = 'Administrator'
cmt.comment_doctype = 'Stock Ledger Entry'
cmt.comment_docname = dn
cmt.save(1)
def repost_bin(item, wh):
from webnotes.model.code import get_obj
bin = webnotes.conn.sql("select name from `tabBin` \
where item_code = %s and warehouse = %s", (item, wh))
get_obj('Bin', bin[0][0]).update_entries_after(posting_date = '2012-07-01', posting_time = '12:05')

View File

@@ -0,0 +1,15 @@
from __future__ import unicode_literals
def execute():
"""sync supplier quotatoin and create supplier quotation mappers"""
from webnotes.model.sync import sync
sync('buying', 'supplier_quotation')
sync('buying', 'supplier_quotation_item')
sync('buying', 'purchase_request')
sync('buying', 'purchase_request_item')
sync('buying', 'purchase_order')
sync('buying', 'purchase_order_item')
from webnotes.modules import reload_doc
reload_doc('buying', 'DocType Mapper', 'Purchase Request-Supplier Quotation')
reload_doc('buying', 'DocType Mapper', 'Supplier Quotation-Purchase Order')

View File

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

View File

@@ -0,0 +1,6 @@
from __future__ import unicode_literals
def execute():
"""appends from __future__ import unicode_literals to py files if necessary"""
import wnf
wnf.append_future_import()

View File

@@ -0,0 +1,9 @@
from __future__ import unicode_literals
def execute():
import webnotes
webnotes.conn.sql("""update `tabPurchase Taxes and Charges`
set category='Valuation and Total' where category='For Both'""")
webnotes.conn.sql("""update `tabPurchase Taxes and Charges`
set category='Valuation' where category='For Valuation'""")
webnotes.conn.sql("""update `tabPurchase Taxes and Charges`
set category='Total' where category='For Total'""")