Skip to content

Commit

Permalink
fix: family in report; (#882)
Browse files Browse the repository at this point in the history
  • Loading branch information
fproldan authored Oct 7, 2024
1 parent 5dd40d8 commit 40d2172
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions erpnext/accounts/report/accounts_receivable/accounts_receivable.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,19 +698,38 @@ def get_gl_entries(self):

remarks = ", remarks" if self.filters.get("show_remarks") else ""

self.gl_entries = frappe.db.sql("""
if self.filters.get('group_by_family'):
self.gl_entries = frappe.db.sql("""
select
name, posting_date, account, party_type, party, voucher_type, voucher_no, cost_center,
against_voucher_type, against_voucher, account_currency, {0}, {1} {remarks}
gl.name, posting_date, account, party_type, party, voucher_type, voucher_no, cost_center,
against_voucher_type, against_voucher, account_currency, c.familia, {0}, {1} {remarks}
from
`tabGL Entry`
`tabGL Entry` AS gl
JOIN
`tabCustomer` AS c on c.name = party
where
docstatus < 2
gl.docstatus < 2
and is_cancelled = 0
and party_type=%s
and (party is not null and party != '')
{2} {3} {4}"""
.format(select_fields, doc_currency_fields, date_condition, conditions, order_by, remarks=remarks), values, as_dict=True)

else:
self.gl_entries = frappe.db.sql("""
select
name, posting_date, account, party_type, party, voucher_type, voucher_no, cost_center,
against_voucher_type, against_voucher, account_currency, {0}, {1} {remarks}
from
`tabGL Entry`
where
docstatus < 2
and is_cancelled = 0
and party_type=%s
and (party is not null and party != '')
{2} {3} {4}"""
.format(select_fields, doc_currency_fields, date_condition, conditions, order_by, remarks=remarks), values, as_dict=True)


def get_sales_invoices_or_customers_based_on_sales_person(self):
if self.filters.get("sales_person"):
Expand Down Expand Up @@ -758,7 +777,7 @@ def get_order_by_condition(self):
if self.filters.get('group_by_party'):
return "order by party, posting_date"
elif self.filters.get('group_by_family'):
return "order by party, posting_date"
return "order by familia, party, posting_date"
else:
return "order by posting_date, party"

Expand Down

0 comments on commit 40d2172

Please sign in to comment.