mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 08:54:45 +00:00
[minor] added safe_eval for status_updater and added getdate and nowdate (#8365)
This commit is contained in:
committed by
Rushabh Mehta
parent
b58979fd3e
commit
4782e8b751
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import flt, comma_or
|
from frappe.utils import flt, comma_or, nowdate, getdate
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ class StatusUpdater(Document):
|
|||||||
self.status = s[0]
|
self.status = s[0]
|
||||||
break
|
break
|
||||||
elif s[1].startswith("eval:"):
|
elif s[1].startswith("eval:"):
|
||||||
if eval(s[1][5:]):
|
if frappe.safe_eval(s[1][5:], None, { "self": self.as_dict(), "getdate": getdate, "nowdate": nowdate }):
|
||||||
self.status = s[0]
|
self.status = s[0]
|
||||||
break
|
break
|
||||||
elif getattr(self, s[1])():
|
elif getattr(self, s[1])():
|
||||||
|
|||||||
Reference in New Issue
Block a user