当前位置: 首页>>代码示例>>Python>>正文


Python frappe.get_all方法代码示例

本文整理汇总了Python中frappe.get_all方法的典型用法代码示例。如果您正苦于以下问题:Python frappe.get_all方法的具体用法?Python frappe.get_all怎么用?Python frappe.get_all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在frappe的用法示例。


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

示例1: export_submitted_coa

# 需要导入模块: import frappe [as 别名]
# 或者: from frappe import get_all [as 别名]
def export_submitted_coa(country=None, chart=None):
	"""
		Make charts tree and export submitted charts as .json files
		to public/files/submitted_charts
		:param country: Country name is optional
	"""

	path = os.path.join(os.path.abspath(frappe.get_site_path()), "public", "files", "submitted_charts")
	frappe.create_folder(path)
	
	filters = {"submitted": 1}
	if country:
		filters.update({"country": country})
	if chart:
		filters.update({"name": chart})

	company_for_submitted_charts = frappe.get_all("Company", filters, ["name", "country"])

	for company in company_for_submitted_charts:
		account_tree = get_account_tree_from_existing_company(company.name)
		write_chart_to_file(account_tree, company, path)
	
	make_tarfile(path, chart) 
开发者ID:frappe,项目名称:chart_of_accounts_builder,代码行数:25,代码来源:utils.py

示例2: get_plants

# 需要导入模块: import frappe [as 别名]
# 或者: from frappe import get_all [as 别名]
def get_plants(self):
		self.set('plants', [])
		filters = {
			"disabled" : 0
		}

		if self.strain:
			filters["strain"] = self.strain

		if self.purpose == "Harvest":
			filters["harvest_scheduled"] = 1

		elif self.purpose == "Cure":
			filters["state"] = "Drying"

		if self.from_plant_room:
			filters["plant_room"] = self.from_plant_room

		for plant in frappe.get_all("Plant", fields=["name", "strain"], filters=filters):
			ple_child = self.append('plants')
			ple_child.plant_code = plant.name
			ple_child.strain = plant.strain
			ple_child.uom = "Gram" 
开发者ID:webonyx,项目名称:erpnext_biotrack,代码行数:25,代码来源:plant_entry.py

示例3: execute

# 需要导入模块: import frappe [as 别名]
# 或者: from frappe import get_all [as 别名]
def execute():
	"""bench execute erpnext_biotrack.patches.delete_all_submitted_quality_inspection.execute """

	# Disable feed update
	frappe.flags.in_patch = True

	for name in frappe.get_all("Quality Inspection"):
		doc = frappe.get_doc("Quality Inspection", name)
		print "Deleting " + doc.name

		if doc.docstatus == 1:
			doc.cancel()

		doc.delete()
		frappe.db.commit()


	frappe.db.sql("UPDATE tabItem SET test_result = NULL")
	frappe.db.commit()

	frappe.flags.in_patch = False 
开发者ID:webonyx,项目名称:erpnext_biotrack,代码行数:23,代码来源:delete_all_submitted_quality_inspection.py

示例4: execute

# 需要导入模块: import frappe [as 别名]
# 或者: from frappe import get_all [as 别名]
def execute():
    """Executed by bench execute erpnext_biotrack.patches.delete_all_synced_stock_entries.execute """

    frappe.flags.mute_emails = True
    rows = frappe.get_all('Stock Reconciliation', filters={"external_transaction_id": ("!=", 0)},
                          fields=["name", "docstatus"])
    i = 0
    for row in rows:
        i += 1
        print "Deleting " + row['name']
        if row["docstatus"] == 1:
            doc = frappe.get_doc('Stock Reconciliation', row['name'])
            doc.cancel()

        frappe.delete_doc('Stock Reconciliation', row['name'])

        if i % 10 == 0:
            frappe.db.commit()

    frappe.flags.mute_emails = False 
开发者ID:webonyx,项目名称:erpnext_biotrack,代码行数:22,代码来源:delete_all_synced_stock_re.py

示例5: execute

