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,11 @@
import webnotes
def execute():
webnotes.conn.commit()
try:
webnotes.conn.sql("""alter table `tabStock Ledger Entry` add index posting_sort_index(posting_date, posting_time, name)""")
webnotes.conn.commit()
except Exception, e:
if e.args[0]!=1061: raise e
webnotes.conn.begin()

View File

@@ -0,0 +1,24 @@
from __future__ import unicode_literals
import webnotes
def execute():
web_cache_perms()
stock_perms()
project_perms()
account_perms()
def web_cache_perms():
webnotes.conn.sql("""update `tabDocPerm`
set role='Guest' where parent='Web Cache' and role='All' and permlevel=0""")
def project_perms():
webnotes.conn.sql("""delete from `tabDocPerm`
where parent in ('Task', 'Project Activity') and role='All'""")
def stock_perms():
webnotes.conn.sql("""delete from `tabDocPerm`
where parent in ('Landed Cost Master', 'Landed Cost Wizard',
'Sales and Purchase Return Tool') and role='All' and permlevel=0""")
def account_perms():
# since it is a child doctype, it does not need permissions
webnotes.conn.sql("""delete from tabDocPerm where parent='TDS Detail'""")

View File

@@ -0,0 +1,22 @@
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.model.doc import addchild
from webnotes.model.code import get_obj
existing = webnotes.conn.sql("""select role, name from `tabDocPerm`
where permlevel=0 and parent='Communication'""")
for role in ("Support Manager", "System Manager"):
if role not in map(lambda x: x[0], existing):
doctype_obj = get_obj("DocType", "Communication", with_children=1)
ch = addchild(doctype_obj.doc, "permissions", "DocPerm")
ch.permlevel = 0
ch.role = role
ch.read = 1
ch.write = 1
ch.create = 1
ch.cancel = 1
ch.save()
else:
webnotes.conn.set_value("DocPerm", dict(existing).get(role), "cancel", 1)

View File

@@ -0,0 +1,29 @@
from __future__ import unicode_literals
def execute():
from webnotes.model.doc import Document
perms = []
# create permissions for permlevel 2 assigned to "Credit Days" and "Credit Limit"
# 2 Accounts Manager r,w
# 2 System Manager r,w
perms.append([2, "Accounts Manager", 1, 1, 0, 0])
perms.append([2, "System Manager", 1, 1, 0, 0])
perms.append([2, "All", 1, 0, 0, 0])
# read, write, create, cancel perm for Accounts Manager for permlevel 0
perms.append([0, "Accounts Manager", 1, 1, 1, 1])
# permlevel 1 read permission for 'All'
# 1 All r
perms.append([1, "All", 1, 0, 0, 0])
for p in perms:
d = Document("DocPerm", fielddata={
"parent": "Customer",
"parentfield": "permissions",
"permlevel": p[0],
"role": p[1],
"read": p[2],
"write": p[3],
"create": p[4],
"cancel": p[5]
}).save(1)

View File

@@ -0,0 +1,40 @@
import webnotes
def execute():
set_master_name_in_accounts()
set_customer_in_sales_invoices()
reset_lft_rgt()
add_analytics_role()
def set_master_name_in_accounts():
accounts = webnotes.conn.sql("""select name, account_name, master_type from tabAccount
where ifnull(master_name, '')=''""", as_dict=1)
for acc in accounts:
if acc["master_type"] in ["Customer", "Supplier"]:
master = webnotes.conn.sql("""select name from `tab%s`
where name=%s """ % (acc["master_type"], "%s"), acc["account_name"])
if master:
webnotes.conn.sql("""update `tabAccount`
set master_name=%s where name=%s""", (master[0][0], acc["name"]))
def set_customer_in_sales_invoices():
webnotes.conn.sql("""update `tabSales Invoice` si
set si.customer=(select a.master_name from `tabAccount` a where a.name=si.debit_to)
where ifnull(si.customer, '')=''""")
def reset_lft_rgt():
from webnotes.utils.nestedset import rebuild_tree
rebuild_tree("Item Group", "parent_item_group")
rebuild_tree("Customer Group", "parent_customer_group")
rebuild_tree("Territory", "parent_territory")
rebuild_tree("Account", "parent_account")
rebuild_tree("Cost Center", "parent_cost_center")
rebuild_tree("Sales Person", "parent_sales_person")
def add_analytics_role():
from webnotes.model.doc import Document
Document("Role", fielddata={
"name": "Analytics",
"role_name": "Analytics",
"module": "Setup",
}).save(1);

View File

@@ -0,0 +1,8 @@
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.modules import reload_doc
reload_doc('stock', 'Search Criteria', 'Stock Ledger')
from webnotes.model import delete_doc
delete_doc("Report", "Stock Ledger")

View File

@@ -0,0 +1,18 @@
from __future__ import unicode_literals
def execute():
import webnotes
from webnotes.model.doc import addchild
from webnotes.model.code import get_obj
for parent in ("Stock Ledger Entry", "Bin"):
existing = webnotes.conn.sql("""select role from `tabDocPerm`
where permlevel=0 and parent=%s""", (parent,))
if "Accounts Manager" not in map(lambda x: x[0], existing):
doctype_obj = get_obj("DocType", parent, with_children=1)
ch = addchild(doctype_obj.doc, "permissions", "DocPerm")
ch.permlevel = 0
ch.role = "Accounts Manager"
ch.read = 1
ch.save()