refactor: DB independent quoting and truthy/falsy values (#31358)

* refactor: DB independent quoting and truthy/falsy values

* style: reformat to black spec

* fix: ifnull -> coalesce

* fix: coalesce -> Coalesce

* fix: revert pypika comparison

* refactor: convert queries to QB

* fix: incorrect value types for query

`=` query makes no sense with list of values

* fix: remove warehouse docstatus condition

* fix: keep using base rate as rate

Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
Conor
2022-06-17 06:31:27 -05:00
committed by GitHub
parent d6078aa911
commit 74a782d81d
43 changed files with 109 additions and 99 deletions

View File

@@ -83,7 +83,7 @@ def get_conditions(filters):
("gst_hsn_code", " and gst_hsn_code=%(gst_hsn_code)s"),
("company_gstin", " and company_gstin=%(company_gstin)s"),
("from_date", " and posting_date >= %(from_date)s"),
("to_date", "and posting_date <= %(to_date)s"),
("to_date", " and posting_date <= %(to_date)s"),
):
if filters.get(opts[0]):
conditions += opts[1]

View File

@@ -47,7 +47,7 @@ def execute(filters=None):
s.name = gl.party
AND s.irs_1099 = 1
AND gl.fiscal_year = %(fiscal_year)s
AND gl.party_type = "Supplier"
AND gl.party_type = 'Supplier'
AND gl.company = %(company)s
{conditions}

View File

@@ -65,7 +65,7 @@ class VATAuditReport(object):
`tab{doctype}`
WHERE
docstatus = 1 {where_conditions}
and is_opening = "No"
and is_opening = 'No'
ORDER BY
posting_date DESC
""".format(