mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-20 21:49:18 +00:00
moved directory structure
This commit is contained in:
1
patches/september_2012/__init__.py
Normal file
1
patches/september_2012/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
||||
11
patches/september_2012/add_stock_ledger_entry_index.py
Normal file
11
patches/september_2012/add_stock_ledger_entry_index.py
Normal 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()
|
||||
|
||||
24
patches/september_2012/all_permissions_patch.py
Normal file
24
patches/september_2012/all_permissions_patch.py
Normal 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'""")
|
||||
22
patches/september_2012/communication_delete_permission.py
Normal file
22
patches/september_2012/communication_delete_permission.py
Normal 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)
|
||||
29
patches/september_2012/customer_permission_patch.py
Normal file
29
patches/september_2012/customer_permission_patch.py
Normal 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)
|
||||
40
patches/september_2012/plot_patch.py
Normal file
40
patches/september_2012/plot_patch.py
Normal 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);
|
||||
8
patches/september_2012/reload_criteria_stock_ledger.py
Normal file
8
patches/september_2012/reload_criteria_stock_ledger.py
Normal 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")
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user