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

@@ -2049,7 +2049,7 @@ def get_advance_journal_entries(
journal_entries = frappe.db.sql(
"""
select
"Journal Entry" as reference_type, t1.name as reference_name,
'Journal Entry' as reference_type, t1.name as reference_name,
t1.remark as remarks, t2.{0} as amount, t2.name as reference_row,
t2.reference_name as against_order, t2.exchange_rate
from
@@ -2104,7 +2104,7 @@ def get_advance_payment_entries(
payment_entries_against_order = frappe.db.sql(
"""
select
"Payment Entry" as reference_type, t1.name as reference_name,
'Payment Entry' as reference_type, t1.name as reference_name,
t1.remarks, t2.allocated_amount as amount, t2.name as reference_row,
t2.reference_name as against_order, t1.posting_date,
t1.{0} as currency, t1.{4} as exchange_rate
@@ -2124,7 +2124,7 @@ def get_advance_payment_entries(
if include_unallocated:
unallocated_payment_entries = frappe.db.sql(
"""
select "Payment Entry" as reference_type, name as reference_name, posting_date,
select 'Payment Entry' as reference_type, name as reference_name, posting_date,
remarks, unallocated_amount as amount, {2} as exchange_rate, {3} as currency
from `tabPayment Entry`
where