Merge pull request #47981 from barredterra/wo-query_sales_order
refactor(Work Order): query_sales_order
This commit is contained in:
@@ -2004,20 +2004,20 @@ def stop_unstop(work_order, status):
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def query_sales_order(production_item):
|
||||
out = frappe.db.sql_list(
|
||||
"""
|
||||
select distinct so.name from `tabSales Order` so, `tabSales Order Item` so_item
|
||||
where so_item.parent=so.name and so_item.item_code=%s and so.docstatus=1
|
||||
union
|
||||
select distinct so.name from `tabSales Order` so, `tabPacked Item` pi_item
|
||||
where pi_item.parent=so.name and pi_item.item_code=%s and so.docstatus=1
|
||||
""",
|
||||
(production_item, production_item),
|
||||
def query_sales_order(production_item: str) -> list[str]:
|
||||
return frappe.get_list(
|
||||
"Sales Order",
|
||||
filters=[
|
||||
["Sales Order", "docstatus", "=", 1],
|
||||
],
|
||||
or_filters=[
|
||||
["Sales Order Item", "item_code", "=", production_item],
|
||||
["Packed Item", "item_code", "=", production_item],
|
||||
],
|
||||
pluck="name",
|
||||
distinct=True,
|
||||
)
|
||||
|
||||
return out
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_job_card(work_order, operations):
|
||||
|
||||
Reference in New Issue
Block a user