コード例 #1
0
ファイル: cart.py プロジェクト: ovenube/erpnext
def get_debtors_account(cart_settings):
    payment_gateway_account_currency = \
     frappe.get_doc("Payment Gateway Account", cart_settings.payment_gateway_account).currency

    account_name = _("Debtors ({0})".format(payment_gateway_account_currency))

    debtors_account_name = get_account_name("Receivable", "Asset", is_group=0,\
     account_currency=payment_gateway_account_currency, company=cart_settings.company)

    if not debtors_account_name:
        debtors_account = frappe.get_doc({
            "doctype":
            "Account",
            "account_type":
            "Receivable",
            "root_type":
            "Asset",
            "is_group":
            0,
            "parent_account":
            get_account_name(root_type="Asset",
                             is_group=1,
                             company=cart_settings.company),
            "account_name":
            account_name,
            "currency":
            payment_gateway_account_currency
        }).insert(ignore_permissions=True)

        return debtors_account.name

    else:
        return debtors_account_name
コード例 #2
0
ファイル: cart.py プロジェクト: venetanji/erpnext
def get_debtors_account(cart_settings):
	payment_gateway_account_currency = \
		frappe.get_doc("Payment Gateway Account", cart_settings.payment_gateway_account).currency

	account_name = _("Debtors ({0})".format(payment_gateway_account_currency))

	debtors_account_name = get_account_name("Receivable", "Asset", is_group=0,\
		account_currency=payment_gateway_account_currency, company=cart_settings.company)

	if not debtors_account_name:
		debtors_account = frappe.get_doc({
			"doctype": "Account",
			"account_type": "Receivable",
			"root_type": "Asset",
			"is_group": 0,
			"parent_account": get_account_name(root_type="Asset", is_group=1, company=cart_settings.company),
			"account_name": account_name,
			"currency": payment_gateway_account_currency
		}).insert(ignore_permissions=True)

		return debtors_account.name

	else:
		return debtors_account_name
コード例 #3
0
def get_charts(fiscal_year):
    company = frappe.get_doc("Company", get_company_for_dashboards())
    bank_account = company.default_bank_account or get_account_name(
        "Bank", company=company.name)
    default_cost_center = company.cost_center

    return [
        {
            "doctype":
            "Dashboard Charts",
            "name":
            "Profit and Loss",
            "owner":
            "Administrator",
            "report_name":
            "Profit and Loss Statement",
            "filters_json":
            json.dumps({
                "company": company.name,
                "filter_based_on": "Fiscal Year",
                "from_fiscal_year": fiscal_year.get('name'),
                "to_fiscal_year": fiscal_year.get('name'),
                "periodicity": "Monthly",
                "include_default_book_entries": 1
            }),
            "type":
            "Bar",
            'timeseries':
            0,
            "chart_type":
            "Report",
            "chart_name":
            _("Profit and Loss"),
            "is_custom":
            1,
            "is_public":
            1
        },
        {
            "doctype": "Dashboard Chart",
            "time_interval": "Monthly",
            "name": "Incoming Bills (Purchase Invoice)",
            "chart_name": _("Incoming Bills (Purchase Invoice)"),
            "timespan": "Last Year",
            "color": "#a83333",
            "value_based_on": "base_net_total",
            "filters_json":
            json.dumps([["Purchase Invoice", "docstatus", "=", 1]]),
            "chart_type": "Sum",
            "timeseries": 1,
            "based_on": "posting_date",
            "owner": "Administrator",
            "document_type": "Purchase Invoice",
            "type": "Bar",
            "width": "Half",
            "is_public": 1
        },
        {
            "doctype": "Dashboard Chart",
            "name": "Outgoing Bills (Sales Invoice)",
            "time_interval": "Monthly",
            "chart_name": _("Outgoing Bills (Sales Invoice)"),
            "timespan": "Last Year",
            "color": "#7b933d",
            "value_based_on": "base_net_total",
            "filters_json": json.dumps([["Sales Invoice", "docstatus", "=",
                                         1]]),
            "chart_type": "Sum",
            "timeseries": 1,
            "based_on": "posting_date",
            "owner": "Administrator",
            "document_type": "Sales Invoice",
            "type": "Bar",
            "width": "Half",
            "is_public": 1
        },
        {
            "doctype":
            "Dashboard Charts",
            "name":
            "Accounts Receivable Ageing",
            "owner":
            "Administrator",
            "report_name":
            "Accounts Receivable",
            "filters_json":
            json.dumps({
                "company": company.name,
                "report_date": nowdate(),
                "ageing_based_on": "Due Date",
                "range1": 30,
                "range2": 60,
                "range3": 90,
                "range4": 120
            }),
            "type":
            "Donut",
            'timeseries':
            0,
            "chart_type":
            "Report",
            "chart_name":
            _("Accounts Receivable Ageing"),
            "is_custom":
            1,
            "is_public":
            1
        },
        {
            "doctype":
            "Dashboard Charts",
            "name":
            "Accounts Payable Ageing",
            "owner":
            "Administrator",
            "report_name":
            "Accounts Payable",
            "filters_json":
            json.dumps({
                "company": company.name,
                "report_date": nowdate(),
                "ageing_based_on": "Due Date",
                "range1": 30,
                "range2": 60,
                "range3": 90,
                "range4": 120
            }),
            "type":
            "Donut",
            'timeseries':
            0,
            "chart_type":
            "Report",
            "chart_name":
            _("Accounts Payable Ageing"),
            "is_custom":
            1,
            "is_public":
            1
        },
        {
            "doctype":
            "Dashboard Charts",
            "name":
            "Budget Variance",
            "owner":
            "Administrator",
            "report_name":
            "Budget Variance Report",
            "filters_json":
            json.dumps({
                "company": company.name,
                "from_fiscal_year": fiscal_year.get('name'),
                "to_fiscal_year": fiscal_year.get('name'),
                "period": "Monthly",
                "budget_against": "Cost Center"
            }),
            "type":
            "Bar",
            "timeseries":
            0,
            "chart_type":
            "Report",
            "chart_name":
            _("Budget Variance"),
            "is_custom":
            1,
            "is_public":
            1
        },
        {
            "doctype":
            "Dashboard Charts",
            "name":
            "Bank Balance",
            "time_interval":
            "Quarterly",
            "chart_name":
            "Bank Balance",
            "timespan":
            "Last Year",
            "filters_json":
            json.dumps({
                "company": company.name,
                "account": bank_account
            }),
            "source":
            "Account Balance Timeline",
            "chart_type":
            "Custom",
            "timeseries":
            1,
            "owner":
            "Administrator",
            "type":
            "Line",
            "width":
            "Half",
            "is_public":
            1
        },
    ]