• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python webnotes.rename_doc函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中webnotes.rename_doc函数的典型用法代码示例。如果您正苦于以下问题:Python rename_doc函数的具体用法?Python rename_doc怎么用?Python rename_doc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了rename_doc函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: add_or_update_sitemap

	def add_or_update_sitemap(self):
		page_name = self.get_page_name()
		
		existing_page_name = webnotes.conn.get_value("Website Sitemap", {"ref_doctype": self.doc.doctype,
			"docname": self.doc.name})
			
		opts = webnotes._dict({
			"page_or_generator": "Generator",
			"ref_doctype":self.doc.doctype, 
			"docname": self.doc.name,
			"page_name": page_name,
			"link_name": self._website_config.name,
			"lastmod": webnotes.utils.get_datetime(self.doc.modified).strftime("%Y-%m-%d"),
			"parent_website_sitemap": self.doc.parent_website_sitemap,
			"page_title": self.get_page_title() \
				if hasattr(self, "get_page_title") else (self.doc.title or self.doc.name)
		})
		
		if self.meta.get_field("public_read"):
			opts.public_read = self.doc.public_read
			opts.public_write = self.doc.public_write
		else:
			opts.public_read = 1
			
		if existing_page_name:
			if existing_page_name != page_name:
				webnotes.rename_doc("Website Sitemap", existing_page_name, page_name, ignore_permissions=True)
			update_sitemap(page_name, opts)
		else:
			add_to_sitemap(opts)
开发者ID:bindscha,项目名称:wnframework_old,代码行数:30,代码来源:webutils.py


示例2: execute

def execute():
	webnotes.reload_doc('website', 'doctype', 'blogger')
	webnotes.rename_doc("DocType", "Blog", "Blog Post", force=True)
	webnotes.reload_doc('website', 'doctype', 'blog_post')
	webnotes.conn.sql('''update tabBlogger set posts=(select count(*) 
		from `tabBlog Post` where ifnull(blogger,"")=tabBlogger.name)''')
	webnotes.conn.sql("""update `tabBlog Post` set published_on=date(creation)""")
开发者ID:BillTheBest,项目名称:erpnext,代码行数:7,代码来源:p03_rename_blog_to_blog_post.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: on_rename

	def on_rename(self, new, old):
		#update customer_name if not naming series
		if webnotes.defaults.get_global_default('cust_master_name') == 'Customer Name':
			update_fields = [
			('Customer', 'name'),
			('Address', 'customer'),
			('Contact', 'customer'),
			('Customer Issue', 'customer'),
			('Delivery Note', 'customer'),
			('Opportunity', 'customer'),
			('Installation Note', 'customer'),
			('Maintenance Schedule', 'customer'),
			('Maintenance Visit', 'customer'),
			('Project', 'customer'),
			('Quotation', 'customer'),
			('Sales Invoice', 'customer'),
			('Sales Order', 'customer'),
			('Serial No', 'customer'),
			('Shipping Address', 'customer'),
			('Stock Entry', 'customer'),
			('Support Ticket', 'customer')]
			for rec in update_fields:
				sql("""update `tab%s` set customer_name = %s
					where `%s` = %s""" % (rec[0], "%s" ,rec[1], "%s"), (new, old))
		
		for account in webnotes.conn.sql("""select name, account_name from 
			tabAccount where master_name=%s and master_type='Customer'""", old, as_dict=1):
			if account.account_name != new:
				webnotes.rename_doc("Account", account.name, new)

		#update master_name in doctype account
		webnotes.conn.sql("""update `tabAccount` set master_name = %s, 
			master_type = 'Customer' where master_name = %s""", (new,old))
开发者ID:BillTheBest,项目名称:erpnext,代码行数:33,代码来源:customer.py


示例5: test_rename

	def test_rename(self):
		self.assertEqual(webnotes.conn.exists("Customer", "_Test Customer 1"), 
			(("_Test Customer 1",),))
			
		webnotes.rename_doc("Customer", "_Test Customer 1", "_Test Customer 1 Renamed")

		self.assertEqual(webnotes.conn.exists("Customer", "_Test Customer 1 Renamed"), 
			(("_Test Customer 1 Renamed",),))
		self.assertEqual(webnotes.conn.exists("Customer", "_Test Customer 1"), ())
开发者ID:BANSALJEE,项目名称:erpnext,代码行数:9,代码来源:test_customer.py


示例6: execute

def execute():
	email_lead = {}
	for name, email in webnotes.conn.sql("""select name, email_id from `tabLead`
		where ifnull(email_id, '')!='' order by creation asc"""):
		email = extract_email_id(email)
		if email:
			if email not in email_lead:
				email_lead[email] = name
			else:
				webnotes.rename_doc("Lead", name, email_lead[email], force=True, merge=True)
