perf: skip warehouse validation for non-stock items
This commit is contained in:
parent
03e6a6c699
commit
199a6da960
@ -1264,25 +1264,13 @@ class AccountsController(TransactionBase):
|
||||
return get_company_default(self.company, fieldname, ignore_validation=ignore_validation)
|
||||
|
||||
def get_stock_items(self):
|
||||
if hasattr(self, "_stock_items") and self._stock_items:
|
||||
return self._stock_items
|
||||
|
||||
stock_items = []
|
||||
item_codes = list(set(item.item_code for item in self.get("items")))
|
||||
if item_codes:
|
||||
stock_items = [
|
||||
r[0]
|
||||
for r in frappe.db.sql(
|
||||
"""
|
||||
select name from `tabItem`
|
||||
where name in (%s) and is_stock_item=1
|
||||
"""
|
||||
% (", ".join(["%s"] * len(item_codes)),),
|
||||
item_codes,
|
||||
)
|
||||
]
|
||||
stock_items = frappe.db.get_values(
|
||||
"Item", {"name": ["in", item_codes], "is_stock_item": 1}, pluck="name", cache=True
|
||||
)
|
||||
|
||||
self._stock_items = stock_items
|
||||
return stock_items
|
||||
|
||||
def set_total_advance_paid(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user