Added warehouse to BOM Stock Report, fixed bugs with buildable qty
This commit is contained in:
parent
630882787a
commit
67a13972fb
@ -4,7 +4,13 @@ frappe.query_reports["BOM Stock Report"] = {
|
|||||||
"fieldname":"bom",
|
"fieldname":"bom",
|
||||||
"label": __("BOM"),
|
"label": __("BOM"),
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "BOM"
|
"options": "BOM",
|
||||||
},
|
"reqd": 1
|
||||||
|
},{
|
||||||
|
"fieldname":"warehouse",
|
||||||
|
"label": __("Warehouse"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"reqd": 1
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -8,12 +8,12 @@
|
|||||||
"idx": 0,
|
"idx": 0,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"letter_head": "Standard",
|
"letter_head": "Standard",
|
||||||
"modified": "2017-02-07 09:10:10.954616",
|
"modified": "2017-02-09 23:19:32.050905",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Manufacturing",
|
"module": "Manufacturing",
|
||||||
"name": "BOM Stock Report",
|
"name": "BOM Stock Report",
|
||||||
"owner": "Administrator",
|
"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",
|
"ref_doctype": "BOM",
|
||||||
"report_name": "BOM Stock Report",
|
"report_name": "BOM Stock Report",
|
||||||
"report_type": "Query Report"
|
"report_type": "Query Report"
|
||||||
|
@ -7,8 +7,7 @@ frappe.query_reports["Production Order Stock Report"] = {
|
|||||||
"fieldname":"warehouse",
|
"fieldname":"warehouse",
|
||||||
"label": __("Warehouse"),
|
"label": __("Warehouse"),
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Warehouse",
|
"options": "Warehouse"
|
||||||
"default": "Stores - VMI"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -26,7 +26,7 @@ def get_item_list(prod_list, filters):
|
|||||||
produced_value = frappe.db.get_value("Production Order", prod_order.name, "produced_qty")
|
produced_value = frappe.db.get_value("Production Order", prod_order.name, "produced_qty")
|
||||||
item_list = frappe.db.sql("""SELECT
|
item_list = frappe.db.sql("""SELECT
|
||||||
bom_item.item_code as item_code,
|
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
|
FROM
|
||||||
`tabBOM Item` AS bom_item
|
`tabBOM Item` AS bom_item
|
||||||
LEFT JOIN `tabBin` AS ledger
|
LEFT JOIN `tabBin` AS ledger
|
||||||
@ -43,8 +43,9 @@ def get_item_list(prod_list, filters):
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
if item.build_qty >= (qty-produced_value):
|
if item.build_qty >= (qty-produced_value):
|
||||||
stock_qty = stock_qty + 1
|
stock_qty = stock_qty + 1
|
||||||
elif buildable_qty > item.build_qty:
|
elif buildable_qty >= item.build_qty:
|
||||||
buidable_qty = item.build_qty
|
buildable_qty = item.build_qty
|
||||||
|
|
||||||
|
|
||||||
if count == stock_qty:
|
if count == stock_qty:
|
||||||
build = "Y"
|
build = "Y"
|
||||||
@ -84,13 +85,13 @@ def get_columns():
|
|||||||
"label": "BOM",
|
"label": "BOM",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "BOM",
|
"options": "BOM",
|
||||||
"width": 130
|
"width": 120
|
||||||
}, {
|
}, {
|
||||||
"fieldname": "description",
|
"fieldname": "description",
|
||||||
"label": "Description",
|
"label": "Description",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"options": "",
|
"options": "",
|
||||||
"width": 250
|
"width": 230
|
||||||
}, {
|
}, {
|
||||||
"fieldname": "qty",
|
"fieldname": "qty",
|
||||||
"label": "Qty to Build",
|
"label": "Qty to Build",
|
||||||
@ -102,19 +103,19 @@ def get_columns():
|
|||||||
"label": "Status",
|
"label": "Status",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"options": "",
|
"options": "",
|
||||||
"width": 110
|
"width": 100
|
||||||
}, {
|
}, {
|
||||||
"fieldname": "req_items",
|
"fieldname": "req_items",
|
||||||
"label": "# of Required Items",
|
"label": "# Req'd Items",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"options": "",
|
"options": "",
|
||||||
"width": 135
|
"width": 105
|
||||||
}, {
|
}, {
|
||||||
"fieldname": "instock",
|
"fieldname": "instock",
|
||||||
"label": "# of In Stock Items",
|
"label": "# In Stock",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"options": "",
|
"options": "",
|
||||||
"width": 135
|
"width": 105
|
||||||
}, {
|
}, {
|
||||||
"fieldname": "buildable_qty",
|
"fieldname": "buildable_qty",
|
||||||
"label": "Buildable Qty",
|
"label": "Buildable Qty",
|
||||||
@ -123,7 +124,7 @@ def get_columns():
|
|||||||
"width": 100
|
"width": 100
|
||||||
}, {
|
}, {
|
||||||
"fieldname": "ready_to_build",
|
"fieldname": "ready_to_build",
|
||||||
"label": "Can Build All",
|
"label": "Build All?",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"options": "",
|
"options": "",
|
||||||
"width": 90
|
"width": 90
|
||||||
|
Loading…
x
Reference in New Issue
Block a user