mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #2118 from SchrodingersGat/bom-export-fix
Fix error on BOM export
This commit is contained in:
commit
a69bcb9f18
@ -189,12 +189,15 @@ def ExportBom(part, fmt='csv', cascade=False, max_levels=None, parameter_data=Fa
|
|||||||
# Process manufacturer part
|
# Process manufacturer part
|
||||||
for manufacturer_idx, manufacturer_part in enumerate(manufacturer_parts):
|
for manufacturer_idx, manufacturer_part in enumerate(manufacturer_parts):
|
||||||
|
|
||||||
if manufacturer_part:
|
if manufacturer_part and manufacturer_part.manufacturer:
|
||||||
manufacturer_name = manufacturer_part.manufacturer.name
|
manufacturer_name = manufacturer_part.manufacturer.name
|
||||||
else:
|
else:
|
||||||
manufacturer_name = ''
|
manufacturer_name = ''
|
||||||
|
|
||||||
|
if manufacturer_part:
|
||||||
manufacturer_mpn = manufacturer_part.MPN
|
manufacturer_mpn = manufacturer_part.MPN
|
||||||
|
else:
|
||||||
|
manufacturer_mpn = ''
|
||||||
|
|
||||||
# Generate column names for this manufacturer
|
# Generate column names for this manufacturer
|
||||||
k_man = manufacturer_headers[0] + "_" + str(manufacturer_idx)
|
k_man = manufacturer_headers[0] + "_" + str(manufacturer_idx)
|
||||||
@ -210,12 +213,15 @@ def ExportBom(part, fmt='csv', cascade=False, max_levels=None, parameter_data=Fa
|
|||||||
# Process supplier parts
|
# Process supplier parts
|
||||||
for supplier_idx, supplier_part in enumerate(manufacturer_part.supplier_parts.all()):
|
for supplier_idx, supplier_part in enumerate(manufacturer_part.supplier_parts.all()):
|
||||||
|
|
||||||
if supplier_part.supplier:
|
if supplier_part.supplier and supplier_part.supplier:
|
||||||
supplier_name = supplier_part.supplier.name
|
supplier_name = supplier_part.supplier.name
|
||||||
else:
|
else:
|
||||||
supplier_name = ''
|
supplier_name = ''
|
||||||
|
|
||||||
|
if supplier_part:
|
||||||
supplier_sku = supplier_part.SKU
|
supplier_sku = supplier_part.SKU
|
||||||
|
else:
|
||||||
|
supplier_sku = ''
|
||||||
|
|
||||||
# Generate column names for this supplier
|
# Generate column names for this supplier
|
||||||
k_sup = str(supplier_headers[0]) + "_" + str(manufacturer_idx) + "_" + str(supplier_idx)
|
k_sup = str(supplier_headers[0]) + "_" + str(manufacturer_idx) + "_" + str(supplier_idx)
|
||||||
|
Loading…
Reference in New Issue
Block a user