mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-12 06:48:31 +00:00
Merge pull request #49118 from sagarvora/rm-query-exists
This commit is contained in:
@@ -35,7 +35,7 @@ def get_brand_defaults(item, company):
|
||||
|
||||
for d in brand.brand_defaults or []:
|
||||
if d.company == company:
|
||||
row = copy.deepcopy(d.as_dict())
|
||||
row = d.as_dict(no_private_properties=True)
|
||||
row.pop("name")
|
||||
return row
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ def get_item_group_defaults(item, company):
|
||||
|
||||
for d in item_group.item_group_defaults or []:
|
||||
if d.company == company:
|
||||
row = copy.deepcopy(d.as_dict())
|
||||
row = d.as_dict(no_private_properties=True)
|
||||
row.pop("name")
|
||||
return row
|
||||
|
||||
|
||||
@@ -1277,7 +1277,7 @@ def get_item_defaults(item_code, company):
|
||||
|
||||
for d in item.item_defaults:
|
||||
if d.company == company:
|
||||
row = copy.deepcopy(d.as_dict())
|
||||
row = d.as_dict(no_private_properties=True)
|
||||
row.pop("name")
|
||||
out.update(row)
|
||||
return out
|
||||
|
||||
@@ -585,20 +585,15 @@ def get_item_warehouse_(ctx: ItemDetailsCtx, item, overwrite_warehouse, defaults
|
||||
or ctx.warehouse
|
||||
)
|
||||
|
||||
if not warehouse:
|
||||
defaults = frappe.defaults.get_defaults() or {}
|
||||
warehouse_exists = frappe.db.exists(
|
||||
"Warehouse", {"name": defaults.default_warehouse, "company": ctx.company}
|
||||
)
|
||||
if defaults.get("default_warehouse") and warehouse_exists:
|
||||
warehouse = defaults.default_warehouse
|
||||
|
||||
else:
|
||||
warehouse = ctx.warehouse
|
||||
|
||||
if not warehouse:
|
||||
default_warehouse = frappe.get_single_value("Stock Settings", "default_warehouse")
|
||||
if frappe.db.get_value("Warehouse", default_warehouse, "company") == ctx.company:
|
||||
if (
|
||||
default_warehouse
|
||||
and frappe.get_cached_value("Warehouse", default_warehouse, "company") == ctx.company
|
||||
):
|
||||
return default_warehouse
|
||||
|
||||
return warehouse
|
||||
|
||||
Reference in New Issue
Block a user