本文整理汇总了Python中webnotes.delete_doc函数的典型用法代码示例。如果您正苦于以下问题:Python delete_doc函数的具体用法?Python delete_doc怎么用?Python delete_doc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete_doc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: execute
def execute():
base_path = webnotes.utils.get_base_path()
# Remove symlinks from public folder:
# - server.py
# - web.py
# - unsupported.html
# - blank.html
# - rss.xml
# - sitemap.xml
for file in ("server.py", "web.py", "unsupported.html", "blank.html", "rss.xml", "sitemap.xml"):
file_path = os.path.join(base_path, "public", file)
if os.path.exists(file_path):
os.remove(file_path)
# Remove wn-web files
# - js/wn-web.js
# - css/wn-web.css
for file_path in (("js", "wn-web.js"), ("css", "wn-web.css")):
file_path = os.path.join(base_path, "public", *file_path)
if os.path.exists(file_path):
os.remove(file_path)
# Remove update app page
webnotes.delete_doc("Page", "update-manager")
开发者ID:Anirudh887,项目名称:erpnext,代码行数:25,代码来源:p04_wsgi_migration.py
示例2: execute
def execute():
webnotes.reload_doc("utilities", "doctype", "note")
webnotes.reload_doc("utilities", "doctype", "note_user")
for question in webnotes.conn.sql("""select * from tabQuestion""", as_dict=True):
if question.question:
try:
name = question.question[:180]
if webnotes.conn.exists("Note", name):
webnotes.delete_doc("Note", name)
similar_questions = webnotes.conn.sql_list("""select name from `tabQuestion`
where question like %s""", "%s%%" % name)
answers = [markdown2.markdown(c) for c in webnotes.conn.sql_list("""
select answer from tabAnswer where question in (%s)""" % \
", ".join(["%s"]*len(similar_questions)), similar_questions)]
webnotes.bean({
"doctype":"Note",
"title": name,
"content": "<hr>".join(answers),
"owner": question.owner,
"creation": question.creation,
"public": 1
}).insert()
except NameError:
pass
except Exception, e:
if e.args[0] != 1062:
raise
开发者ID:aalishanmatrix,项目名称:erpnext,代码行数:31,代码来源:p06_make_notes.py
示例3: execute
def execute():
webnotes.reload_doc("core", "doctype", "doctype")
tables = webnotes.conn.sql_list("show tables")
if not "tabMaterial Request Item" in tables:
webnotes.rename_doc("DocType", "Purchase Request Item", "Material Request Item", force=True)
if not "tabMaterial Request" in tables:
webnotes.rename_doc("DocType", "Purchase Request", "Material Request", force=True)
webnotes.reload_doc("buying", "search_criteria", "pending_po_items_to_bill")
webnotes.reload_doc("buying", "search_criteria", "pending_po_items_to_receive")
webnotes.reload_doc("stock", "doctype", "material_request")
webnotes.reload_doc("stock", "doctype", "material_request_item")
webnotes.conn.sql("""update `tabMaterial Request` set material_request_type='Purchase'""")
os.system("rm -rf app/buying/doctype/purchase_request")
os.system("rm -rf app/buying/doctype/purchase_request_item")
os.system("rm -rf app/hr/doctype/holiday_block_list")
os.system("rm -rf app/hr/doctype/holiday_block_list_allow")
os.system("rm -rf app/hr/doctype/holiday_block_list_date")
for dt in ("Purchase Request", "Purchase Request Item"):
if webnotes.conn.exists("DocType", dt):
webnotes.delete_doc("DocType", dt)
开发者ID:bindscha,项目名称:erpnext-fork,代码行数:26,代码来源:p03_material_request.py
示例4: rename_doc
def rename_doc(doctype, old, new, force=False, merge=False):
"""
Renames a doc(dt, old) to doc(dt, new) and
updates all linked fields of type "Link" or "Select" with "link:"
"""
if not webnotes.conn.exists(doctype, old):
return
# get doclist of given doctype
doclist = webnotes.model.doctype.get(doctype)
validate_rename(doctype, new, doclist, merge, force)
# call on_rename
obj = webnotes.get_obj(doctype, old)
if hasattr(obj, 'on_rename'):
new = obj.on_rename(new, old) or new
if not merge:
rename_parent_and_child(doctype, old, new, doclist)
# update link fields' values
link_fields = get_link_fields(doctype)
update_link_field_values(link_fields, old, new)
if doctype=='DocType':
rename_doctype(doctype, old, new, force)
if merge:
webnotes.delete_doc(doctype, old)
return new
开发者ID:gangadhar-kadam,项目名称:wnframework,代码行数:32,代码来源:rename_doc.py
示例5: execute
def execute():
for sc in ["itemwise_price_list", "itemwise_receipt_details",
"shortage_to_purchase_request", "stock_aging_report",
"stock_ledger", "stock_level", "stock_report",
"custom_test2", "custom_test3", "custom_test4",
"test_so2", "test_so3"]:
webnotes.delete_doc("Search Criteria", sc)
开发者ID:BillTheBest,项目名称:erpnext,代码行数:7,代码来源:deprecate_stock_search_criteria.py
示例6: cleanup_sitemap
def cleanup_sitemap():
"""remove sitemap records where its config do not exist anymore"""
to_delete = webnotes.conn.sql_list("""select name from `tabWebsite Sitemap` ws
where not exists(select name from `tabWebsite Sitemap Config` wsc
where wsc.name=ws.website_sitemap_config)""")
webnotes.delete_doc("Website Sitemap", to_delete, ignore_permissions=True)
开发者ID:bindscha,项目名称:wnframework_old,代码行数:7,代码来源:website_sitemap.py
示例7: on_trash
def on_trash(self):
# delete bin
bins = webnotes.conn.sql("select * from `tabBin` where warehouse = %s", self.doc.name, as_dict=1)
for d in bins:
if (
d["actual_qty"]
or d["reserved_qty"]
or d["ordered_qty"]
or d["indented_qty"]
or d["projected_qty"]
or d["planned_qty"]
):
msgprint(
"""Warehouse: %s can not be deleted as qty exists for item: %s""" % (self.doc.name, d["item_code"]),
raise_exception=1,
)
else:
webnotes.conn.sql("delete from `tabBin` where name = %s", d["name"])
warehouse_account = webnotes.conn.get_value(
"Account", {"account_type": "Warehouse", "master_name": self.doc.name}
)
if warehouse_account:
webnotes.delete_doc("Account", warehouse_account)
if webnotes.conn.sql(
"""select name from `tabStock Ledger Entry`
where warehouse = %s""",
self.doc.name,
):
msgprint(
"""Warehouse can not be deleted as stock ledger entry
exists for this warehouse.""",
raise_exception=1,
)
开发者ID:jzmq,项目名称:erpnext,代码行数:35,代码来源:warehouse.py
示例8: update_cart
def update_cart(item_code, qty, with_doclist=0):
quotation = _get_cart_quotation()
qty = flt(qty)
if qty == 0:
quotation.set_doclist(quotation.doclist.get({"item_code": ["!=", item_code]}))
if not quotation.doclist.get({"parentfield": "quotation_details"}) and not quotation.doc.fields.get(
"__islocal"
):
quotation.__delete = True
else:
quotation_items = quotation.doclist.get({"item_code": item_code})
if not quotation_items:
quotation.doclist.append(
{"doctype": "Quotation Item", "parentfield": "quotation_details", "item_code": item_code, "qty": qty}
)
else:
quotation_items[0].qty = qty
apply_cart_settings(quotation=quotation)
if hasattr(quotation, "__delete"):
webnotes.delete_doc("Quotation", quotation.doc.name, ignore_permissions=True)
quotation = _get_cart_quotation()
else:
quotation.ignore_permissions = True
quotation.save()
set_cart_count(quotation)
if with_doclist:
return get_cart_quotation(quotation.doclist)
else:
return quotation.doc.name
开发者ID:nivawebs,项目名称:erpnext,代码行数:35,代码来源:cart.py
示例9: make_demo_user
def make_demo_user():
if webnotes.conn.exists("Profile", "[email protected]"):
webnotes.delete_doc("Profile", "[email protected]")
p = webnotes.new_bean("Profile")
p.doc.email = "[email protected]"
p.doc.first_name = "Demo"
p.doc.last_name = "User"
p.doc.enabled = 1
p.doc.user_type = "ERPNext Demo"
p.doc.send_invite_email = 0
p.doc.new_password = "demo"
p.insert()
for role in ("Accounts Manager", "Analytics", "Expense Approver", "Accounts User",
"Leave Approver", "Blogger", "Customer", "Sales Manager", "Employee", "Support Manager",
"HR Manager", "HR User", "Maintenance Manager", "Maintenance User", "Material Manager",
"Material Master Manager", "Material User", "Partner", "Manufacturing Manager",
"Manufacturing User", "Projects User", "Purchase Manager", "Purchase Master Manager",
"Purchase User", "Quality Manager", "Report Manager", "Sales Master Manager", "Sales User",
"Supplier", "Support Team"):
p.doclist.append({
"doctype": "UserRole",
"parentfield": "user_roles",
"role": role
})
p.save()
# only read for newsletter
webnotes.conn.sql("""update `tabDocPerm` set `write`=0, `create`=0, `cancel`=0
where parent='Newsletter'""")
webnotes.conn.commit()
开发者ID:imjk768646z,项目名称:erpnext,代码行数:34,代码来源:make_erpnext_demo.py
示例10: import_doclist
def import_doclist(doclist):
doctype = doclist[0]["doctype"]
name = doclist[0]["name"]
old_doc = None
doctypes = set([d["doctype"] for d in doclist])
ignore = list(doctypes.intersection(set(ignore_doctypes)))
if doctype in ignore_values:
if webnotes.conn.exists(doctype, name):
old_doc = webnotes.doc(doctype, name)
# delete old
webnotes.delete_doc(doctype, name, force=1, ignore_doctypes=ignore, for_reload=True)
# don't overwrite ignored docs
doclist1 = remove_ignored_docs_if_they_already_exist(doclist, ignore, name)
# update old values (if not to be overwritten)
if doctype in ignore_values and old_doc:
update_original_values(doclist1, doctype, old_doc)
# reload_new
new_bean = webnotes.bean(doclist1)
new_bean.ignore_children_type = ignore
new_bean.ignore_links = True
new_bean.ignore_validate = True
new_bean.ignore_permissions = True
new_bean.ignore_mandatory = True
if doctype=="DocType" and name in ["DocField", "DocType"]:
new_bean.ignore_fields = True
new_bean.insert()
开发者ID:ricardomomm,项目名称:wnframework,代码行数:34,代码来源:import_file.py
示例11: execute
def execute():
import webnotes
try:
for mapper in webnotes.conn.sql("""select name from `tabGL Mapper`"""):
webnotes.delete_doc("GL Mapper", mapper[0])
except Exception, e:
pass
开发者ID:Anirudh887,项目名称:erpnext,代码行数:7,代码来源:remove_gl_mapper.py
示例12: rename_module
def rename_module():
webnotes.reload_doc("core", "doctype", "role")
webnotes.reload_doc("core", "doctype", "page")
webnotes.reload_doc("core", "doctype", "module_def")
if webnotes.conn.exists("Role", "Production User"):
webnotes.rename_doc("Role", "Production User", "Manufacturing User")
if webnotes.conn.exists("Role", "Production Manager"):
webnotes.rename_doc("Role", "Production Manager", "Manufacturing Manager")
if webnotes.conn.exists("Page", "manufacturing-home"):
webnotes.delete_doc("Page", "production-home")
else:
webnotes.rename_doc("Page", "production-home", "manufacturing-home")
if webnotes.conn.exists("Module Def", "Production"):
webnotes.rename_doc("Module Def", "Production", "Manufacturing")
modules_list = webnotes.conn.get_global('modules_list')
if modules_list:
webnotes.conn.set_global("modules_list", modules_list.replace("Production",
"Manufacturing"))
# set end of life to null if "0000-00-00"
webnotes.conn.sql("""update `tabItem` set end_of_life=null where end_of_life='0000-00-00'""")
开发者ID:BillTheBest,项目名称:erpnext,代码行数:25,代码来源:production_cleanup.py
示例13: build_website_sitemap_config
def build_website_sitemap_config():
config = {"pages": {}, "generators":{}}
basepath = webnotes.utils.get_base_path()
existing_configs = dict(webnotes.conn.sql("""select name, lastmod from `tabWebsite Sitemap Config`"""))
for path, folders, files in os.walk(basepath, followlinks=True):
for ignore in ('locale', 'public'):
if ignore in folders:
folders.remove(ignore)
if os.path.basename(path)=="pages" and os.path.basename(os.path.dirname(path))=="templates":
for fname in files:
fname = webnotes.utils.cstr(fname)
if fname.split(".")[-1] in ("html", "xml", "js", "css"):
name = add_website_sitemap_config("Page", path, fname, existing_configs)
if name in existing_configs: del existing_configs[name]
if os.path.basename(path)=="generators" and os.path.basename(os.path.dirname(path))=="templates":
for fname in files:
if fname.endswith(".html"):
name = add_website_sitemap_config("Generator", path, fname, existing_configs)
if name in existing_configs: del existing_configs[name]
for name in existing_configs:
webnotes.delete_doc("Website Sitemap Config", name)
webnotes.conn.commit()
开发者ID:Halfnhav,项目名称:wnframework,代码行数:28,代码来源:website_sitemap_config.py
示例14: on_trash
def on_trash(self):
from webnotes.webutils import clear_cache
# remove website sitemap permissions
to_remove = webnotes.conn.sql_list("""select name from `tabWebsite Sitemap Permission`
where website_sitemap=%s""", (self.doc.name,))
webnotes.delete_doc("Website Sitemap Permission", to_remove, ignore_permissions=True)
clear_cache(self.doc.name)
开发者ID:bindscha,项目名称:wnframework_old,代码行数:9,代码来源:website_sitemap.py
示例15: delete_events
def delete_events(ref_type, ref_name):
webnotes.delete_doc(
"Event",
webnotes.conn.sql_list(
"""select name from `tabEvent`
where ref_type=%s and ref_name=%s""",
(ref_type, ref_name),
),
for_reload=True,
)
开发者ID:unixcrh,项目名称:erpnext,代码行数:10,代码来源:transaction_base.py
示例16: test_si_gl_entry_with_aii_and_update_stock_with_warehouse_but_no_account
def test_si_gl_entry_with_aii_and_update_stock_with_warehouse_but_no_account(self):
self.clear_stock_account_balance()
set_perpetual_inventory()
webnotes.delete_doc("Account", "_Test Warehouse No Account - _TC")
# insert purchase receipt
from stock.doctype.purchase_receipt.test_purchase_receipt import test_records \
as pr_test_records
pr = webnotes.bean(copy=pr_test_records[0])
pr.doc.naming_series = "_T-Purchase Receipt-"
pr.doclist[1].warehouse = "_Test Warehouse No Account - _TC"
pr.run_method("calculate_taxes_and_totals")
pr.insert()
pr.submit()
si_doclist = webnotes.copy_doclist(test_records[1])
si_doclist[0]["update_stock"] = 1
si_doclist[0]["posting_time"] = "12:05"
si_doclist[1]["warehouse"] = "_Test Warehouse No Account - _TC"
si = webnotes.bean(copy=si_doclist)
si.insert()
si.submit()
# check stock ledger entries
sle = webnotes.conn.sql("""select * from `tabStock Ledger Entry`
where voucher_type = 'Sales Invoice' and voucher_no = %s""",
si.doc.name, as_dict=1)[0]
self.assertTrue(sle)
self.assertEquals([sle.item_code, sle.warehouse, sle.actual_qty],
["_Test Item", "_Test Warehouse No Account - _TC", -1.0])
# check gl entries
gl_entries = webnotes.conn.sql("""select account, debit, credit
from `tabGL Entry` where voucher_type='Sales Invoice' and voucher_no=%s
order by account asc, debit asc""", si.doc.name, as_dict=1)
self.assertTrue(gl_entries)
expected_gl_entries = sorted([
[si.doc.debit_to, 630.0, 0.0],
[si_doclist[1]["income_account"], 0.0, 500.0],
[si_doclist[2]["account_head"], 0.0, 80.0],
[si_doclist[3]["account_head"], 0.0, 50.0],
])
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_gl_entries[i][0], gle.account)
self.assertEquals(expected_gl_entries[i][1], gle.debit)
self.assertEquals(expected_gl_entries[i][2], gle.credit)
si.cancel()
gle = webnotes.conn.sql("""select * from `tabGL Entry`
where voucher_type='Sales Invoice' and voucher_no=%s""", si.doc.name)
self.assertFalse(gle)
set_perpetual_inventory(0)
开发者ID:Jdfkat,项目名称:erpnext,代码行数:55,代码来源:test_sales_invoice.py
示例17: execute
def execute():
webnotes.clear_perms("Profile")
webnotes.reload_doc("core", "doctype", "profile")
webnotes.conn.sql("""delete from `tabDefaultValue` where defkey='theme'""")
webnotes.delete_doc("Page", "profile-settings")
return
for name in webnotes.conn.sql("""select name from tabProfile"""):
theme = webnotes.conn.get_default("theme", name[0])
if theme:
webnotes.conn.set_value("Profile", name[0], "theme", theme)
开发者ID:Anirudh887,项目名称:erpnext,代码行数:11,代码来源:add_theme_to_profile.py
示例18: if_home_clear_cache
def if_home_clear_cache(self):
"""if home page, clear cache"""
if webnotes.conn.get_value("Website Settings", None, "home_page")==self.doc.name:
if webnotes.conn.exists("Website Sitemap", "index"):
webnotes.delete_doc("Website Sitemap", "index", ignore_permissions=True)
WebsiteGenerator.on_update(self, page_name="index")
from webnotes.sessions import clear_cache
clear_cache('Guest')
from webnotes.webutils import clear_cache
clear_cache(self.doc.page_name)
clear_cache('index')
开发者ID:cswaroop,项目名称:erpnext,代码行数:13,代码来源:web_page.py
示例19: execute
def execute():
webnotes.reload_doc("core", "doctype", "doctype")
tables = webnotes.conn.sql_list("show tables")
if "tabPacked Item" not in tables:
webnotes.rename_doc("DocType", "Delivery Note Packing Item", "Packed Item", force=True)
webnotes.reload_doc("stock", "doctype", "packed_item")
if os.path.exists("app/stock/doctype/delivery_note_packing_item"):
os.system("rm -rf app/stock/doctype/delivery_note_packing_item")
if webnotes.conn.exists("DocType", "Delivery Note Packing Item"):
webnotes.delete_doc("DocType", "Delivery Note Packing Item")
开发者ID:Anirudh887,项目名称:erpnext,代码行数:15,代码来源:p06_rename_packing_list_doctype.py
示例20: delete_items
def delete_items():
"""delete selected items"""
import json
from webnotes.model.code import get_obj
il = json.loads(webnotes.form_dict.get('items'))
doctype = webnotes.form_dict.get('doctype')
for d in il:
try:
dt_obj = get_obj(doctype, d)
if hasattr(dt_obj, 'on_trash'):
dt_obj.on_trash()
webnotes.delete_doc(doctype, d)
except Exception, e:
webnotes.errprint(webnotes.get_traceback())
pass
开发者ID:bindscha,项目名称:wnframework_old,代码行数:17,代码来源:reportview.py
注:本文中的webnotes.delete_doc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论