diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index c39a5b7aac..13bf0875e4 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -54,7 +54,7 @@ class BOM(Document): def get_item_det(self, item_code): item = frappe.db.sql("""select name, is_asset_item, is_purchase_item, docstatus, description, is_sub_contracted_item, stock_uom, default_bom, - last_purchase_rate, standard_rate, is_manufactured_item + last_purchase_rate, is_manufactured_item from `tabItem` where name=%s""", item_code, as_dict = 1) return item @@ -111,8 +111,6 @@ class BOM(Document): frappe.throw(_("Please select Price List")) rate = frappe.db.get_value("Item Price", {"price_list": self.buying_price_list, "item_code": arg["item_code"]}, "price_list_rate") or 0 - elif self.rm_cost_as_per == 'Standard Rate': - rate = arg['standard_rate'] return rate diff --git a/erpnext/manufacturing/doctype/bom_item/bom_item.json b/erpnext/manufacturing/doctype/bom_item/bom_item.json index fbf478c756..0231a703f1 100644 --- a/erpnext/manufacturing/doctype/bom_item/bom_item.json +++ b/erpnext/manufacturing/doctype/bom_item/bom_item.json @@ -1,5 +1,5 @@ { - "creation": "2013-02-22 01:27:49.000000", + "creation": "2013-02-22 01:27:49", "docstatus": 0, "doctype": "DocType", "fields": [ @@ -79,7 +79,8 @@ "fieldtype": "Float", "in_list_view": 1, "label": "Rate", - "permlevel": 0 + "permlevel": 0, + "reqd": 1 }, { "fieldname": "col_break2", @@ -133,9 +134,12 @@ ], "idx": 1, "istable": 1, - "modified": "2014-02-03 12:47:39.000000", + "modified": "2014-05-29 15:56:31.859868", "modified_by": "Administrator", "module": "Manufacturing", "name": "BOM Item", - "owner": "Administrator" + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC" } \ No newline at end of file diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json index 0e12cd2963..92c16f8b90 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -439,16 +439,6 @@ "permlevel": 0, "read_only": 1 }, - { - "depends_on": "eval:doc.is_purchase_item==\"Yes\"", - "fieldname": "standard_rate", - "fieldtype": "Float", - "label": "Standard Rate", - "oldfieldname": "standard_rate", - "oldfieldtype": "Currency", - "permlevel": 0, - "read_only": 0 - }, { "depends_on": "eval:doc.is_purchase_item==\"Yes\"", "fieldname": "column_break2", @@ -835,7 +825,7 @@ "icon": "icon-tag", "idx": 1, "max_attachments": 1, - "modified": "2014-05-21 15:37:30.124881", + "modified": "2014-05-29 16:05:53.126214", "modified_by": "Administrator", "module": "Stock", "name": "Item", diff --git a/erpnext/stock/report/item_prices/item_prices.py b/erpnext/stock/report/item_prices/item_prices.py index 0d5539ecec..d2da54f8fa 100644 --- a/erpnext/stock/report/item_prices/item_prices.py +++ b/erpnext/stock/report/item_prices/item_prices.py @@ -7,7 +7,7 @@ from frappe.utils import flt def execute(filters=None): if not filters: filters = {} - + columns = get_columns(filters) item_map = get_item_details() pl = get_price_list() @@ -19,34 +19,33 @@ def execute(filters=None): precision = get_currency_precision() or 2 data = [] for item in sorted(item_map): - data.append([item, item_map[item]["item_name"], - 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"), - flt(bom_rate.get(item, 0), precision), - flt(item_map[item]["standard_rate"], precision) + data.append([item, item_map[item]["item_name"], + 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"), + flt(bom_rate.get(item, 0), precision) ]) - + return columns, data def get_columns(filters): """return columns based on filters""" - - columns = ["Item:Link/Item:100", "Item Name::150", "Description::150", "UOM:Link/UOM:80", - "Last Purchase Rate:Currency:90", "Valuation Rate:Currency:80", "Sales Price List::80", - "Purchase Price List::80", "BOM Rate:Currency:90", "Standard Rate:Currency:100"] + + columns = ["Item:Link/Item:100", "Item Name::150", "Description::150", "UOM:Link/UOM:80", + "Last Purchase Rate:Currency:90", "Valuation Rate:Currency:80", "Sales Price List::80", + "Purchase Price List::80", "BOM Rate:Currency:90"] return columns def get_item_details(): """returns all items details""" - + item_map = {} - + for i in frappe.db.sql("select name, item_name, description, \ - stock_uom, standard_rate from tabItem \ + stock_uom from tabItem \ order by item_code", as_dict=1): item_map.setdefault(i.name, i) @@ -57,42 +56,42 @@ def get_price_list(): rate = {} - price_list = frappe.db.sql("""select ip.item_code, ip.buying, ip.selling, - concat(ip.price_list, " - ", ip.currency, " ", ip.price_list_rate) as price - from `tabItem Price` ip, `tabPrice List` pl + price_list = frappe.db.sql("""select ip.item_code, ip.buying, ip.selling, + concat(ip.price_list, " - ", ip.currency, " ", ip.price_list_rate) as price + from `tabItem Price` ip, `tabPrice List` pl where ip.price_list=pl.name and pl.enabled=1""", as_dict=1) for j in price_list: if j.price: rate.setdefault(j.item_code, {}).setdefault("Buying" if j.buying else "Selling", []).append(j.price) item_rate_map = {} - + for item in rate: for buying_or_selling in rate[item]: - item_rate_map.setdefault(item, {}).setdefault(buying_or_selling, + item_rate_map.setdefault(item, {}).setdefault(buying_or_selling, ", ".join(rate[item].get(buying_or_selling, []))) - + return item_rate_map def get_last_purchase_rate(): item_last_purchase_rate_map = {} - query = """select * from (select + query = """select * from (select result.item_code, result.base_rate from ( - (select + (select po_item.item_code, po_item.item_name, po.transaction_date as posting_date, - po_item.base_price_list_rate, - po_item.discount_percentage, + po_item.base_price_list_rate, + po_item.discount_percentage, po_item.base_rate from `tabPurchase Order` po, `tabPurchase Order Item` po_item where po.name = po_item.parent and po.docstatus = 1) union - (select + (select pr_item.item_code, pr_item.item_name, pr.posting_date, @@ -114,8 +113,8 @@ def get_item_bom_rate(): """Get BOM rate of an item from BOM""" item_bom_map = {} - - for b in frappe.db.sql("""select item, (total_cost/quantity) as bom_rate + + for b in frappe.db.sql("""select item, (total_cost/quantity) as bom_rate from `tabBOM` where is_active=1 and is_default=1""", as_dict=1): item_bom_map.setdefault(b.item, flt(b.bom_rate)) @@ -125,8 +124,8 @@ def get_valuation_rate(): """Get an average valuation rate of an item from all warehouses""" item_val_rate_map = {} - - for d in frappe.db.sql("""select item_code, + + for d in frappe.db.sql("""select item_code, sum(actual_qty*valuation_rate)/sum(actual_qty) as val_rate from tabBin where actual_qty > 0 group by item_code""", as_dict=1): item_val_rate_map.setdefault(d.item_code, d.val_rate)