fix: fix filters for the report (#24594)
This commit is contained in:
parent
8609d31430
commit
e3c72a3d71
@ -32,6 +32,10 @@ def execute(filters=None):
|
|||||||
|
|
||||||
data = []
|
data = []
|
||||||
columns = get_columns()
|
columns = get_columns()
|
||||||
|
conditions = ""
|
||||||
|
if filters.supplier_group:
|
||||||
|
conditions += "AND s.supplier_group = %s" %frappe.db.escape(filters.get("supplier_group"))
|
||||||
|
|
||||||
data = frappe.db.sql("""
|
data = frappe.db.sql("""
|
||||||
SELECT
|
SELECT
|
||||||
s.supplier_group as "supplier_group",
|
s.supplier_group as "supplier_group",
|
||||||
@ -46,13 +50,15 @@ def execute(filters=None):
|
|||||||
AND s.irs_1099 = 1
|
AND s.irs_1099 = 1
|
||||||
AND gl.fiscal_year = %(fiscal_year)s
|
AND gl.fiscal_year = %(fiscal_year)s
|
||||||
AND gl.party_type = "Supplier"
|
AND gl.party_type = "Supplier"
|
||||||
|
AND gl.company = %(company)s
|
||||||
|
{conditions}
|
||||||
|
|
||||||
GROUP BY
|
GROUP BY
|
||||||
gl.party
|
gl.party
|
||||||
|
|
||||||
ORDER BY
|
ORDER BY
|
||||||
gl.party DESC
|
gl.party DESC""".format(conditions=conditions), {
|
||||||
""", {
|
|
||||||
"fiscal_year": filters.fiscal_year,
|
"fiscal_year": filters.fiscal_year,
|
||||||
"supplier_group": filters.supplier_group,
|
|
||||||
"company": filters.company
|
"company": filters.company
|
||||||
}, as_dict=True)
|
}, as_dict=True)
|
||||||
|
|
||||||
@ -79,13 +85,13 @@ def get_columns():
|
|||||||
"fieldname": "tax_id",
|
"fieldname": "tax_id",
|
||||||
"label": _("Tax ID"),
|
"label": _("Tax ID"),
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"width": 120
|
"width": 200
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "payments",
|
"fieldname": "payments",
|
||||||
"label": _("Total Payments"),
|
"label": _("Total Payments"),
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"width": 120
|
"width": 200
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user