From c6fd2281d689309007b06c46560e6f446ee931bd Mon Sep 17 00:00:00 2001 From: rgilham Date: Thu, 24 Jun 2021 02:13:55 +0200 Subject: [PATCH 1/2] Allow BOM pricing to be valid when using internal pricing --- InvenTree/part/models.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 8ddf049216..53f9a51595 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -1465,16 +1465,16 @@ class Part(MPTTModel): return self.supplier_parts.count() @property - def has_pricing_info(self): + def has_pricing_info(self,internal=False): """ 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 def has_complete_bom_pricing(self): """ 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'): - if not item.sub_part.has_pricing_info: + if not item.sub_part.has_pricing_info(use_internal): return False return True From 8d2e9103232fbe2c29c16dc0376f27e1ca001e42 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 19 Jul 2021 21:50:06 +0200 Subject: [PATCH 2/2] style fix --- InvenTree/part/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 53f9a51595..c38f39738a 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -1465,7 +1465,7 @@ class Part(MPTTModel): return self.supplier_parts.count() @property - def has_pricing_info(self,internal=False): + def has_pricing_info(self, internal=False): """ Return true if there is pricing information for this part """ return self.get_price_range(internal=internal) is not None