Move the export_bom function to the part model

This commit is contained in:
Oliver Walters committed 2019-04-14 12:34:14 +10:00
1 parent b8e28c003d
commit 9e5eed5d5e
2 files changed
+33 -9

No files matched your search

+1 -9
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)