diff --git a/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.js b/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.js index df5e47b33d..7f087f4b64 100644 --- a/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.js +++ b/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.js @@ -4,7 +4,13 @@ frappe.query_reports["BOM Stock Report"] = { "fieldname":"bom", "label": __("BOM"), "fieldtype": "Link", - "options": "BOM" - }, + "options": "BOM", + "reqd": 1 + },{ + "fieldname":"warehouse", + "label": __("Warehouse"), + "fieldtype": "Link", + "reqd": 1 + } ] } \ No newline at end of file diff --git a/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.json b/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.json index 6bdeb231a0..64d0ebbed4 100644 --- a/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.json +++ b/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.json @@ -8,12 +8,12 @@ "idx": 0, "is_standard": "Yes", "letter_head": "Standard", - "modified": "2017-02-07 09:10:10.954616", + "modified": "2017-02-09 23:19:32.050905", "modified_by": "Administrator", "module": "Manufacturing", "name": "BOM Stock Report", "owner": "Administrator", - "query": "SELECT \n\tbom_item.item_code as \"Item:Link/Item:200\",\n\tbom_item.description as \"Description:Data:300\",\n\tROUND(bom_item.qty * conf_item.conversion_factor,2) as \"Required Qty:Float:100\",\n\tROUND(ledger.actual_qty * conf_ledger.conversion_factor,2) as \"In Stock Qty:Float:100\",\n\tFLOOR((ledger.actual_qty * conf_ledger.conversion_factor)/(bom_item.qty * \t\t \tconf_item.conversion_factor)) as \"Enough Parts to Build:Int:100\"\nFROM\n\t`tabBOM Item` AS bom_item \n\tLEFT JOIN `tabBin` AS ledger\t\n\tON bom_item.item_code = ledger.item_code AND ledger.warehouse = %(warehouse)s\n\tLEFT JOIN `tabUOM Conversion Detail` AS conf_item\n\tON conf_item.parent = bom_item.item_code AND conf_item.uom = bom_item.stock_uom\n\tLEFT JOIN `tabUOM Conversion Detail` AS conf_ledger\n\tON conf_ledger.parent = ledger.item_code AND conf_ledger.uom = ledger.stock_uom\nWHERE\n\tbom_item.parent=%(bom)s\n\nGROUP BY bom_item.item_code", + "query": "SELECT \n\tbom_item.item_code as \"Item:Link/Item:200\",\n\tbom_item.description as \"Description:Data:300\",\n\tbom_item.qty as \"Required Qty:Float:100\",\n\tledger.actual_qty as \"In Stock Qty:Float:100\",\n\tFLOOR(ledger.actual_qty /bom_item.qty) as \"Enough Parts to Build:Int:100\"\nFROM\n\t`tabBOM Item` AS bom_item \n\tLEFT JOIN `tabBin` AS ledger\t\n\t\tON bom_item.item_code = ledger.item_code \n\t\tAND ledger.warehouse = %(warehouse)s\nWHERE\n\tbom_item.parent=%(bom)s\n\nGROUP BY bom_item.item_code", "ref_doctype": "BOM", "report_name": "BOM Stock Report", "report_type": "Query Report" diff --git a/erpnext/manufacturing/report/production_order_stock_report/production_order_stock_report.js b/erpnext/manufacturing/report/production_order_stock_report/production_order_stock_report.js index 8e5adce9ca..917af5da9d 100644 --- a/erpnext/manufacturing/report/production_order_stock_report/production_order_stock_report.js +++ b/erpnext/manufacturing/report/production_order_stock_report/production_order_stock_report.js @@ -7,8 +7,7 @@ frappe.query_reports["Production Order Stock Report"] = { "fieldname":"warehouse", "label": __("Warehouse"), "fieldtype": "Link", - "options": "Warehouse", - "default": "Stores - VMI" + "options": "Warehouse" } ] diff --git a/erpnext/manufacturing/report/production_order_stock_report/production_order_stock_report.py b/erpnext/manufacturing/report/production_order_stock_report/production_order_stock_report.py index 5c3bd787f9..4bb00a2939 100644 --- a/erpnext/manufacturing/report/production_order_stock_report/production_order_stock_report.py +++ b/erpnext/manufacturing/report/production_order_stock_report/production_order_stock_report.py @@ -26,7 +26,7 @@ def get_item_list(prod_list, filters): produced_value = frappe.db.get_value("Production Order", prod_order.name, "produced_qty") item_list = frappe.db.sql("""SELECT bom_item.item_code as item_code, - ifnull(ledger.actual_qty,0)/(bom_item.qty) as build_qty + ifnull(ledger.actual_qty/bom_item.qty,0) as build_qty FROM `tabBOM Item` AS bom_item LEFT JOIN `tabBin` AS ledger @@ -43,8 +43,9 @@ def get_item_list(prod_list, filters): count = count + 1 if item.build_qty >= (qty-produced_value): stock_qty = stock_qty + 1 - elif buildable_qty > item.build_qty: - buidable_qty = item.build_qty + elif buildable_qty >= item.build_qty: + buildable_qty = item.build_qty + if count == stock_qty: build = "Y" @@ -84,13 +85,13 @@ def get_columns(): "label": "BOM", "fieldtype": "Link", "options": "BOM", - "width": 130 + "width": 120 }, { "fieldname": "description", "label": "Description", "fieldtype": "Data", "options": "", - "width": 250 + "width": 230 }, { "fieldname": "qty", "label": "Qty to Build", @@ -102,19 +103,19 @@ def get_columns(): "label": "Status", "fieldtype": "Data", "options": "", - "width": 110 + "width": 100 }, { "fieldname": "req_items", - "label": "# of Required Items", + "label": "# Req'd Items", "fieldtype": "Data", "options": "", - "width": 135 + "width": 105 }, { "fieldname": "instock", - "label": "# of In Stock Items", + "label": "# In Stock", "fieldtype": "Data", "options": "", - "width": 135 + "width": 105 }, { "fieldname": "buildable_qty", "label": "Buildable Qty", @@ -123,7 +124,7 @@ def get_columns(): "width": 100 }, { "fieldname": "ready_to_build", - "label": "Can Build All", + "label": "Build All?", "fieldtype": "Data", "options": "", "width": 90