开发者ID:Anirudh887,项目名称:erpnext,代码行数:10,代码来源:p04_merge_duplicate_leads.py


示例7: rename_account_for

def rename_account_for(dt, olddn, newdn, merge, company):
	old_account = get_account_for(dt, olddn)
	if old_account:
		new_account = None
		if not merge:
			if old_account == add_abbr_if_missing(olddn, company):
				new_account = webnotes.rename_doc("Account", old_account, newdn)
		else:
			existing_new_account = get_account_for(dt, newdn)
			new_account = webnotes.rename_doc("Account", old_account, 
				existing_new_account or newdn, merge=True if existing_new_account else False)

		webnotes.conn.set_value("Account", new_account or old_account, "master_name", newdn)
开发者ID:abordin,项目名称:erpnext,代码行数:13,代码来源:utils.py


示例8: on_rename

	def on_rename(self, new, old, merge=False):
		#update customer_name if not naming series
		if webnotes.defaults.get_global_default('cust_master_name') == 'Customer Name':
			webnotes.conn.sql("""update `tabCustomer` set customer_name = %s where name = %s""", 
				(new, old))
		
		for account in webnotes.conn.sql("""select name, account_name from 
			tabAccount where master_name=%s and master_type='Customer'""", old, as_dict=1):
			if account.account_name != new:
				webnotes.rename_doc("Account", account.name, new, merge=merge)

		#update master_name in doctype account
		webnotes.conn.sql("""update `tabAccount` set master_name = %s, 
			master_type = 'Customer' where master_name = %s""", (new,old))
开发者ID:CarlosAnt,项目名称:erpnext,代码行数:14,代码来源:customer.py


示例9: rename_account_for

def rename_account_for(dt, olddn, newdn, merge):
	old_account = get_account_for(dt, olddn)
	if old_account:
		new_account = None
		if not merge:
			if old_account == olddn:
				new_account = webnotes.rename_doc("Account", olddn, newdn)
		else:
			existing_new_account = get_account_for(dt, newdn)
			new_account = webnotes.rename_doc("Account", old_account, 
				existing_new_account or newdn, merge=True if existing_new_account else False)

		if new_account:
			webnotes.conn.set_value("Account", new_account, "master_name", newdn)
开发者ID:SoniaBrogi,项目名称:erpnext,代码行数:14,代码来源:utils.py


示例10: 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


示例11: 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


示例12: after_rename

	def after_rename(self, old, new, merge=False):
		#update customer_name if not naming series
		if webnotes.defaults.get_global_default('cust_master_name') == 'Customer Name':
			webnotes.conn.set(self.doc, "customer_name", new)
		
		for account in webnotes.conn.sql("""select name, account_name from 
			tabAccount where master_name=%s and master_type='Customer'""", old, as_dict=1):
			if account.account_name != new:
				merge_account = True if merge and webnotes.conn.get_value("Account", 
					{"master_name": new, "master_type": "Customer"}) else False
				webnotes.rename_doc("Account", account.name, new, merge=merge_account)

		#update master_name in account record
		webnotes.conn.sql("""update `tabAccount` set master_name = %s, 
			master_type = 'Customer' where master_name = %s""", (new, old))
开发者ID:rohitw1991,项目名称:innoworth-app,代码行数:15,代码来源:customer.py


示例13: rename_account

	def rename_account(self, olddn, newdn, merge):
		old_account = webnotes.conn.get_value("Account", 
			{"account_type": "Warehouse", "master_name": olddn})
		if old_account:
			new_account = None
			if not merge:
				if old_account == olddn:
					new_account = webnotes.rename_doc("Account", olddn, newdn)
			else:
				existing_new_account = webnotes.conn.get_value("Account", 
					{"account_type": "Warehouse", "master_name": newdn})
				new_account = webnotes.rename_doc("Account", old_account, 
					existing_new_account or newdn, merge=True if existing_new_account else False)

			if new_account:
				webnotes.conn.set_value("Account", new_account, "master_name", newdn)
开发者ID:rohitw1991,项目名称:innoworth-app,代码行数:16,代码来源:warehouse.py


示例14: execute

def execute():
	from webnotes.utils import get_base_path
	import shutil
	webnotes.reload_doc("core", "doctype", "doctype")

	tables = webnotes.conn.sql_list("show tables")
	
	if "tabApplicable Territory" not in tables:
		webnotes.rename_doc("DocType", "For Territory", "Applicable Territory", force=True)
	
	webnotes.reload_doc("setup", "doctype", "applicable_territory")
	
	path = os.path.join(get_base_path(), "app", "setup", "doctype", "for_territory")
	if os.path.exists(path):
		shutil.rmtree(path)
	
	if webnotes.conn.exists("DocType", "For Territory"):
		webnotes.delete_doc("DocType", "For Territory")
