mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 19:29:10 +00:00
refactor(sales_order): Replace SQL with ORM in product_bundle_has_sto… (#55200)
This commit is contained in:
@@ -381,14 +381,14 @@ class SalesOrder(SellingController):
|
|||||||
|
|
||||||
def product_bundle_has_stock_item(self, product_bundle):
|
def product_bundle_has_stock_item(self, product_bundle):
|
||||||
"""Returns true if product bundle has stock item"""
|
"""Returns true if product bundle has stock item"""
|
||||||
ret = len(
|
bundle_items = frappe.get_all(
|
||||||
frappe.db.sql(
|
"Product Bundle Item", filters={"parent": product_bundle}, pluck="item_code"
|
||||||
"""select i.name from tabItem i, `tabProduct Bundle Item` pbi
|
|
||||||
where pbi.parent = %s and pbi.item_code = i.name and i.is_stock_item = 1""",
|
|
||||||
product_bundle,
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
return ret
|
|
||||||
|
if not bundle_items:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return frappe.db.exists("Item", {"name": ["in", bundle_items], "is_stock_item": 1}) is not None
|
||||||
|
|
||||||
def validate_sales_mntc_quotation(self):
|
def validate_sales_mntc_quotation(self):
|
||||||
for d in self.get("items"):
|
for d in self.get("items"):
|
||||||
|
|||||||
Reference in New Issue
Block a user