brotherton-erpnext/erpnext/accounts/report/general_ledger/general_ledger.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

604 lines
18 KiB
Python
Raw Normal View History

# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
2013-12-26 05:37:58 +00:00
# License: GNU General Public License v3. See license.txt
from collections import OrderedDict
import frappe
from frappe import _, _dict
from frappe.utils import cstr, getdate
from erpnext import get_company_currency, get_default_company
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
get_accounting_dimensions,
get_dimension_with_children,
)
2019-06-21 11:50:37 +00:00
from erpnext.accounts.report.financial_statements import get_cost_centers_with_children
from erpnext.accounts.report.utils import convert_to_presentation_currency, get_currency
from erpnext.accounts.utils import get_account_currency
# to cache translations
TRANSLATIONS = frappe._dict()
2022-03-28 13:22:46 +00:00
2013-12-26 05:37:58 +00:00
def execute(filters=None):
2018-05-16 18:01:09 +00:00
if not filters:
return [], []
account_details = {}
if filters and filters.get("print_in_account_currency") and not filters.get("account"):
frappe.throw(_("Select an account to print in account currency"))
2015-04-23 07:44:17 +00:00
for acc in frappe.db.sql("""select name, is_group from tabAccount""", as_dict=1):
2015-05-27 07:31:38 +00:00
account_details.setdefault(acc.name, acc)
2014-05-20 09:37:18 +00:00
if filters.get("party"):
filters.party = frappe.parse_json(filters.get("party"))
2013-12-26 05:37:58 +00:00
validate_filters(filters, account_details)
2015-09-28 08:01:17 +00:00
validate_party(filters)
2015-09-28 08:01:17 +00:00
filters = set_account_currency(filters)
2014-05-20 09:37:18 +00:00
columns = get_columns(filters)
2014-05-20 09:37:18 +00:00
update_translations()
res = get_result(filters, account_details)
2013-12-26 05:37:58 +00:00
return columns, res
2014-05-20 09:37:18 +00:00
2022-03-28 13:22:46 +00:00
def update_translations():
TRANSLATIONS.update(
dict(OPENING=_("Opening"), TOTAL=_("Total"), CLOSING_TOTAL=_("Closing (Opening + Total)"))
)
2022-03-28 13:22:46 +00:00
2013-12-26 05:37:58 +00:00
def validate_filters(filters, account_details):
2020-08-17 07:14:52 +00:00
if not filters.get("company"):
frappe.throw(_("{0} is mandatory").format(_("Company")))
if not filters.get("from_date") and not filters.get("to_date"):
frappe.throw(
_("{0} and {1} are mandatory").format(frappe.bold(_("From Date")), frappe.bold(_("To Date")))
2022-03-28 13:22:46 +00:00
)
if filters.get("account"):
filters.account = frappe.parse_json(filters.get("account"))
for account in filters.account:
if not account_details.get(account):
frappe.throw(_("Account {0} does not exists").format(account))
2014-08-18 10:08:04 +00:00
if filters.get("account") and filters.get("group_by") == "Group by Account":
filters.account = frappe.parse_json(filters.get("account"))
for account in filters.account:
if account_details[account].is_group == 0:
frappe.throw(_("Can not filter based on Child Account, if grouped by Account"))
2014-05-20 09:37:18 +00:00
if filters.get("voucher_no") and filters.get("group_by") in ["Group by Voucher"]:
2014-02-14 10:17:51 +00:00
frappe.throw(_("Can not filter based on Voucher No, if grouped by Voucher"))
2014-05-20 09:37:18 +00:00
if filters.from_date > filters.to_date:
2014-02-14 10:17:51 +00:00
frappe.throw(_("From Date must be before To Date"))
2014-05-20 09:37:18 +00:00
if filters.get("project"):
filters.project = frappe.parse_json(filters.get("project"))
if filters.get("cost_center"):
filters.cost_center = frappe.parse_json(filters.get("cost_center"))
def validate_party(filters):
party_type, party = filters.get("party_type"), filters.get("party")
if party and party_type:
for d in party:
if not frappe.db.exists(party_type, d):
frappe.throw(_("Invalid {0}: {1}").format(party_type, d))
2022-03-28 13:22:46 +00:00
def set_account_currency(filters):
if filters.get("account") or (filters.get("party") and len(filters.party) == 1):
2018-08-08 11:07:31 +00:00
filters["company_currency"] = frappe.get_cached_value(
"Company", filters.company, "default_currency"
)
account_currency = None
2015-09-28 08:01:17 +00:00
if filters.get("account"):
if len(filters.get("account")) == 1:
account_currency = get_account_currency(filters.account[0])
else:
currency = get_account_currency(filters.account[0])
is_same_account_currency = True
for account in filters.get("account"):
if get_account_currency(account) != currency:
is_same_account_currency = False
break
if is_same_account_currency:
account_currency = currency
elif filters.get("party") and filters.get("party_type"):
gle_currency = frappe.db.get_value(
"GL Entry",
{"party_type": filters.party_type, "party": filters.party[0], "company": filters.company},
"account_currency",
)
if gle_currency:
account_currency = gle_currency
else:
account_currency = (
None
if filters.party_type in ["Employee", "Shareholder", "Member"]
else frappe.get_cached_value(filters.party_type, filters.party[0], "default_currency")
2022-03-28 13:22:46 +00:00
)
2015-09-28 08:01:17 +00:00
filters["account_currency"] = account_currency or filters.company_currency
if filters.account_currency != filters.company_currency and not filters.presentation_currency:
filters.presentation_currency = filters.account_currency
2015-09-28 08:01:17 +00:00
return filters
2015-09-28 08:01:17 +00:00
2022-03-28 13:22:46 +00:00
2014-05-20 09:37:18 +00:00
def get_result(filters, account_details):
accounting_dimensions = []
if filters.get("include_dimensions"):
accounting_dimensions = get_accounting_dimensions()
gl_entries = get_gl_entries(filters, accounting_dimensions)
data = get_data_with_opening_closing(filters, account_details, accounting_dimensions, gl_entries)
2014-05-20 09:37:18 +00:00
result = get_result_as_list(data, filters)
return result
2014-05-20 09:37:18 +00:00
2022-03-28 13:22:46 +00:00
def get_gl_entries(filters, accounting_dimensions):
currency_map = get_currency(filters)
select_fields = """, debit, credit, debit_in_account_currency,
credit_in_account_currency """
order_by_statement = "order by posting_date, account, creation"
2021-03-09 15:01:57 +00:00
if filters.get("include_dimensions"):
order_by_statement = "order by posting_date, creation"
if filters.get("group_by") == "Group by Voucher":
order_by_statement = "order by posting_date, voucher_type, voucher_no"
if filters.get("group_by") == "Group by Account":
order_by_statement = "order by account, posting_date, creation"
if filters.get("include_default_book_entries"):
filters["company_fb"] = frappe.get_cached_value(
"Company", filters.get("company"), "default_finance_book"
)
dimension_fields = ""
if accounting_dimensions:
dimension_fields = ", ".join(accounting_dimensions) + ","
gl_entries = frappe.db.sql(
"""
select
name as gl_entry, posting_date, account, party_type, party,
voucher_type, voucher_no, {dimension_fields}
cost_center, project,
against_voucher_type, against_voucher, account_currency,
feat(Cost Center): Distributed Cost Center (#21531) * feat: Distributed Cost Center Squashed commit of the following: commit 274236eb92dfddfd015583ee1e6b5e1937366d28 Author: Vignesh <kaviya.3111999@gmail.com> Date: Mon Mar 23 18:32:26 2020 +0530 Fix: Indentation commit beae0b9849f333dd1d9f29c27192ea7de2e4e809 Author: Vignesh <kaviya.3111999@gmail.com> Date: Mon Mar 23 18:26:50 2020 +0530 The validations are added to distributed cost center. commit 3f66943adacb5797338ef3510251bf6633be3dba Author: Vignesh <kaviya.3111999@gmail.com> Date: Thu Mar 19 22:17:25 2020 +0530 The distributed cost centers are shown with the percentage allocation in the reports commit 1ac11df522096fa187d2f5863b4c970e18b37fac Author: Vignesh <kaviya.3111999@gmail.com> Date: Thu Mar 19 13:36:04 2020 +0530 The child table distributed cost center are added to cost center doctype and then validate percentage allocation. * fix(Distributed Cost Center): validation and filters * fix(Distributed Cost Center): financial statement query * fix(Distributed Cost Center): add test cases Co-authored-by: Vignesh S <svignesh0308@gmail.com> * fix(Distributed Cost Center): budget variance, general ledger, profitability analysis reports. * Merge branch 'develop' into develop-distributed-cost-center * fix(Distributed Cost Center): Added DCC reflection in actual amount column of Budget Variance Report. * Update creation field in general ledger report Co-authored-by: Nabin Hait <nabinhait@gmail.com> * creation field updated in gl_entries query Co-authored-by: Nabin Hait <nabinhait@gmail.com> Co-authored-by: KaviyaPeriyasamy <kaviya.3111999@gmail.com> Co-authored-by: Vignesh S <svignesh0308@gmail.com> Co-authored-by: KaviyaPeriyasamy <kaviyaperiyasamy22@gmail.com> Co-authored-by: Kaviya Periyasamy <36359901+KaviyaPeriyasamy@users.noreply.github.com> Co-authored-by: Nabin Hait <nabinhait@gmail.com>
2020-06-08 06:50:21 +00:00
remarks, against, is_opening, creation {select_fields}
2013-12-26 05:37:58 +00:00
from `tabGL Entry`
where company=%(company)s {conditions}
{order_by_statement}
""".format(
dimension_fields=dimension_fields,
select_fields=select_fields,
conditions=get_conditions(filters),
order_by_statement=order_by_statement,
),
filters,
as_dict=1,
)
if filters.get("presentation_currency"):
return convert_to_presentation_currency(gl_entries, currency_map)
else:
return gl_entries
2014-05-20 09:37:18 +00:00
2013-12-26 05:37:58 +00:00
def get_conditions(filters):
conditions = []
if filters.get("account"):
filters.account = get_accounts_with_children(filters.account)
conditions.append("account in %(account)s")
2014-05-20 09:37:18 +00:00
if filters.get("cost_center"):
filters.cost_center = get_cost_centers_with_children(filters.cost_center)
conditions.append("cost_center in %(cost_center)s")
2013-12-26 05:37:58 +00:00
if filters.get("voucher_no"):
conditions.append("voucher_no=%(voucher_no)s")
2014-05-20 09:37:18 +00:00
if filters.get("group_by") == "Group by Party" and not filters.get("party_type"):
conditions.append("party_type in ('Customer', 'Supplier')")
if filters.get("party_type"):
conditions.append("party_type=%(party_type)s")
if filters.get("party"):
conditions.append("party in %(party)s")
2015-09-28 08:01:17 +00:00
if not (
filters.get("account")
or filters.get("party")
or filters.get("group_by") in ["Group by Account", "Group by Party"]
):
conditions.append("(posting_date >=%(from_date)s or is_opening = 'Yes')")
conditions.append("(posting_date <=%(to_date)s or is_opening = 'Yes')")
2014-05-20 09:37:18 +00:00
if filters.get("project"):
conditions.append("project in %(project)s")
if filters.get("include_default_book_entries"):
if filters.get("finance_book"):
if filters.get("company_fb") and cstr(filters.get("finance_book")) != cstr(
filters.get("company_fb")
):
frappe.throw(
_("To use a different finance book, please uncheck 'Include Default Book Entries'")
)
else:
conditions.append("(finance_book in (%(finance_book)s, '') OR finance_book IS NULL)")
else:
conditions.append("(finance_book in (%(company_fb)s, '') OR finance_book IS NULL)")
else:
if filters.get("finance_book"):
conditions.append("(finance_book in (%(finance_book)s, '') OR finance_book IS NULL)")
else:
conditions.append("(finance_book in ('') OR finance_book IS NULL)")
feat: Immutable ledger (#18740) * fix: Reverse GL entry on cancellation of document * fix: Removed set posting time field for multiple docs * fix: Stop future reposting and reverse entry for purchase receipt and delivery note * fix: Change is_cancelled field from select to check * Revert "fix: Removed set posting time field for multiple docs" This reverts commit 81fb808db7da69ab1e58ba226c0cd0b77e5b90c8. * fix: Multiple fixes in GL Entry * fix: Remove future reporting from doctypes * fix: Canceled entry filters in Stock Ledger and General Ledger Report * fix: Remove print statement * fix: Validation for back dated entries * fix: Codacy fixes * fix: Add ignore links to multiple doctypes * fix: Codacy Fixes * fix: Ignore GL Entry and Stock Ledger entry while cancel * fix: Test case fixes * fix: Patch * fix: Codacy * fix: Budget Test Cases * fix: Patch * fix: Patch * fix: Multiple test cases * fix: changes in make_reverse_entry function * fix: Update patch * fix: Test Cases * fix: Test Case fixes * fix: Move patch upward in patches.txt * fix: Budget Test Cases * fix: Test Case and codacy * fix: Patch * fix: Minor label and UX fixes * fix: Move freezing date check * fix: Test Cases * fix: Test cases * fix: Test Cases * fix: Test Case * fix: Remove update_gl_entries_after function * fix: Remove update_gl_entries_after function * fix: Test Cases * fix: Fiscal Year wise backdated entry * fix: Update entries only for current SLE * fix: Remove is_cancelled * fix: Test Cases * fix: Test cases * fix: Test Cases * fix: Uncomment account and stock balance sync logic * fix: Stock balance and Account balance out of sync fixes * fix: Test Cases * fix: Test cases for POS, Stock Reco and Purchase Receipt * fix: Stock Reco tests * fix: Test stock reco precision * fix: Test stock reco for fifo precision * fix: Test stock reco for fifo precision * fix: Stock Entry test case Co-authored-by: Nabin Hait <nabinhait@gmail.com>
2020-04-30 05:08:58 +00:00
if not filters.get("show_cancelled_entries"):
conditions.append("is_cancelled = 0")
2014-09-09 10:45:35 +00:00
from frappe.desk.reportview import build_match_conditions
2022-03-28 13:22:46 +00:00
match_conditions = build_match_conditions("GL Entry")
if match_conditions:
conditions.append(match_conditions)
2014-05-20 09:37:18 +00:00
2021-03-09 15:01:57 +00:00
if filters.get("include_dimensions"):
accounting_dimensions = get_accounting_dimensions(as_list=False)
if accounting_dimensions:
for dimension in accounting_dimensions:
if not dimension.disabled:
if filters.get(dimension.fieldname):
if frappe.get_cached_value("DocType", dimension.document_type, "is_tree"):
filters[dimension.fieldname] = get_dimension_with_children(
dimension.document_type, filters.get(dimension.fieldname)
2022-03-28 13:22:46 +00:00
)
2021-03-09 15:01:57 +00:00
conditions.append("{0} in %({0})s".format(dimension.fieldname))
else:
conditions.append("{0} in %({0})s".format(dimension.fieldname))
2013-12-26 05:37:58 +00:00
return "and {}".format(" and ".join(conditions)) if conditions else ""
2022-03-28 13:22:46 +00:00
def get_accounts_with_children(accounts):
if not isinstance(accounts, list):
accounts = [d.strip() for d in accounts.strip().split(",") if d]
all_accounts = []
for d in accounts:
account = frappe.get_cached_doc("Account", d)
if account:
children = frappe.get_all(
"Account", filters={"lft": [">=", account.lft], "rgt": ["<=", account.rgt]}
)
all_accounts += [c.name for c in children]
else:
frappe.throw(_("Account: {0} does not exist").format(d))
return list(set(all_accounts))
2022-03-28 13:22:46 +00:00
def get_data_with_opening_closing(filters, account_details, accounting_dimensions, gl_entries):
2013-12-26 05:37:58 +00:00
data = []
gle_map = initialize_gle_map(gl_entries, filters)
2014-05-20 09:37:18 +00:00
totals, entries = get_accountwise_gle(filters, accounting_dimensions, gl_entries, gle_map)
2014-05-20 09:37:18 +00:00
# Opening for filtered account
data.append(totals.opening)
if filters.get("group_by") != "Group by Voucher (Consolidated)":
for acc, acc_dict in gle_map.items():
# acc
2015-09-24 09:33:53 +00:00
if acc_dict.entries:
# opening
data.append({})
if filters.get("group_by") != "Group by Voucher":
data.append(acc_dict.totals.opening)
2015-09-24 09:33:53 +00:00
data += acc_dict.entries
# totals
data.append(acc_dict.totals.total)
2015-09-24 09:33:53 +00:00
# closing
if filters.get("group_by") != "Group by Voucher":
data.append(acc_dict.totals.closing)
data.append({})
2015-09-24 09:33:53 +00:00
else:
data += entries
# totals
data.append(totals.total)
# closing
data.append(totals.closing)
2014-05-20 09:37:18 +00:00
2013-12-26 05:37:58 +00:00
return data
2022-03-28 13:22:46 +00:00
def get_totals_dict():
def _get_debit_credit_dict(label):
return _dict(
account="'{0}'".format(label),
debit=0.0,
credit=0.0,
debit_in_account_currency=0.0,
credit_in_account_currency=0.0,
)
2022-03-28 13:22:46 +00:00
return _dict(
opening=_get_debit_credit_dict(TRANSLATIONS.OPENING),
total=_get_debit_credit_dict(TRANSLATIONS.TOTAL),
closing=_get_debit_credit_dict(TRANSLATIONS.CLOSING_TOTAL),
)
2022-03-28 13:22:46 +00:00
def group_by_field(group_by):
if group_by == "Group by Party":
return "party"
elif group_by in ["Group by Voucher (Consolidated)", "Group by Account"]:
return "account"
else:
return "voucher_no"
2022-03-28 13:22:46 +00:00
def initialize_gle_map(gl_entries, filters):
2019-06-21 11:50:37 +00:00
gle_map = OrderedDict()
group_by = group_by_field(filters.get("group_by"))
for gle in gl_entries:
gle_map.setdefault(gle.get(group_by), _dict(totals=get_totals_dict(), entries=[]))
return gle_map
def get_accountwise_gle(filters, accounting_dimensions, gl_entries, gle_map):
totals = get_totals_dict()
entries = []
consolidated_gle = OrderedDict()
group_by = group_by_field(filters.get("group_by"))
group_by_voucher_consolidated = filters.get("group_by") == "Group by Voucher (Consolidated)"
2015-09-28 08:01:17 +00:00
if filters.get("show_net_values_in_party_account"):
account_type_map = get_account_type_map(filters.get("company"))
def update_value_in_dict(data, key, gle):
data[key].debit += gle.debit
data[key].credit += gle.credit
2015-09-28 08:01:17 +00:00
data[key].debit_in_account_currency += gle.debit_in_account_currency
data[key].credit_in_account_currency += gle.credit_in_account_currency
2015-09-28 08:01:17 +00:00
if filters.get("show_net_values_in_party_account") and account_type_map.get(
data[key].account
) in ("Receivable", "Payable"):
net_value = data[key].debit - data[key].credit
net_value_in_account_currency = (
data[key].debit_in_account_currency - data[key].credit_in_account_currency
2022-03-28 13:22:46 +00:00
)
if net_value < 0:
dr_or_cr = "credit"
rev_dr_or_cr = "debit"
else:
dr_or_cr = "debit"
rev_dr_or_cr = "credit"
data[key][dr_or_cr] = abs(net_value)
data[key][dr_or_cr + "_in_account_currency"] = abs(net_value_in_account_currency)
data[key][rev_dr_or_cr] = 0
data[key][rev_dr_or_cr + "_in_account_currency"] = 0
2020-05-19 15:21:30 +00:00
if data[key].against_voucher and gle.against_voucher:
data[key].against_voucher += ", " + gle.against_voucher
from_date, to_date = getdate(filters.from_date), getdate(filters.to_date)
show_opening_entries = filters.get("show_opening_entries")
for gle in gl_entries:
group_by_value = gle.get(group_by)
if gle.posting_date < from_date or (cstr(gle.is_opening) == "Yes" and not show_opening_entries):
if not group_by_voucher_consolidated:
update_value_in_dict(gle_map[group_by_value].totals, "opening", gle)
update_value_in_dict(gle_map[group_by_value].totals, "closing", gle)
update_value_in_dict(totals, "opening", gle)
update_value_in_dict(totals, "closing", gle)
2015-09-28 08:01:17 +00:00
elif gle.posting_date <= to_date or (cstr(gle.is_opening) == "Yes" and show_opening_entries):
if not group_by_voucher_consolidated:
update_value_in_dict(gle_map[group_by_value].totals, "total", gle)
update_value_in_dict(gle_map[group_by_value].totals, "closing", gle)
update_value_in_dict(totals, "total", gle)
update_value_in_dict(totals, "closing", gle)
gle_map[group_by_value].entries.append(gle)
elif group_by_voucher_consolidated:
keylist = [
gle.get("voucher_type"),
gle.get("voucher_no"),
gle.get("account"),
gle.get("party_type"),
gle.get("party"),
]
if filters.get("include_dimensions"):
for dim in accounting_dimensions:
keylist.append(gle.get(dim))
keylist.append(gle.get("cost_center"))
key = tuple(keylist)
if key not in consolidated_gle:
consolidated_gle.setdefault(key, gle)
else:
update_value_in_dict(consolidated_gle, key, gle)
2015-09-28 08:01:17 +00:00
for key, value in consolidated_gle.items():
update_value_in_dict(totals, "total", value)
update_value_in_dict(totals, "closing", value)
entries.append(value)
return totals, entries
2014-05-20 09:37:18 +00:00
2022-03-28 13:22:46 +00:00
def get_account_type_map(company):
account_type_map = frappe._dict(
frappe.get_all(
"Account", fields=["name", "account_type"], filters={"company": company}, as_list=1
)
2022-03-28 13:22:46 +00:00
)
return account_type_map
2022-03-28 13:22:46 +00:00
def get_result_as_list(data, filters):
balance, balance_in_account_currency = 0, 0
inv_details = get_supplier_invoice_details()
for d in data:
2018-01-19 13:36:39 +00:00
if not d.get("posting_date"):
balance, balance_in_account_currency = 0, 0
balance = get_balance(d, balance, "debit", "credit")
d["balance"] = balance
2015-09-28 08:01:17 +00:00
d["account_currency"] = filters.account_currency
2018-01-19 13:36:39 +00:00
d["bill_no"] = inv_details.get(d.get("against_voucher"), "")
2015-09-28 08:01:17 +00:00
return data
2014-05-20 09:37:18 +00:00
2022-03-28 13:22:46 +00:00
def get_supplier_invoice_details():
inv_details = {}
for d in frappe.db.sql(
""" select name, bill_no from `tabPurchase Invoice`
where docstatus = 1 and bill_no is not null and bill_no != '' """,
as_dict=1,
):
inv_details[d.name] = d.bill_no
return inv_details
2022-03-28 13:22:46 +00:00
def get_balance(row, balance, debit_field, credit_field):
balance += row.get(debit_field, 0) - row.get(credit_field, 0)
return balance
2022-03-28 13:22:46 +00:00
def get_columns(filters):
if filters.get("presentation_currency"):
currency = filters["presentation_currency"]
else:
if filters.get("company"):
currency = get_company_currency(filters["company"])
else:
company = get_default_company()
currency = get_company_currency(company)
columns = [
{
2020-04-17 14:22:47 +00:00
"label": _("GL Entry"),
"fieldname": "gl_entry",
"fieldtype": "Link",
"options": "GL Entry",
"hidden": 1,
},
{"label": _("Posting Date"), "fieldname": "posting_date", "fieldtype": "Date", "width": 100},
{
"label": _("Account"),
"fieldname": "account",
"fieldtype": "Link",
"options": "Account",
"width": 180,
},
{
2020-01-29 09:36:18 +00:00
"label": _("Debit ({0})").format(currency),
"fieldname": "debit",
"fieldtype": "Float",
"width": 130,
},
{
2020-01-29 09:36:18 +00:00
"label": _("Credit ({0})").format(currency),
"fieldname": "credit",
"fieldtype": "Float",
"width": 130,
},
{
2020-01-29 09:36:18 +00:00
"label": _("Balance ({0})").format(currency),
"fieldname": "balance",
"fieldtype": "Float",
"width": 130,
},
{"label": _("Voucher Type"), "fieldname": "voucher_type", "width": 120},
{
"label": _("Voucher No"),
"fieldname": "voucher_no",
"fieldtype": "Dynamic Link",
"options": "voucher_type",
"width": 180,
},
{"label": _("Against Account"), "fieldname": "against", "width": 120},
{"label": _("Party Type"), "fieldname": "party_type", "width": 100},
{"label": _("Party"), "fieldname": "party", "width": 100},
{"label": _("Project"), "options": "Project", "fieldname": "project", "width": 100},
2022-01-09 13:11:33 +00:00
]
if filters.get("include_dimensions"):
for dim in get_accounting_dimensions(as_list=False):
columns.append(
{"label": _(dim.label), "options": dim.label, "fieldname": dim.fieldname, "width": 100}
)
columns.append(
{"label": _("Cost Center"), "options": "Cost Center", "fieldname": "cost_center", "width": 100}
)
2022-03-28 13:22:46 +00:00
columns.extend(
[
{"label": _("Against Voucher Type"), "fieldname": "against_voucher_type", "width": 100},
{
"label": _("Against Voucher"),
"fieldname": "against_voucher",
"fieldtype": "Dynamic Link",
"options": "against_voucher_type",
"width": 100,
},
{"label": _("Supplier Invoice No"), "fieldname": "bill_no", "fieldtype": "Data", "width": 100},
{"label": _("Remarks"), "fieldname": "remarks", "width": 400},
]
)
return columns