Example #1
0
def get_party_account_currency(party_type, party, company):
    def generator():
        party_account = get_party_account(party_type, party, company)
        return frappe.db.get_value("Account", party_account,
                                   "account_currency")

    return frappe.local_cache("party_account_currency",
                              (party_type, party, company), generator)
Example #2
0
def get_party_gle_currency(party_type, party, company):
	def generator():
		existing_gle_currency = frappe.db.sql("""select account_currency from `tabGL Entry`
			where docstatus=1 and company=%(company)s and party_type=%(party_type)s and party=%(party)s
			limit 1""", { "company": company, "party_type": party_type, "party": party })

		return existing_gle_currency[0][0] if existing_gle_currency else None

	return frappe.local_cache("party_gle_currency", (party_type, party, company), generator)
Example #3
0
def get_allow_project_in_entry_of_bs_account():
    def generator():
        return cint(
            frappe.db.get_value('Accounts Settings', None,
                                'allow_project_in_entry_of_bs_account'))

    return frappe.local_cache("get_allow_project_in_entry_of_bs_account", (),
                              generator,
                              regenerate_if_none=True)
Example #4
0
def get_party_gle_account(party_type, party, company):
	def generator():
		existing_gle_account = frappe.db.sql("""select account from `tabGL Entry`
			where docstatus=1 and company=%(company)s and party_type=%(party_type)s and party=%(party)s
			limit 1""", { "company": company, "party_type": party_type, "party": party })

		return existing_gle_account[0][0] if existing_gle_account else None

	return frappe.local_cache("party_gle_account", (party_type, party, company), generator,
		regenerate_if_none=True)
Example #5
0
def get_party_gle_account(party_type, party, company):
	def generator():
		existing_gle_account = frappe.db.sql("""select account from `tabGL Entry`
			where docstatus=1 and company=%(company)s and party_type=%(party_type)s and party=%(party)s
			limit 1""", { "company": company, "party_type": party_type, "party": party })

		return existing_gle_account[0][0] if existing_gle_account else None

	return frappe.local_cache("party_gle_account", (party_type, party, company), generator,
		regenerate_if_none=True)
Example #6
0
def get_account_currency(account):
	"""Helper function to get account currency"""
	def generator():
		account_currency, company = frappe.db.get_value("Account", account, ["account_currency", "company"])
		if not account_currency:
			account_currency = frappe.db.get_value("Company", company, "default_currency")

		return account_currency

	return frappe.local_cache("account_currency", account, generator)
Example #7
0
def get_account_currency(account):
	"""Helper function to get account currency"""
	if not account:
		return
	def generator():
		account_currency, company = frappe.get_cached_value("Account", account, ["account_currency", "company"])
		if not account_currency:
			account_currency = frappe.get_cached_value('Company',  company,  "default_currency")

		return account_currency

	return frappe.local_cache("account_currency", account, generator)
Example #8
0
def get_party_gle_currency(party_type, party, company):
    def generator():
        existing_gle_currency = frappe.db.sql(
            """select account_currency from `tabGL Entry`
			where docstatus=1 and company=%(company)s and party_type=%(party_type)s and party=%(party)s
			limit 1""", {
                "company": company,
                "party_type": party_type,
                "party": party
            })

        return existing_gle_currency[0][0] if existing_gle_currency else None

    return frappe.local_cache("party_gle_currency",
                              (party_type, party, company), generator)
Example #9
0
def get_party_account_currency(party_type, party, company):
	def generator():
		party_account = get_party_account(party_type, party, company)
		return frappe.db.get_value("Account", party_account, "account_currency")

	return frappe.local_cache("party_account_currency", (party_type, party, company), generator)
Example #10
0
def get_company_currency(company):
	return frappe.local_cache("company_currency", company,
		lambda: frappe.db.get_value("Company", company, "default_currency"))
Example #11
0
def get_company_currency(company):
    return frappe.local_cache(
        "company_currency", company,
        lambda: frappe.db.get_value("Company", company, "default_currency"))
Example #12
0
def get_allow_cost_center_in_entry_of_bs_account():
	def generator():
		return cint(frappe.db.get_value('Accounts Settings', None, 'allow_cost_center_in_entry_of_bs_account'))
	return frappe.local_cache("get_allow_cost_center_in_entry_of_bs_account", (), generator, regenerate_if_none=True)