From 6e77029d7d596081f6f1d026fe946d9c73e46199 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 17 Jun 2021 18:12:41 +0200 Subject: [PATCH] Revert "fix for part with no bom" This reverts commit dd58f8997715bb2e0ac02811fec6e8eb4086c5aa. --- InvenTree/part/views.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index b371b9f9a4..3a874c3635 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -846,18 +846,17 @@ class PartPricingView(PartDetail): ctx['price_history'] = ret # BOM Information for Pie-Chart - if part.has_bom: - bom_items = [{'name': str(a.sub_part), 'price': a.sub_part.get_price_range(quantity), 'q': a.quantity} for a in part.bom_items.all()] - if [True for a in bom_items if len(set(a['price'])) == 2]: - ctx['bom_parts'] = [{ - 'name': a['name'], - 'min_price': str((a['price'][0] * a['q']) / quantity), - 'max_price': str((a['price'][1] * a['q']) / quantity)} for a in bom_items] - ctx['bom_pie_min'] = True - else: - ctx['bom_parts'] = [{ - 'name': a['name'], - 'price': str((a['price'][0] * a['q']) / quantity)} for a in bom_items] + bom_items = [{'name': str(a.sub_part), 'price': a.sub_part.get_price_range(quantity), 'q': a.quantity} for a in part.bom_items.all()] + if [True for a in bom_items if len(set(a['price'])) == 2]: + ctx['bom_parts'] = [{ + 'name': a['name'], + 'min_price': str((a['price'][0] * a['q']) / quantity), + 'max_price': str((a['price'][1] * a['q']) / quantity)} for a in bom_items] + ctx['bom_pie_min'] = True + else: + ctx['bom_parts'] = [{ + 'name': a['name'], + 'price': str((a['price'][0] * a['q']) / quantity)} for a in bom_items] return ctx