mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Allow BOM pricing to be valid when using internal pricing
This commit is contained in:
parent
fcbb4c593b
commit
c6fd2281d6
@ -1465,16 +1465,16 @@ class Part(MPTTModel):
|
|||||||
return self.supplier_parts.count()
|
return self.supplier_parts.count()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def has_pricing_info(self):
|
def has_pricing_info(self,internal=False):
|
||||||
""" Return true if there is pricing information for this part """
|
""" Return true if there is pricing information for this part """
|
||||||
return self.get_price_range() is not None
|
return self.get_price_range(internal=internal) is not None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def has_complete_bom_pricing(self):
|
def has_complete_bom_pricing(self):
|
||||||
""" Return true if there is pricing information for each item in the BOM. """
|
""" Return true if there is pricing information for each item in the BOM. """
|
||||||
|
use_internal = common.models.get_setting('PART_BOM_USE_INTERNAL_PRICE', False)
|
||||||
for item in self.get_bom_items().all().select_related('sub_part'):
|
for item in self.get_bom_items().all().select_related('sub_part'):
|
||||||
if not item.sub_part.has_pricing_info:
|
if not item.sub_part.has_pricing_info(use_internal):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user