Merge pull request #19602 from Anurag810/bom-explorer-report-fix
fix: Raw material qty depending on the quantity of the parent BOM
This commit is contained in:
commit
c9afe2f707
@ -14,7 +14,7 @@ def execute(filters=None):
|
|||||||
def get_data(filters, data):
|
def get_data(filters, data):
|
||||||
get_exploded_items(filters.bom, data)
|
get_exploded_items(filters.bom, data)
|
||||||
|
|
||||||
def get_exploded_items(bom, data, indent=0):
|
def get_exploded_items(bom, data, indent=0, qty=1):
|
||||||
exploded_items = frappe.get_all("BOM Item",
|
exploded_items = frappe.get_all("BOM Item",
|
||||||
filters={"parent": bom},
|
filters={"parent": bom},
|
||||||
fields= ['qty','bom_no','qty','scrap','item_code','item_name','description','uom'])
|
fields= ['qty','bom_no','qty','scrap','item_code','item_name','description','uom'])
|
||||||
@ -26,13 +26,13 @@ def get_exploded_items(bom, data, indent=0):
|
|||||||
'item_name': item.item_name,
|
'item_name': item.item_name,
|
||||||
'indent': indent,
|
'indent': indent,
|
||||||
'bom': item.bom_no,
|
'bom': item.bom_no,
|
||||||
'qty': item.qty,
|
'qty': item.qty * qty,
|
||||||
'uom': item.uom,
|
'uom': item.uom,
|
||||||
'description': item.description,
|
'description': item.description,
|
||||||
'scrap': item.scrap
|
'scrap': item.scrap
|
||||||
})
|
})
|
||||||
if item.bom_no:
|
if item.bom_no:
|
||||||
get_exploded_items(item.bom_no, data, indent=indent+1)
|
get_exploded_items(item.bom_no, data, indent=indent+1, qty=item.qty)
|
||||||
|
|
||||||
def get_columns():
|
def get_columns():
|
||||||
return [
|
return [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user