本文整理汇总了Python中webnotes.reload_doc函数的典型用法代码示例。如果您正苦于以下问题:Python reload_doc函数的具体用法?Python reload_doc怎么用?Python reload_doc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了reload_doc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
def execute():
webnotes.reload_doc("setup", "doctype", "company")
create_chart_of_accounts_if_not_exists()
add_group_accounts()
add_ledger_accounts()
add_aii_cost_center()
set_default_accounts()
示例2: execute
def execute():
webnotes.reload_doc("hr", "doctype", "leave_application")
if not webnotes.get_doctype("Leave Application").get({"doctype": "DocField",
"parent": "Leave Application", "permlevel": 2}):
webnotes.conn.sql("""update `tabDocPerm` set permlevel=1
where parent="Leave Application" and permlevel=2""")
示例3: 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
示例4: execute
def execute():
import webnotes
import webnotes.model.doc
webnotes.conn.sql("delete from `tabDocPerm` where parent='Profile' and permlevel=1")
new_perms = [
{
'parent': 'Profile',
'parentfield': 'permissions',
'parenttype': 'DocType',
'role': 'Administrator',
'permlevel': 1,
'read': 1,
'write': 1
},
{
'parent': 'Profile',
'parentfield': 'permissions',
'parenttype': 'DocType',
'role': 'System Manager',
'permlevel': 1,
'read': 1,
'write': 1
},
]
for perms in new_perms:
doc = webnotes.model.doc.Document('DocPerm')
doc.fields.update(perms)
doc.save()
webnotes.conn.commit()
webnotes.conn.begin()
webnotes.reload_doc('core', 'doctype', 'profile')
示例5: execute
def execute():
webnotes.reload_doc("stock", "doctype", "delivery_note_item")
webnotes.reload_doc("accounts", "doctype", "sales_invoice_item")
webnotes.conn.auto_commit_on_many_writes = True
for company in webnotes.conn.sql("select name from `tabCompany`"):
stock_ledger_entries = webnotes.conn.sql("""select item_code, voucher_type, voucher_no,
voucher_detail_no, posting_date, posting_time, stock_value,
warehouse, actual_qty as qty from `tabStock Ledger Entry`
where ifnull(`is_cancelled`, "No") = "No" and company = %s
order by item_code desc, warehouse desc,
posting_date desc, posting_time desc, name desc""", company[0], as_dict=True)
dn_list = webnotes.conn.sql("""select name from `tabDelivery Note`
where docstatus < 2 and company = %s""", company[0])
for dn in dn_list:
dn = webnotes.get_obj("Delivery Note", dn[0], with_children = 1)
dn.set_buying_amount(stock_ledger_entries)
si_list = webnotes.conn.sql("""select name from `tabSales Invoice`
where docstatus < 2 and company = %s""", company[0])
for si in si_list:
si = webnotes.get_obj("Sales Invoice", si[0], with_children = 1)
si.set_buying_amount(stock_ledger_entries)
webnotes.conn.auto_commit_on_many_writes = False
示例6: execute
def execute():
webnotes.reload_doc("Accounts", "DocType", "Sales Taxes and Charges")
webnotes.conn.sql("""update `tabSales Taxes and Charges`
set cost_center = cost_center_other_charges""")
webnotes.conn.sql_ddl("""alter table `tabSales Taxes and Charges`
drop column cost_center_other_charges""")
示例7: execute
def execute():
webnotes.reload_doc("core", "doctype", "docfield")
webnotes.reload_doc("support", "doctype", "support_ticket")
# customer issue resolved_by should be Profile
if webnotes.conn.sql("""select count(*) from `tabCustomer Issue`
where ifnull(resolved_by,"")!="" """)[0][0]:
webnotes.make_property_setter({
"doctype":"Customer Issue",
"fieldname": "resolved_by",
"property": "options",
"value": "Sales Person"
})
def get_communication_time(support_ticket, sort_order = 'asc'):
tmp = webnotes.conn.sql("""select creation from tabCommunication where
support_ticket=%s order by creation %s limit 1""" % ("%s", sort_order),
support_ticket)
return tmp and tmp[0][0] or None
# update in support ticket
webnotes.conn.auto_commit_on_many_writes = True
for st in webnotes.conn.sql("""select name, modified, status from
`tabSupport Ticket`""", as_dict=1):
webnotes.conn.sql("""update `tabSupport Ticket` set first_responded_on=%s where
name=%s""", (get_communication_time(st.name) or st.modified, st.name))
if st.status=="Closed":
webnotes.conn.sql("""update `tabSupport Ticket` set resolution_date=%s where
name=%s""", (get_communication_time(st.name, 'desc') or st.modified, st.name))
示例8: 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)
note = webnotes.bean({
"doctype":"Note",
"title": name,
"content": "<hr>".join([markdown2.markdown(c) for c in webnotes.conn.sql_list("""
select answer from tabAnswer where question=%s""", question.name)]),
"owner": question.owner,
"creation": question.creation,
"public": 1
}).insert()
except NameError:
pass
webnotes.delete_doc("DocType", "Question")
webnotes.delete_doc("DocType", "Answer")
webnotes.bean("Style Settings").save()
# update comment delete
webnotes.conn.sql("""update tabDocPerm \
set cancel=1 where parent='Comment' and role='System Manager'""")
示例9: execute
def execute():
webnotes.reload_doc("stock", "doctype", "stock_ledger_entry")
webnotes.reload_doc("stock", "doctype", "stock_reconciliation")
rename_fields()
move_remarks_to_comments()
store_stock_reco_json()
示例10: execute
def execute():
import webnotes
webnotes.reload_doc("buying", "doctype", "purchase_order_item")
webnotes.reload_doc("stock", "doctype", "purchase_receipt_item")
for pi in webnotes.conn.sql("""select name from `tabPurchase Invoice` where docstatus = 1"""):
webnotes.get_obj("Purchase Invoice", pi[0],
with_children=1).update_qty(change_modified=False)
示例11: execute
def execute():
webnotes.reload_doc("stock", "doctype", "price_list")
webnotes.reload_doc("stock", "doctype", "item_price")
webnotes.conn.sql("""update `tabPrice List` pl, `tabItem Price` ip
set pl.selling=ip.selling, pl.buying=ip.buying
where pl.name=ip.price_list_name""")
示例12: execute
def execute():
webnotes.reload_doc("core", "doctype", "event")
webnotes.conn.sql("""delete from `tabEvent` where repeat_on='Every Year' and ref_type='Employee'""")
for employee in webnotes.conn.sql_list("""select name from `tabEmployee` where status='Active' and
ifnull(date_of_birth, '')!=''"""):
obj = webnotes.get_obj("Employee", employee)
obj.update_dob_event()
示例13: execute
def execute():
import webnotes
webnotes.reload_doc('stock', 'doctype', 'packed_item')
for si in webnotes.conn.sql("""select name from `tabSales Invoice` where docstatus = 1"""):
webnotes.get_obj("Sales Invoice", si[0],
with_children=1).update_qty(change_modified=False)
webnotes.conn.commit()
示例14: execute
def execute():
webnotes.reload_doc("stock", "doctype", "item_price")
# check for selling
webnotes.conn.sql("""update `tabItem Price` set buying_or_selling = "Selling"
where ifnull(buying_or_selling, '')=''""")
示例15: execute
def execute():
import webnotes
webnotes.conn.sql("""delete from `tabSearch Criteria` \
where name = 'customer_address_contact'""")
webnotes.reload_doc("core", "doctype", "report")
webnotes.reload_doc('selling', 'report', 'customer_addresses_and_contacts')