fix: BOM stock report (#21380)
This commit is contained in:
parent
28deddeb6f
commit
e8a651bc00
@ -18,10 +18,10 @@ def get_columns():
|
|||||||
"""return columns"""
|
"""return columns"""
|
||||||
columns = [
|
columns = [
|
||||||
_("Item") + ":Link/Item:150",
|
_("Item") + ":Link/Item:150",
|
||||||
_("Description") + "::500",
|
_("Description") + "::300",
|
||||||
_("Qty per BOM Line") + ":Float:100",
|
_("BOM Qty") + ":Float:160",
|
||||||
_("Required Qty") + ":Float:100",
|
_("Required Qty") + ":Float:120",
|
||||||
_("In Stock Qty") + ":Float:100",
|
_("In Stock Qty") + ":Float:120",
|
||||||
_("Enough Parts to Build") + ":Float:200",
|
_("Enough Parts to Build") + ":Float:200",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -59,13 +59,14 @@ def get_bom_stock(filters):
|
|||||||
bom_item.item_code,
|
bom_item.item_code,
|
||||||
bom_item.description ,
|
bom_item.description ,
|
||||||
bom_item.{qty_field},
|
bom_item.{qty_field},
|
||||||
bom_item.{qty_field} * {qty_to_produce},
|
bom_item.{qty_field} * {qty_to_produce} / bom.quantity,
|
||||||
sum(ledger.actual_qty) as actual_qty,
|
sum(ledger.actual_qty) as actual_qty,
|
||||||
sum(FLOOR(ledger.actual_qty / (bom_item.{qty_field} * {qty_to_produce})))
|
sum(FLOOR(ledger.actual_qty / (bom_item.{qty_field} * {qty_to_produce} / bom.quantity)))
|
||||||
FROM
|
FROM
|
||||||
{table} AS bom_item
|
`tabBOM` AS bom INNER JOIN {table} AS bom_item
|
||||||
|
ON bom.name = bom_item.parent
|
||||||
LEFT JOIN `tabBin` AS ledger
|
LEFT JOIN `tabBin` AS ledger
|
||||||
ON bom_item.item_code = ledger.item_code
|
ON bom_item.item_code = ledger.item_code
|
||||||
{conditions}
|
{conditions}
|
||||||
WHERE
|
WHERE
|
||||||
bom_item.parent = '{bom}' and bom_item.parenttype='BOM'
|
bom_item.parent = '{bom}' and bom_item.parenttype='BOM'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user