mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-15 11:09:17 +00:00
Merge branch 'version-14-hotfix' into mergify/bp/version-14-hotfix/pr-32347
This commit is contained in:
@@ -62,22 +62,28 @@ def get_data(filters, columns):
|
|||||||
|
|
||||||
|
|
||||||
def get_item_price_qty_data(filters):
|
def get_item_price_qty_data(filters):
|
||||||
conditions = ""
|
item_price = frappe.qb.DocType("Item Price")
|
||||||
if filters.get("item_code"):
|
bin = frappe.qb.DocType("Bin")
|
||||||
conditions += "where a.item_code=%(item_code)s"
|
|
||||||
|
|
||||||
item_results = frappe.db.sql(
|
query = (
|
||||||
"""select a.item_code, a.item_name, a.name as price_list_name,
|
frappe.qb.from_(item_price)
|
||||||
a.brand as brand, b.warehouse as warehouse, b.actual_qty as actual_qty
|
.left_join(bin)
|
||||||
from `tabItem Price` a left join `tabBin` b
|
.on(item_price.item_code == bin.item_code)
|
||||||
ON a.item_code = b.item_code
|
.select(
|
||||||
{conditions}""".format(
|
item_price.item_code,
|
||||||
conditions=conditions
|
item_price.item_name,
|
||||||
),
|
item_price.name.as_("price_list_name"),
|
||||||
filters,
|
item_price.brand.as_("brand"),
|
||||||
as_dict=1,
|
bin.warehouse.as_("warehouse"),
|
||||||
|
bin.actual_qty.as_("actual_qty"),
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if filters.get("item_code"):
|
||||||
|
query = query.where(item_price.item_code == filters.get("item_code"))
|
||||||
|
|
||||||
|
item_results = query.run(as_dict=True)
|
||||||
|
|
||||||
price_list_names = list(set(item.price_list_name for item in item_results))
|
price_list_names = list(set(item.price_list_name for item in item_results))
|
||||||
|
|
||||||
buying_price_map = get_price_map(price_list_names, buying=1)
|
buying_price_map = get_price_map(price_list_names, buying=1)
|
||||||
|
|||||||
Reference in New Issue
Block a user