# 需要导入模块: import frappe [as 别名]
# 或者: from frappe import get_all [as 别名]
def execute():
    """Executed by bench execute erpnext_biotrack.patches.delete_all_synced_stock_entries.execute """

    frappe.flags.mute_emails = True
    # rows = frappe.db.sql()
    i = 0

    for name in frappe.get_all("Stock Entry"):
        doc = frappe.get_doc("Stock Entry", name)
        i += 1
        print "Deleting " + doc.name
        print doc
        if doc.docstatus == 1:
            doc.cancel()

        doc.delete()

        frappe.db.commit()

    frappe.flags.mute_emails = False 
开发者ID:webonyx,项目名称:erpnext_biotrack,代码行数:22,代码来源:delete_all_synced_stock_entries.py

示例6: execute

# 需要导入模块: import frappe [as 别名]
# 或者: from frappe import get_all [as 别名]
def execute():
	i = 1
	for item in frappe.get_all('Item', fields=["name"],	filters=[]):
		item_doc = frappe.get_doc('Item',item.name)
		print "\nLooping for: " + item_doc.name
		if item_doc.has_variants != 1:
			item_doc.has_variants = 1
			if not item_doc.attributes:
				item_doc.append('attributes',get_attribute(item_doc.name, item_doc.revision))
			item_doc.save()
		args = {"Revision": cstr(item_doc.revision)}

		new_variant = create_variant(item_doc.name, args)
		new_variant.item_code = item_doc.name + "_" + cstr(item_doc.revision)
		new_variant.item_name = item_doc.item_name
		
		
		print new_variant.item_name
		new_variant.insert()
		
		i = i + 1
		#if i > 1:
			#return 
开发者ID:bcornwellmott,项目名称:velometro,代码行数:25,代码来源:switch_to_item_variants.py

示例7: authorise_payment

# 需要导入模块: import frappe [as 别名]
# 或者: from frappe import get_all [as 别名]
def authorise_payment():
	settings = get_razorpay_settings()
	for doc in frappe.get_all("Razorpay Payment", filters={"status": "Created"},
		fields=["name", "data", "reference_doctype", "reference_docname"]):

		confirm_payment(doc, settings.api_key, settings.api_secret)
		set_redirect(doc) 
开发者ID:frappe,项目名称:razorpay_integration,代码行数:9,代码来源:razorpay_payment.py

示例8: get_context

# 需要导入模块: import frappe [as 别名]
# 或者: from frappe import get_all [as 别名]
def get_context(context):
	filters = {
		'forked': 0
	}
	if frappe.form_dict.search:
		filters.update({'country': ('like', '%' + frappe.form_dict.search + '%')})

	# standard sample charts
	context.sample_charts = frappe.get_all("Company", filters=filters,
		fields=["name", "country", "forked", "submitted", "stars", "owner"],
		order_by = 'stars desc, country asc')	
		
		
	# User contributed charts
	filters.update({
		"forked": 1,
		"submitted": 1
	})
	context.contributed_charts = frappe.get_all("Company", filters=filters,
		fields=["name", "country", "forked", "submitted", "stars", "owner"],
		order_by = 'stars desc, country asc')
		
	for d in context.contributed_charts:
		d.submitted_by = frappe.db.get_value("User", d.owner, "full_name")
		
	# User's WIP chart
	filters.update({
		"forked": 1,
		"submitted": 0,
		"owner": frappe.session.user
	})
	context.my_open_charts = frappe.get_all("Company", filters=filters,
		fields=["name", "country", "forked", "submitted", "stars", "owner"],
		order_by = 'name')
	
	context.no_cache = True 
开发者ID:frappe,项目名称:chart_of_accounts_builder,代码行数:38,代码来源:all_charts.py

示例9: get_context

