mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-05 22:48:27 +00:00
Merge pull request #30514 from frappe/mergify/bp/version-13-hotfix/pr-30461
fix(asset): do not validate warehouse on asset purchase (backport #30461)
This commit is contained in:
@@ -245,8 +245,9 @@ class PurchaseInvoice(BuyingController):
|
||||
|
||||
def validate_warehouse(self, for_validate=True):
|
||||
if self.update_stock and for_validate:
|
||||
stock_items = self.get_stock_items()
|
||||
for d in self.get("items"):
|
||||
if not d.warehouse:
|
||||
if not d.warehouse and d.item_code in stock_items:
|
||||
frappe.throw(
|
||||
_(
|
||||
"Warehouse required at Row No {0}, please set default warehouse for the item {1} for the company {2}"
|
||||
|
||||
@@ -1268,17 +1268,11 @@ class AccountsController(TransactionBase):
|
||||
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}, as_dict=True, cache=True
|
||||
)
|
||||
if stock_items:
|
||||
stock_items = [d.get("name") for d in stock_items]
|
||||
|
||||
return stock_items
|
||||
|
||||
|
||||
Reference in New Issue
Block a user