mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 12:49:10 +00:00
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:
@@ -1305,7 +1305,7 @@ def item_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
if not field in searchfields
|
||||
]
|
||||
|
||||
query_filters = {"disabled": 0, "ifnull(end_of_life, '5050-50-50')": (">", today())}
|
||||
query_filters = {"disabled": 0, "end_of_life": (">", today())}
|
||||
|
||||
or_cond_filters = {}
|
||||
if txt:
|
||||
|
||||
@@ -849,7 +849,7 @@ def get_subitems(
|
||||
FROM
|
||||
`tabBOM Item` bom_item
|
||||
JOIN `tabBOM` bom ON bom.name = bom_item.parent
|
||||
JOIN tabItem item ON bom_item.item_code = item.name
|
||||
JOIN `tabItem` item ON bom_item.item_code = item.name
|
||||
LEFT JOIN `tabItem Default` item_default
|
||||
ON item.name = item_default.parent and item_default.company = %(company)s
|
||||
LEFT JOIN `tabUOM Conversion Detail` item_uom
|
||||
@@ -979,7 +979,7 @@ def get_sales_orders(self):
|
||||
select distinct so.name, so.transaction_date, so.customer, so.base_grand_total
|
||||
from `tabSales Order` so, `tabSales Order Item` so_item
|
||||
where so_item.parent = so.name
|
||||
and so.docstatus = 1 and so.status not in ("Stopped", "Closed")
|
||||
and so.docstatus = 1 and so.status not in ('Stopped', 'Closed')
|
||||
and so.company = %(company)s
|
||||
and so_item.qty > so_item.work_order_qty {so_filter} {item_filter}
|
||||
and (exists (select name from `tabBOM` bom where {bom_item}
|
||||
|
||||
@@ -939,7 +939,7 @@ class WorkOrder(Document):
|
||||
from `tabStock Entry` entry, `tabStock Entry Detail` detail
|
||||
where
|
||||
entry.work_order = %(name)s
|
||||
and entry.purpose = "Material Transfer for Manufacture"
|
||||
and entry.purpose = 'Material Transfer for Manufacture'
|
||||
and entry.docstatus = 1
|
||||
and detail.parent = entry.name
|
||||
and (detail.item_code = %(item)s or detail.original_item = %(item)s)""",
|
||||
|
||||
Reference in New Issue
Block a user