# 需要导入模块: import frappe [as 别名]
# 或者: from frappe import get_all [as 别名]
def get_context(context):
	context.accounts = frappe.get_all("Account", filters={"company": frappe.form_dict.company},
		fields=["account_name", "name", "is_group", "parent_account", 
			"account_type", "company", "root_type", "tax_rate"], order_by="lft asc")
	
	context.stars = frappe.db.get_value("Company", frappe.form_dict.company, "stars")
	context.comment_list = get_comment_list("Company", frappe.form_dict.company)
	context.reference_doctype = "Company"
	context.reference_name = frappe.form_dict.company
	context.no_cache = True 
开发者ID:frappe,项目名称:chart_of_accounts_builder,代码行数:12,代码来源:chart.py

示例10: setup_charts

# 需要导入模块: import frappe [as 别名]
# 或者: from frappe import get_all [as 别名]
def setup_charts(delete_existing=True):
	frappe.local.flags.allow_unverified_charts = True

	# delete
	if delete_existing:
		for company in frappe.get_all("Company"):
			if company.name not in ("Wind Power LLC", "Test Company"):
				print "deleting {0}".format(company.name)
				frappe.delete_doc("Company", company.name)
				frappe.db.commit()

	print "-"*40
	for country in frappe.get_all("Country", fields=["name", "code"]):
		charts = get_charts_for_country(country.name)
		for i, chart in enumerate(charts):
			if (chart != "Standard" or country.name == "United States"):
				if not frappe.db.exists("Company", chart):
					print chart.encode('utf-8')

					company = frappe.new_doc("Company")
					company.company_name = chart
					company.country = country.name
					company.chart_of_accounts = chart
					company.abbr = country.code + str(i+1)
					company.default_currency = "USD"
					company.insert()
					frappe.db.commit() 
开发者ID:frappe,项目名称:chart_of_accounts_builder,代码行数:29,代码来源:utils.py

示例11: get_countries

# 需要导入模块: import frappe [as 别名]
# 或者: from frappe import get_all [as 别名]
def get_countries():
	return [d.name for d in frappe.get_all("Country")] 
开发者ID:frappe,项目名称:chart_of_accounts_builder,代码行数:4,代码来源:utils.py

示例12: get_all_companies

# 需要导入模块: import frappe [as 别名]
# 或者: from frappe import get_all [as 别名]
def get_all_companies(access_token):
	all_company_fields = ["company_name", "hub_user", "country", "seller_city", "site_name", "seller_description"]
	companies = frappe.get_all("Hub Company", fields=all_company_fields)
	return {"companies": companies} 
开发者ID:erpnext,项目名称:hub,代码行数:6,代码来源:api.py

示例13: get_categories

# 需要导入模块: import frappe [as 别名]
# 或者: from frappe import get_all [as 别名]
def get_categories(access_token):
	lft, rgt = frappe.db.get_value('Hub Category', {'name': 'All Categories'}, ['lft', 'rgt'])
	categories = frappe.db.sql('''
		select
			hub_category_name from `tabHub Category`
		where
			lft >= {lft} and
			rgt <= {rgt}
	'''.format(lft=lft, rgt=rgt), as_dict=1)
	# # TODO: Send catgory Object
	# categories = frappe.get_all("Hub Category", fields=["category_name"])
	return {"categories": categories} 
开发者ID:erpnext,项目名称:hub,代码行数:14,代码来源:api.py

示例14: get_all_users

# 需要导入模块: import frappe [as 别名]
# 或者: from frappe import get_all [as 别名]
def get_all_users(access_token):
	users = frappe.get_all("Hub User", fields=["hub_user", "country"])
	return {"users": users} 
开发者ID:erpnext,项目名称:hub,代码行数:5,代码来源:api.py

示例15: after_insert

# 需要导入模块: import frappe [as 别名]
# 或者: from frappe import get_all [as 别名]
def after_insert(self):
        pass
        # receiving_item_wr = frappe.db.get_all("Warranty Request", fields="name", filters={"status": "Start Receiving"})
        # msg = _("This Warranty Request receive item {0}").format(comma_and(receiving_item_wr)) 
开发者ID:nataliamm,项目名称:erpnext-warranty-management,代码行数:6,代码来源:warranty_request.py


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