mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-12 07:54:14 +00:00
Improve pricing display
This commit is contained in:
@ -577,14 +577,32 @@ class PartPricing(AjaxView):
|
||||
if part is None:
|
||||
return ctx
|
||||
|
||||
buy_price = part.get_price_info(quantity, bom=False)
|
||||
bom_price = part.get_price_info(quantity, buy=False)
|
||||
# Supplier pricing information
|
||||
if part.supplier_count > 0:
|
||||
min_buy_price = part.get_min_supplier_price(quantity)
|
||||
max_buy_price = part.get_max_supplier_price(quantity)
|
||||
|
||||
if buy_price:
|
||||
ctx['buy_price'] = buy_price
|
||||
if min_buy_price:
|
||||
ctx['min_total_buy_price'] = min_buy_price
|
||||
ctx['min_unit_buy_price'] = min_buy_price / quantity
|
||||
|
||||
if bom_price:
|
||||
ctx['bom_price'] = bom_price
|
||||
if max_buy_price:
|
||||
ctx['max_total_buy_price'] = max_buy_price
|
||||
ctx['max_unit_buy_price'] = max_buy_price / quantity
|
||||
|
||||
# BOM pricing information
|
||||
if part.bom_count > 0:
|
||||
|
||||
min_bom_price = part.get_min_bom_price(quantity)
|
||||
max_bom_price = part.get_max_bom_price(quantity)
|
||||
|
||||
if min_bom_price:
|
||||
ctx['min_total_bom_price'] = min_bom_price
|
||||
ctx['min_unit_bom_price'] = min_bom_price / quantity
|
||||
|
||||
if max_bom_price:
|
||||
ctx['max_total_bom_price'] = max_bom_price
|
||||
ctx['max_unit_bom_price'] = max_bom_price / quantity
|
||||
|
||||
return ctx
|
||||
|
||||
|
Reference in New Issue
Block a user