Skip to content

Commit

Permalink
[FIX] sale_loyalty_criteria_order_based: Do not evaluate False domain
Browse files Browse the repository at this point in the history
In case a promotion is created without defining any domain on the UI,
an error message 'Invalid domain on rule' would appear.

Avoiding  evaluation of the field if its value is Falsish removes the
error.
  • Loading branch information
grindtildeath committed Jan 6, 2025
1 parent 1a29aa7 commit 872fe5b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sale_loyalty_criteria_order_based/models/loyalty_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class LoyaltyRule(models.Model):
def _constrain_rule_order_domain(self):
model = self.env["sale.order"]
for rule in self:
if not rule.rule_order_domain:
continue
try:
domain = ast.literal_eval(rule.rule_order_domain)
# Ensuring that domain is valid for sale.order
Expand Down

0 comments on commit 872fe5b

Please sign in to comment.