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 <nabinhait@gmail.com>
Co-authored-by: Saqib <nextchamp.saqib@gmail.com>
This commit is contained in:
Aditya Duggal
2020-10-24 11:20:24 +05:30
committed by GitHub
parent aef8010bc1
commit a76b1c530d

View File

@@ -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)