2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 05:25:42 +00:00

Move the export_bom function to the part model

This commit is contained in:
Oliver Walters
2019-04-14 00:50:43 +10:00
parent b8e28c003d
commit 9e5eed5d5e
2 changed files with 33 additions and 9 deletions

View File

@ -131,15 +131,7 @@ class BomExport(AjaxView):
# Placeholder to test file export
filename = '"' + part.name + '_BOM.' + export_format + '"'
filedata = "Part,Quantity,Available\n"
for bom_item in part.bom_items.all():
filedata += bom_item.sub_part.name
filedata += ","
filedata += str(bom_item.quantity)
filedata += ","
filedata += str(bom_item.sub_part.available_stock)
filedata += "\n"
filedata = part.export_bom()
return DownloadFile(filedata, filename)