Merge pull request #26976 from resilient-tech/fix-incorrect-modified
fix: Incorrect `modified` time in documents that inherit from `StatusUpdater`
diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py
index 943f7aa..b1f89b0 100644
--- a/erpnext/controllers/status_updater.py
+++ b/erpnext/controllers/status_updater.py
@@ -3,7 +3,7 @@
from __future__ import unicode_literals
import frappe
-from frappe.utils import flt, comma_or, nowdate, getdate
+from frappe.utils import flt, comma_or, nowdate, getdate, now
from frappe import _
from frappe.model.document import Document
@@ -336,10 +336,14 @@
target.notify_update()
def _update_modified(self, args, update_modified):
- args['update_modified'] = ''
- if update_modified:
- args['update_modified'] = ', modified = now(), modified_by = {0}'\
- .format(frappe.db.escape(frappe.session.user))
+ if not update_modified:
+ args['update_modified'] = ''
+ return
+
+ args['update_modified'] = ', modified = {0}, modified_by = {1}'.format(
+ frappe.db.escape(now()),
+ frappe.db.escape(frappe.session.user)
+ )
def update_billing_status_for_zero_amount_refdoc(self, ref_dt):
ref_fieldname = frappe.scrub(ref_dt)