fix: show additional table cols from india compliance api call
This commit is contained in:
parent
c084fe6b3f
commit
0d89bfacdb
@ -35,7 +35,7 @@ def _execute(filters=None, additional_table_columns=None):
|
|||||||
frappe.throw(_("Please select a supplier for fetching payments."))
|
frappe.throw(_("Please select a supplier for fetching payments."))
|
||||||
invoice_list = get_invoices(filters, get_query_columns(additional_table_columns))
|
invoice_list = get_invoices(filters, get_query_columns(additional_table_columns))
|
||||||
if filters.get("include_payments"):
|
if filters.get("include_payments"):
|
||||||
invoice_list += get_payments(filters, additional_table_columns)
|
invoice_list += get_payments(filters)
|
||||||
|
|
||||||
columns, expense_accounts, tax_accounts, unrealized_profit_loss_accounts = get_columns(
|
columns, expense_accounts, tax_accounts, unrealized_profit_loss_accounts = get_columns(
|
||||||
invoice_list, additional_table_columns, include_payments
|
invoice_list, additional_table_columns, include_payments
|
||||||
@ -156,7 +156,7 @@ def get_columns(invoice_list, additional_table_columns, include_payments=False):
|
|||||||
_("Supplier Name") + "::120",
|
_("Supplier Name") + "::120",
|
||||||
]
|
]
|
||||||
|
|
||||||
if additional_table_columns:
|
if additional_table_columns and not include_payments:
|
||||||
columns += additional_table_columns
|
columns += additional_table_columns
|
||||||
|
|
||||||
if not include_payments:
|
if not include_payments:
|
||||||
@ -279,6 +279,9 @@ def get_invoices(filters, additional_query_columns):
|
|||||||
.where((pi.docstatus == 1))
|
.where((pi.docstatus == 1))
|
||||||
.orderby(pi.posting_date, pi.name, order=Order.desc)
|
.orderby(pi.posting_date, pi.name, order=Order.desc)
|
||||||
)
|
)
|
||||||
|
if additional_query_columns:
|
||||||
|
for col in additional_query_columns:
|
||||||
|
query = query.select(col)
|
||||||
if filters.get("supplier"):
|
if filters.get("supplier"):
|
||||||
query = query.where(pi.supplier == filters.supplier)
|
query = query.where(pi.supplier == filters.supplier)
|
||||||
query = get_conditions(filters, query, [pi, invoice_item])
|
query = get_conditions(filters, query, [pi, invoice_item])
|
||||||
@ -291,10 +294,7 @@ def get_invoices(filters, additional_query_columns):
|
|||||||
return invoices
|
return invoices
|
||||||
|
|
||||||
|
|
||||||
def get_payments(filters, additional_query_columns):
|
def get_payments(filters):
|
||||||
if additional_query_columns:
|
|
||||||
additional_query_columns = ", " + ", ".join(additional_query_columns)
|
|
||||||
|
|
||||||
args = frappe._dict(
|
args = frappe._dict(
|
||||||
account="credit_to",
|
account="credit_to",
|
||||||
party="supplier",
|
party="supplier",
|
||||||
@ -302,7 +302,6 @@ def get_payments(filters, additional_query_columns):
|
|||||||
party_account=get_party_account(
|
party_account=get_party_account(
|
||||||
"Supplier", filters.supplier, filters.company, include_advance=True
|
"Supplier", filters.supplier, filters.company, include_advance=True
|
||||||
),
|
),
|
||||||
additional_query_columns="" if not additional_query_columns else additional_query_columns,
|
|
||||||
)
|
)
|
||||||
payment_entries = get_payment_entries(filters, args)
|
payment_entries = get_payment_entries(filters, args)
|
||||||
journal_entries = get_journal_entries(filters, args)
|
journal_entries = get_journal_entries(filters, args)
|
||||||
|
@ -36,7 +36,7 @@ def _execute(filters, additional_table_columns=None):
|
|||||||
frappe.throw(_("Please select a customer for fetching payments."))
|
frappe.throw(_("Please select a customer for fetching payments."))
|
||||||
invoice_list = get_invoices(filters, get_query_columns(additional_table_columns))
|
invoice_list = get_invoices(filters, get_query_columns(additional_table_columns))
|
||||||
if filters.get("include_payments"):
|
if filters.get("include_payments"):
|
||||||
invoice_list += get_payments(filters, additional_table_columns)
|
invoice_list += get_payments(filters)
|
||||||
|
|
||||||
columns, income_accounts, tax_accounts, unrealized_profit_loss_accounts = get_columns(
|
columns, income_accounts, tax_accounts, unrealized_profit_loss_accounts = get_columns(
|
||||||
invoice_list, additional_table_columns, include_payments
|
invoice_list, additional_table_columns, include_payments
|
||||||
@ -187,7 +187,7 @@ def get_columns(invoice_list, additional_table_columns, include_payments=False):
|
|||||||
{"label": _("Customer Name"), "fieldname": "customer_name", "fieldtype": "Data", "width": 120},
|
{"label": _("Customer Name"), "fieldname": "customer_name", "fieldtype": "Data", "width": 120},
|
||||||
]
|
]
|
||||||
|
|
||||||
if additional_table_columns:
|
if additional_table_columns and not include_payments:
|
||||||
columns += additional_table_columns
|
columns += additional_table_columns
|
||||||
|
|
||||||
if not include_payments:
|
if not include_payments:
|
||||||
@ -437,6 +437,9 @@ def get_invoices(filters, additional_query_columns):
|
|||||||
.where((si.docstatus == 1))
|
.where((si.docstatus == 1))
|
||||||
.orderby(si.posting_date, si.name, order=Order.desc)
|
.orderby(si.posting_date, si.name, order=Order.desc)
|
||||||
)
|
)
|
||||||
|
if additional_query_columns:
|
||||||
|
for col in additional_query_columns:
|
||||||
|
query = query.select(col)
|
||||||
if filters.get("customer"):
|
if filters.get("customer"):
|
||||||
query = query.where(si.customer == filters.customer)
|
query = query.where(si.customer == filters.customer)
|
||||||
query = get_conditions(filters, query, [si, invoice_item, invoice_payment])
|
query = get_conditions(filters, query, [si, invoice_item, invoice_payment])
|
||||||
@ -444,10 +447,7 @@ def get_invoices(filters, additional_query_columns):
|
|||||||
return invoices
|
return invoices
|
||||||
|
|
||||||
|
|
||||||
def get_payments(filters, additional_query_columns):
|
def get_payments(filters):
|
||||||
if additional_query_columns:
|
|
||||||
additional_query_columns = ", " + ", ".join(additional_query_columns)
|
|
||||||
|
|
||||||
args = frappe._dict(
|
args = frappe._dict(
|
||||||
account="debit_to",
|
account="debit_to",
|
||||||
party="customer",
|
party="customer",
|
||||||
@ -455,7 +455,6 @@ def get_payments(filters, additional_query_columns):
|
|||||||
party_account=get_party_account(
|
party_account=get_party_account(
|
||||||
"Customer", filters.customer, filters.company, include_advance=True
|
"Customer", filters.customer, filters.company, include_advance=True
|
||||||
),
|
),
|
||||||
additional_query_columns="" if not additional_query_columns else additional_query_columns,
|
|
||||||
)
|
)
|
||||||
payment_entries = get_payment_entries(filters, args)
|
payment_entries = get_payment_entries(filters, args)
|
||||||
journal_entries = get_journal_entries(filters, args)
|
journal_entries = get_journal_entries(filters, args)
|
||||||
|
@ -173,7 +173,7 @@ def get_query_columns(report_columns):
|
|||||||
else:
|
else:
|
||||||
columns.append(fieldname)
|
columns.append(fieldname)
|
||||||
|
|
||||||
return ", " + ", ".join(columns)
|
return columns
|
||||||
|
|
||||||
|
|
||||||
def get_values_for_columns(report_columns, report_row):
|
def get_values_for_columns(report_columns, report_row):
|
||||||
|
Loading…
Reference in New Issue
Block a user