mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +00:00
Supplier pricing override (#3988)
* Adds new option for overriding supplier price break pricing data * Add logic for overriding supplier part pricing with historical information * Prevent caching
This commit is contained in:
@ -2620,11 +2620,17 @@ class PartPricing(models.Model):
|
||||
self.internal_cost_max,
|
||||
]
|
||||
|
||||
if InvenTreeSetting.get_setting('PRICING_USE_SUPPLIER_PRICING', True):
|
||||
min_costs.append(self.supplier_price_min)
|
||||
max_costs.append(self.supplier_price_max)
|
||||
purchase_history_override = InvenTreeSetting.get_setting('PRICING_PURCHASE_HISTORY_OVERRIDES_SUPPLIER', False, cache=False)
|
||||
|
||||
if InvenTreeSetting.get_setting('PRICING_USE_VARIANT_PRICING', True):
|
||||
if InvenTreeSetting.get_setting('PRICING_USE_SUPPLIER_PRICING', True, cache=False):
|
||||
# Add supplier pricing data, *unless* historical pricing information should override
|
||||
if self.purchase_cost_min is None or not purchase_history_override:
|
||||
min_costs.append(self.supplier_price_min)
|
||||
|
||||
if self.purchase_cost_max is None or not purchase_history_override:
|
||||
max_costs.append(self.supplier_price_max)
|
||||
|
||||
if InvenTreeSetting.get_setting('PRICING_USE_VARIANT_PRICING', True, cache=False):
|
||||
min_costs.append(self.variant_cost_min)
|
||||
max_costs.append(self.variant_cost_max)
|
||||
|
||||
|
Reference in New Issue
Block a user