diff options
| author | Nicolas Lempereur <nle@odoo.com> | 2017-10-04 16:56:00 +0200 |
|---|---|---|
| committer | Nicolas Lempereur <nle@odoo.com> | 2017-10-04 19:12:40 +0200 |
| commit | 8aef2eb92d97c6f401d2b03a3ab00fe2e352d017 (patch) | |
| tree | 710989a23a2610d5680f65be41c880160b7c39c8 | |
| parent | 29a5de310e782a4b063630a9a4f997946e3ce1c6 (diff) | |
[FIX] sale_coupon: error only one of begin/end set
If a promotion program has a start date without a end date, or a end
date without a start date, there was an error of comparing string to
boolean
opw-775236
| -rw-r--r-- | models/sale_coupon_rules.py | 4 |
1 files changed, 3 insertions, 1 deletions
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') |
