Skip promotion based on categories if line has no product

Closes #12351
(grafted from ca27ba40eda89e3933e595810eab24fe25504ef7)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier committed 2023-08-02 19:09:51 +02:00
1 parent 944afc59ff
commit a66ece3d4d
1 file changed
+7 -6
+7 -6
View File
@@ -282,12 +282,13 @@ class Promotion(
return False
elif self.products and line.product not in self.products:
return False
elif (self.categories
and not set(parents(line.product.categories_all)).intersection(
self.categories)):
return False
else:
return True
elif self.categories:
if not line.product:
return False
categories = set(parents(line.product.categories_all))
if not categories.intersection(self.categories):
return False
return True
def apply(self, sale):
applied = False