當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。