mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
[usability] item price moved to price list
This commit is contained in:
@@ -23,8 +23,8 @@ def execute(filters=None):
|
||||
item_map[item]["description"], item_map[item]["stock_uom"],
|
||||
flt(last_purchase_rate.get(item, 0), precision),
|
||||
flt(val_rate_map.get(item, 0), precision),
|
||||
pl.get(item, {}).get("selling"),
|
||||
pl.get(item, {}).get("buying"),
|
||||
pl.get(item, {}).get("Selling"),
|
||||
pl.get(item, {}).get("Buying"),
|
||||
flt(bom_rate.get(item, 0), precision),
|
||||
flt(item_map[item]["standard_rate"], precision)
|
||||
])
|
||||
@@ -56,24 +56,21 @@ def get_price_list():
|
||||
"""Get selling & buying price list of every item"""
|
||||
|
||||
rate = {}
|
||||
|
||||
price_list = webnotes.conn.sql("""select parent, selling, buying,
|
||||
concat(price_list, " - ", ref_currency, " ", ref_rate) as price
|
||||
from `tabItem Price` where docstatus<2""", as_dict=1)
|
||||
|
||||
price_list = webnotes.conn.sql("""select ip.item_code, pl.buying_or_selling,
|
||||
concat(pl.name, " - ", pl.currency, " ", ip.ref_rate) as price
|
||||
from `tabItem Price` ip, `tabPrice List` pl where
|
||||
ip.parent = pl.name and pl.docstatus<2""", as_dict=1)
|
||||
|
||||
for j in price_list:
|
||||
if j.price:
|
||||
if j.selling:
|
||||
rate.setdefault(j.parent, {}).setdefault("selling", []).append(j.price)
|
||||
if j.buying:
|
||||
rate.setdefault(j.parent, {}).setdefault("buying", []).append(j.price)
|
||||
|
||||
rate.setdefault(j.item_code, {}).setdefault(j.buying_or_selling, []).append(j.price)
|
||||
item_rate_map = {}
|
||||
|
||||
for item in rate:
|
||||
item_rate_map.setdefault(item, {}).setdefault("selling",
|
||||
", ".join(rate[item].get("selling", [])))
|
||||
item_rate_map[item]["buying"] = ", ".join(rate[item].get("buying", []))
|
||||
for buying_or_selling in rate[item]:
|
||||
item_rate_map.setdefault(item, {}).setdefault(buying_or_selling,
|
||||
", ".join(rate[item].get(buying_or_selling, [])))
|
||||
|
||||
return item_rate_map
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 18:01:55",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-05-07 11:52:00",
|
||||
"modified": "2013-09-10 15:50:26",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -10,7 +10,7 @@
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"query": "select\n item.name as \"ID:Link/Item:120\", \n item.item_name as \"Item Name::120\", \n item_price.price_list as \"Price List::80\",\n item_price.ref_currency as \"Currency::40\", \n item_price.ref_rate as \"Rate:Float:80\",\n item.description as \"Description::160\",\n item.item_group as \"Item Group:Link/Item Group:100\",\n item.brand as \"Brand::100\"\nfrom `tabItem` item, `tabItem Price` item_price\nwhere\n item_price.parent = item.name",
|
||||
"query": "select\n item.name as \"ID:Link/Item:120\", \n item.item_name as \"Item Name::120\", \n item_price.parent as \"Price List::80\",\n price_list.currency as \"Currency::40\", \n item_price.ref_rate as \"Rate:Float:80\",\n item.description as \"Description::160\",\n item.item_group as \"Item Group:Link/Item Group:100\",\n item.brand as \"Brand::100\"\nfrom `tabItem` item, `tabItem Price` item_price, `tabPrice List` price_list\nwhere\n item_price.item_code = item.name and\n item_price.parent = price_list.name",
|
||||
"ref_doctype": "Item",
|
||||
"report_name": "Item-Wise Price List",
|
||||
"report_type": "Query Report"
|
||||
|
||||
Reference in New Issue
Block a user