Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
ca27ba40 by Cédric Krier at 2023-08-02T19:09:51+02:00
Skip promotion based on categories if line has no product

Closes #12351
- - - - -


1 changed file:

- modules/sale_promotion/sale.py


Changes:

=====================================
modules/sale_promotion/sale.py
=====================================
@@ -266,12 +266,13 @@
             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



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/ca27ba40eda89e3933e595810eab24fe25504ef7

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/ca27ba40eda89e3933e595810eab24fe25504ef7
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to