Skip to content

Commit

Permalink
refactor: provision to set remarks length in accounts settings
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthra-kumar committed Nov 18, 2023
1 parent a5a5341 commit ed67a85
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
38 changes: 36 additions & 2 deletions erpnext/accounts/doctype/accounts_settings/accounts_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@
"show_balance_in_coa",
"banking_tab",
"enable_party_matching",
"enable_fuzzy_matching"
"enable_fuzzy_matching",
"reports_tab",
"general_ledger_section",
"general_ledger_remarks_length",
"accounts_receivable_payable_section",
"receivable_payable_remarks_length"
],
"fields": [
{
Expand Down Expand Up @@ -422,14 +427,43 @@
"fieldname": "round_row_wise_tax",
"fieldtype": "Check",
"label": "Round Tax Amount Row-wise"
},
{
"fieldname": "reports_tab",
"fieldtype": "Tab Break",
"label": "Reports"
},
{
"fieldname": "general_ledger_section",
"fieldtype": "Section Break",
"label": "General Ledger"
},
{
"default": "0",
"description": "Truncates 'Remarks' column to set character length",
"fieldname": "general_ledger_remarks_length",
"fieldtype": "Int",
"label": "Remarks Length"
},
{
"default": "0",
"description": "Truncates 'Remarks' column to set character length",
"fieldname": "receivable_payable_remarks_length",
"fieldtype": "Int",
"label": "Remarks Length"
},
{
"fieldname": "accounts_receivable_payable_section",
"fieldtype": "Section Break",
"label": "Accounts Receivable/Payable"
}
],
"icon": "icon-cog",
"idx": 1,
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2023-08-28 00:12:02.740633",
"modified": "2023-11-18 10:30:00.001071",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Accounts Settings",
Expand Down
7 changes: 6 additions & 1 deletion erpnext/accounts/report/general_ledger/general_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,12 @@ def get_gl_entries(filters, accounting_dimensions):
credit_in_account_currency """

if filters.get("show_remarks"):
select_fields += """,remarks"""
if remarks_length := frappe.db.get_single_value(
"Accounts Settings", "general_ledger_remarks_length"
):
select_fields += f",substr(remarks, 1, {remarks_length}) as 'remarks'"
else:
select_fields += """,remarks"""

order_by_statement = "order by posting_date, account, creation"

Expand Down

0 comments on commit ed67a85

Please sign in to comment.