fix: validate party filter for fetching payments
This commit is contained in:
parent
d5aa0e325e
commit
7650b0073a
@ -29,6 +29,8 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
||||
include_payments = filters.get("include_payments")
|
||||
invoice_list = get_invoices(filters, additional_query_columns)
|
||||
if filters.get("include_payments"):
|
||||
if not filters.get("supplier"):
|
||||
frappe.throw(_("Please select a supplier for fetching payments."))
|
||||
invoice_list += get_payments(filters, additional_query_columns)
|
||||
columns, expense_accounts, tax_accounts, unrealized_profit_loss_accounts = get_columns(
|
||||
invoice_list, additional_table_columns, include_payments
|
||||
@ -291,7 +293,6 @@ def get_payments(filters, additional_query_columns):
|
||||
party="supplier",
|
||||
party_name="supplier_name",
|
||||
additional_query_columns="" if not additional_query_columns else additional_query_columns,
|
||||
party_type="Supplier",
|
||||
conditions=conditions,
|
||||
)
|
||||
payment_entries = get_payment_entries(filters, args)
|
||||
|
@ -30,6 +30,8 @@ def _execute(filters, additional_table_columns=None, additional_query_columns=No
|
||||
include_payments = filters.get("include_payments")
|
||||
invoice_list = get_invoices(filters, additional_query_columns)
|
||||
if filters.get("include_payments"):
|
||||
if not filters.get("customer"):
|
||||
frappe.throw(_("Please select a customer for fetching payments."))
|
||||
invoice_list += get_payments(filters, additional_query_columns)
|
||||
columns, income_accounts, tax_accounts, unrealized_profit_loss_accounts = get_columns(
|
||||
invoice_list, additional_table_columns, include_payments
|
||||
@ -451,7 +453,6 @@ def get_payments(filters, additional_query_columns):
|
||||
party="customer",
|
||||
party_name="customer_name",
|
||||
additional_query_columns="" if not additional_query_columns else additional_query_columns,
|
||||
party_type="Customer",
|
||||
conditions=conditions,
|
||||
)
|
||||
payment_entries = get_payment_entries(filters, args)
|
||||
|
@ -199,13 +199,13 @@ def get_journal_entries(filters, args):
|
||||
je.bill_no, je.bill_date, je.remark, je.total_amount as base_net_total,
|
||||
je.total_amount as base_grand_total, je.mode_of_payment, jea.project {3}
|
||||
from `tabJournal Entry` je left join `tabJournal Entry Account` jea on jea.parent=je.name
|
||||
where je.voucher_type='Journal Entry' and jea.party_type='{4}' {5}
|
||||
where je.voucher_type='Journal Entry' and jea.party='{4}' {5}
|
||||
order by je.posting_date desc, je.name desc""".format(
|
||||
args.account,
|
||||
args.party,
|
||||
args.party_name,
|
||||
args.additional_query_columns,
|
||||
args.party_type,
|
||||
filters.get(args.party),
|
||||
args.conditions,
|
||||
),
|
||||
filters,
|
||||
@ -221,13 +221,13 @@ def get_payment_entries(filters, args):
|
||||
paid_amount as base_net_total, paid_amount_after_tax as base_grand_total,
|
||||
mode_of_payment, project, cost_center {3}
|
||||
from `tabPayment Entry`
|
||||
where party_type='{4}' {5}
|
||||
where party='{4}' {5}
|
||||
order by posting_date desc, name desc""".format(
|
||||
args.account,
|
||||
args.party,
|
||||
args.party_name,
|
||||
args.additional_query_columns,
|
||||
args.party_type,
|
||||
filters.get(args.party),
|
||||
args.conditions,
|
||||
),
|
||||
filters,
|
||||
|
Loading…
Reference in New Issue
Block a user