diff --git a/models/sale_coupon_rules.py b/models/sale_coupon_rules.py index 6495b6421b2..a7e9405fa54 100644 --- a/models/sale_coupon_rules.py +++ b/models/sale_coupon_rules.py @@ -28,7 +28,9 @@ class SaleCouponRule(models.Model): @api.constrains('rule_date_to', 'rule_date_from') def _check_rule_date_from(self): - if self.filtered(lambda applicability: applicability.rule_date_to < applicability.rule_date_from): + if any(applicability for applicability in self + if applicability.rule_date_to and applicability.rule_date_from + and applicability.rule_date_to < applicability.rule_date_from): raise ValidationError(_('The start date must be before the end date')) @api.constrains('rule_minimum_amount')