Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diamoerp staging #884

Merged
merged 2 commits into from
Oct 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading