mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 07:54:46 +00:00
refactor: add substring logic in ar/ap report
(cherry picked from commit a9bf906545)
This commit is contained in:
@@ -7,7 +7,7 @@ from collections import OrderedDict
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe import _, qb, scrub
|
from frappe import _, qb, scrub
|
||||||
from frappe.query_builder import Criterion
|
from frappe.query_builder import Criterion
|
||||||
from frappe.query_builder.functions import Date, Sum
|
from frappe.query_builder.functions import Date, Substring, Sum
|
||||||
from frappe.utils import cint, cstr, flt, getdate, nowdate
|
from frappe.utils import cint, cstr, flt, getdate, nowdate
|
||||||
|
|
||||||
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
|
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
|
||||||
@@ -760,7 +760,12 @@ class ReceivablePayableReport(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if self.filters.get("show_remarks"):
|
if self.filters.get("show_remarks"):
|
||||||
query = query.select(ple.remarks)
|
if remarks_length := frappe.db.get_single_value(
|
||||||
|
"Accounts Settings", "receivable_payable_remarks_length"
|
||||||
|
):
|
||||||
|
query = query.select(Substring(ple.remarks, 1, remarks_length).as_("remarks"))
|
||||||
|
else:
|
||||||
|
query = query.select(ple.remarks)
|
||||||
|
|
||||||
if self.filters.get("group_by_party"):
|
if self.filters.get("group_by_party"):
|
||||||
query = query.orderby(self.ple.party, self.ple.posting_date)
|
query = query.orderby(self.ple.party, self.ple.posting_date)
|
||||||
|
|||||||
Reference in New Issue
Block a user