From a76b1c530d29f05c37820a7187ea2333f50bb85e Mon Sep 17 00:00:00 2001 From: Aditya Duggal Date: Sat, 24 Oct 2020 11:20:24 +0530 Subject: [PATCH] fix: None type error if the Pricing Rule applicable_for is None (#23664) * fix: None type error if the Pricing Rule applicable_for is None * fix: sider Co-authored-by: Nabin Hait Co-authored-by: Saqib --- erpnext/accounts/doctype/pricing_rule/pricing_rule.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py index c5571970595..da0824a97b2 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py @@ -49,9 +49,10 @@ class PricingRule(Document): if self.apply_on == apply_on and len(self.get(field) or []) < 1: throw(_("{0} is not added in the table").format(apply_on), frappe.MandatoryError) - tocheck = frappe.scrub(self.get("applicable_for", "")) - if tocheck and not self.get(tocheck): - throw(_("{0} is required").format(self.meta.get_label(tocheck)), frappe.MandatoryError) + if self.get("applicable_for", "") is not None: + tocheck = frappe.scrub(self.get("applicable_for", "")) + if tocheck and not self.get(tocheck): + throw(_("{0} is required").format(self.meta.get_label(tocheck)), frappe.MandatoryError) if self.apply_rule_on_other: o_field = 'other_' + frappe.scrub(self.apply_rule_on_other)