Merge branch 'develop' into hooks-update
This commit is contained in:
commit
450da16dc2
@ -89,7 +89,7 @@ def get_item_price_qty_data(filters):
|
|||||||
{conditions}"""
|
{conditions}"""
|
||||||
.format(conditions=conditions), filters, as_dict=1)
|
.format(conditions=conditions), filters, as_dict=1)
|
||||||
|
|
||||||
price_list_names = list(set([frappe.db.escape(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)
|
||||||
selling_price_map = get_price_map(price_list_names, selling=1)
|
selling_price_map = get_price_map(price_list_names, selling=1)
|
||||||
@ -129,17 +129,15 @@ def get_price_map(price_list_names, buying=0, selling=0):
|
|||||||
|
|
||||||
rate_key = "Buying Rate" if buying else "Selling Rate"
|
rate_key = "Buying Rate" if buying else "Selling Rate"
|
||||||
price_list_key = "Buying Price List" if buying else "Selling Price List"
|
price_list_key = "Buying Price List" if buying else "Selling Price List"
|
||||||
price_list_condition = " and buying=1" if buying else " and selling=1"
|
|
||||||
|
|
||||||
pricing_details = frappe.db.sql("""
|
filters = {"name": ("in", price_list_names)}
|
||||||
select
|
if buying:
|
||||||
name,price_list,price_list_rate
|
filters["buying"] = 1
|
||||||
from
|
else:
|
||||||
`tabItem Price`
|
filters["selling"] = 1
|
||||||
where
|
|
||||||
name in ({price_list_names}) {price_list_condition}
|
pricing_details = frappe.get_all("Item Price",
|
||||||
""".format(price_list_names=', '.join(['%s']*len(price_list_names)),
|
fields = ["name", "price_list", "price_list_rate"], filters=filters)
|
||||||
price_list_condition=price_list_condition), price_list_names, as_dict=1)
|
|
||||||
|
|
||||||
for d in pricing_details:
|
for d in pricing_details:
|
||||||
name = d["name"]
|
name = d["name"]
|
||||||
|
Loading…
Reference in New Issue
Block a user