fix: make party type filter mandatory
This commit is contained in:
parent
ec80dc6f09
commit
38b501e004
@ -15,7 +15,11 @@ frappe.query_reports["TDS Payable Monthly"] = {
|
|||||||
"fieldname":"party_type",
|
"fieldname":"party_type",
|
||||||
"label": __("Party Type"),
|
"label": __("Party Type"),
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"options": ["Supplier", "Customer"]
|
"options": ["Supplier", "Customer"],
|
||||||
|
"reqd": 1,
|
||||||
|
"on_change": function(){
|
||||||
|
frappe.query_report.set_filter_value("party", "");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname":"party",
|
"fieldname":"party",
|
||||||
|
|||||||
@ -33,7 +33,7 @@ def validate_filters(filters):
|
|||||||
def get_result(
|
def get_result(
|
||||||
filters, tds_docs, tds_accounts, tax_category_map, journal_entry_party_map, invoice_net_total_map
|
filters, tds_docs, tds_accounts, tax_category_map, journal_entry_party_map, invoice_net_total_map
|
||||||
):
|
):
|
||||||
party_map = get_party_pan_map()
|
party_map = get_party_pan_map(filters.get("party_type"))
|
||||||
tax_rate_map = get_tax_rate_map(filters)
|
tax_rate_map = get_tax_rate_map(filters)
|
||||||
gle_map = get_gle_map(tds_docs)
|
gle_map = get_gle_map(tds_docs)
|
||||||
|
|
||||||
@ -103,23 +103,23 @@ def get_result(
|
|||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
def get_party_pan_map():
|
def get_party_pan_map(party_type):
|
||||||
party_map = frappe._dict()
|
party_map = frappe._dict()
|
||||||
fields = ["name", "supplier_type", "supplier_name", "tax_withholding_category"]
|
|
||||||
if frappe.db.has_column("Supplier", "pan"):
|
|
||||||
fields.append("pan")
|
|
||||||
suppliers = frappe.db.get_all("Supplier", fields=fields)
|
|
||||||
|
|
||||||
fields = ["name", "customer_type", "customer_name", "tax_withholding_category"]
|
fields = ["name", "tax_withholding_category"]
|
||||||
if frappe.db.has_column("Customer", "pan"):
|
if party_type == "Supplier":
|
||||||
|
fields += ["supplier_type", "supplier_name"]
|
||||||
|
else:
|
||||||
|
fields += ["customer_type", "customer_name"]
|
||||||
|
|
||||||
|
if frappe.db.has_column(party_type, "pan"):
|
||||||
fields.append("pan")
|
fields.append("pan")
|
||||||
customers = frappe.db.get_all("Customer", fields=fields)
|
|
||||||
for d in suppliers:
|
party_details = frappe.db.get_all(party_type, fields=fields)
|
||||||
d.party_type = "Supplier"
|
|
||||||
party_map[d.name] = d
|
for party in party_details:
|
||||||
for d in customers:
|
party.party_type = party_type
|
||||||
d.party_type = "Customer"
|
party_map[party.name] = party
|
||||||
party_map[d.name] = d
|
|
||||||
|
|
||||||
return party_map
|
return party_map
|
||||||
|
|
||||||
@ -233,6 +233,9 @@ def get_tds_docs(filters):
|
|||||||
"against": ("not in", bank_accounts),
|
"against": ("not in", bank_accounts),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
party = frappe.get_all(filters.get("party_type"), pluck="name")
|
||||||
|
query_filters.update({"against": ("in", party)})
|
||||||
|
|
||||||
if filters.get("party"):
|
if filters.get("party"):
|
||||||
del query_filters["account"]
|
del query_filters["account"]
|
||||||
del query_filters["against"]
|
del query_filters["against"]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user