fix: Price rule filtering in case of no doc

This commit is contained in:
Deepesh Garg 2020-08-17 23:47:58 +05:30
parent d9accededa
commit 1067f7ed3e
2 changed files with 3 additions and 1 deletions

View File

@ -145,7 +145,7 @@ class PricingRule(Document):
def validate_condition(self):
if self.condition and ("=" in self.condition) and re.match("""[\w\.:_]+\s*={1}\s*[\w\.@'"]+""", self.condition):
frappe.throw(_("Invalid condition in Pricing Rule - {0}").format(pricing_rule.name), frappe.ValidationError)
frappe.throw(_("Invalid condition expression"))
#--------------------------------------------------------------------------------

View File

@ -66,6 +66,8 @@ def filter_pricing_rule_based_on_condition(pricing_rules, doc=None):
str(e).capitalize() + "<br><br>Ignoring Pricing Rule"), indicator="orange", title=_("Warning"))
else:
filtered_pricing_rules.append(pricing_rule)
else:
filtered_pricing_rules = pricing_rules
return filtered_pricing_rules