[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
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user