开发者ID:Anirudh887,项目名称:erpnext,代码行数:18,代码来源:p07_rename_for_territory.py


示例15: test_merge

	def test_merge(self):
		from webnotes.test_runner import make_test_records
		make_test_records("Sales Invoice")
		
		# clear transactions for new name
		webnotes.conn.sql("""delete from `tabSales Invoice` where customer='_Test Customer 1'""")
		
		# check if they exist
		self.assertEqual(webnotes.conn.exists("Customer", "_Test Customer"), 
			(("_Test Customer",),))
		self.assertEqual(webnotes.conn.exists("Customer", "_Test Customer 1"), 
			(("_Test Customer 1",),))
		self.assertEqual(webnotes.conn.exists("Account", "_Test Customer - _TC"), 
			(("_Test Customer - _TC",),))
		self.assertEqual(webnotes.conn.exists("Account", "_Test Customer 1 - _TC"), 
			(("_Test Customer 1 - _TC",),))
			
		# check if transactions exists
		self.assertNotEquals(webnotes.conn.sql("""select count(*) from `tabSales Invoice` 
			where customer='_Test Customer'""", )[0][0], 0)
		self.assertNotEquals(webnotes.conn.sql("""select count(*) from `tabSales Invoice` 
			where debit_to='_Test Customer - _TC'""", )[0][0], 0)
		
		webnotes.rename_doc("Customer", "_Test Customer", "_Test Customer 1", merge=True)
		
		# check that no transaction exists for old name
		self.assertNotEquals(webnotes.conn.sql("""select count(*) from `tabSales Invoice` 
			where customer='_Test Customer 1'""", )[0][0], 0)
		self.assertNotEquals(webnotes.conn.sql("""select count(*) from `tabSales Invoice` 
			where debit_to='_Test Customer 1 - _TC'""", )[0][0], 0)
		
		# check that transactions exist for new name
		self.assertEquals(webnotes.conn.sql("""select count(*) from `tabSales Invoice` 
			where customer='_Test Customer'""", )[0][0], 0)
		self.assertEquals(webnotes.conn.sql("""select count(*) from `tabSales Invoice` 
			where debit_to='_Test Customer - _TC'""", )[0][0], 0)
			
		# check that old name doesn't exist
		self.assertEqual(webnotes.conn.exists("Customer", "_Test Customer"), ())
		self.assertEqual(webnotes.conn.exists("Account", "_Test Customer - _TC"), ())
		
		# create back _Test Customer
		webnotes.bean(copy=test_records[0]).insert()
开发者ID:Jdfkat,项目名称:erpnext,代码行数:43,代码来源:test_customer.py


示例16: on_rename

	def on_rename(self, new, old):
		#update supplier_name if not naming series
		if get_defaults().get('supp_master_name') == 'Supplier Name':
			update_fields = [
			('Supplier', 'name'),
			('Address', 'supplier'),
			('Contact', 'supplier'),
			('Purchase Invoice', 'supplier'),
			('Purchase Order', 'supplier'),
			('Purchase Receipt', 'supplier'),
			('Serial No', 'supplier')]
			for rec in update_fields:
				sql("update `tab%s` set supplier_name = %s where `%s` = %s" % \
					(rec[0], '%s', rec[1], '%s'), (new, old))
				
		for account in webnotes.conn.sql("""select name, account_name from 
			tabAccount where master_name=%s and master_type='Supplier'""", old, as_dict=1):
			if account.account_name != new:
				webnotes.rename_doc("Account", account.name, new)

		#update master_name in doctype account
		webnotes.conn.sql("""update `tabAccount` set master_name = %s, 
			master_type = 'Supplier' where master_name = %s""" , (new,old))
开发者ID:hfeeki,项目名称:erpnext,代码行数:23,代码来源:supplier.py


示例17: rename_doc

def rename_doc(doctype, old_name, new_name, merge=False):
	new_name = webnotes.rename_doc(doctype, old_name, new_name, merge=merge)
	return new_name
开发者ID:bindscha,项目名称:wnframework_old,代码行数:3,代码来源:client.py


示例18: _rename_record

	def _rename_record(dt):
		for d in webnotes.conn.sql("select name from `tab%s` where company=%s" % (dt, '%s'), company):
			parts = d[0].split(" - ")
			if parts[-1].lower() == old.lower():
				name_without_abbr = " - ".join(parts[:-1])
				webnotes.rename_doc(dt, d[0], name_without_abbr + " - " + new)
开发者ID:saurabh6790,项目名称:tru_app_back,代码行数:6,代码来源:company.py



注:本文中的webnotes.rename_doc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python webnotes.throw函数代码示例发布时间:2022-05-26
下一篇:
Python webnotes.reload_doc函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap