mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
moved directory structure
This commit is contained in:
1
patches/july_2012/__init__.py
Normal file
1
patches/july_2012/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
||||
12
patches/july_2012/address_contact_perms.py
Normal file
12
patches/july_2012/address_contact_perms.py
Normal 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()
|
||||
14
patches/july_2012/auth_table.py
Normal file
14
patches/july_2012/auth_table.py
Normal 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))
|
||||
4
patches/july_2012/bin_permission.py
Normal file
4
patches/july_2012/bin_permission.py
Normal 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'")
|
||||
12
patches/july_2012/blog_guest_permission.py
Normal file
12
patches/july_2012/blog_guest_permission.py
Normal 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()
|
||||
10
patches/july_2012/default_freeze_account.py
Normal file
10
patches/july_2012/default_freeze_account.py
Normal 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'""")
|
||||
8
patches/july_2012/deprecate_bulk_rename.py
Normal file
8
patches/july_2012/deprecate_bulk_rename.py
Normal 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()
|
||||
11
patches/july_2012/deprecate_import_data_control.py
Normal file
11
patches/july_2012/deprecate_import_data_control.py
Normal 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')
|
||||
45
patches/july_2012/packing_list_cleanup_and_serial_no.py
Normal file
45
patches/july_2012/packing_list_cleanup_and_serial_no.py
Normal 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'])
|
||||
19
patches/july_2012/project_patch_repeat.py
Normal file
19
patches/july_2012/project_patch_repeat.py
Normal 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()
|
||||
5
patches/july_2012/reload_pr_po_mapper.py
Normal file
5
patches/july_2012/reload_pr_po_mapper.py
Normal 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')
|
||||
6
patches/july_2012/remove_event_role_owner_match.py
Normal file
6
patches/july_2012/remove_event_role_owner_match.py
Normal 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""")
|
||||
95
patches/july_2012/repost_stock_due_to_wrong_packing_list.py
Normal file
95
patches/july_2012/repost_stock_due_to_wrong_packing_list.py
Normal 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')
|
||||
15
patches/july_2012/supplier_quotation.py
Normal file
15
patches/july_2012/supplier_quotation.py
Normal 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')
|
||||
|
||||
5
patches/july_2012/sync_trial_balance.py
Normal file
5
patches/july_2012/sync_trial_balance.py
Normal 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')
|
||||
6
patches/july_2012/unicode_conf.py
Normal file
6
patches/july_2012/unicode_conf.py
Normal 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()
|
||||
9
patches/july_2012/update_purchase_tax.py
Normal file
9
patches/july_2012/update_purchase_tax.py
Normal 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'""")
|
||||
Reference in New Issue
Block a user