Merge pull request #15492 from resilient-tech/fix-clear-cache-in-set-value

fix: clear cache for all docs matched with the filters passed as `dn` param in `set_value`
This commit is contained in:
mergify[bot] 2022-01-05 07:06:07 +00:00 committed by GitHub
commit 96a45473ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -704,6 +704,8 @@ class Database(object):
self.sql("""update `tab{0}`
set {1} where name=%(name)s""".format(dt, ', '.join(set_values)),
values, debug=debug)
frappe.clear_document_cache(dt, values['name'])
else:
# for singles
keys = list(to_update)
@ -716,10 +718,11 @@ class Database(object):
self.sql('''insert into `tabSingles` (doctype, field, value) values (%s, %s, %s)''',
(dt, key, value), debug=debug)
frappe.clear_document_cache(dt, dn)
if dt in self.value_cache:
del self.value_cache[dt]
frappe.clear_document_cache(dt, dn)
@staticmethod
def set(doc, field, val):