fix: added null check for conditions
This commit is contained in:
parent
4668cc64e0
commit
124a218bbf
1 changed files with 4 additions and 1 deletions
|
|
@ -109,12 +109,15 @@ class AssignmentRule(Document):
|
|||
|
||||
def safe_eval(self, fieldname, doc):
|
||||
try:
|
||||
return frappe.safe_eval(self.get(fieldname), None, doc)
|
||||
if self.get(fieldname):
|
||||
return frappe.safe_eval(self.get(fieldname), None, doc)
|
||||
except Exception as e:
|
||||
# when assignment fails, don't block the document as it may be
|
||||
# a part of the email pulling
|
||||
frappe.msgprint(frappe._('Auto assignment failed: {0}').format(str(e)), indicator = 'orange')
|
||||
|
||||
return False
|
||||
|
||||
def get_assignments(doc):
|
||||
return frappe.get_all('ToDo', fields = ['name', 'assignment_rule'], filters = dict(
|
||||
reference_type = doc.get('doctype'),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue