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

@@ -890,7 +890,7 @@ def get_item_price(args, item_code, ignore_party=False):
return frappe.db.sql(
""" select name, price_list_rate, uom
from `tabItem Price` {conditions}
order by valid_from desc, batch_no desc, uom desc """.format(
order by valid_from desc, ifnull(batch_no, '') desc, uom desc """.format(
conditions=conditions
),
args,