[api] added on_change event in document.py that will be called after any update event, including on_trash

This commit is contained in:
Rushabh Mehta 2016-04-11 11:34:26 +05:30
parent cb44325f39
commit 79203f3ab6
3 changed files with 4 additions and 1 deletions

View file

@ -70,6 +70,7 @@ def delete_doc(doctype=None, name=None, force=0, ignore_doctypes=None, for_reloa
if not ignore_on_trash:
doc.run_method("on_trash")
doc.run_method('on_change')
dynamic_linked_doctypes = [df.parent for df in get_dynamic_link_map().get(doc.doctype, [])]
if "ToDo" in dynamic_linked_doctypes:

View file

@ -656,6 +656,8 @@ class Document(BaseDocument):
elif self._action=="update_after_submit":
self.run_method("on_update_after_submit")
self.run_method('on_change')
self.update_timeline_doc()
self.clear_cache()
self.notify_update()

View file

@ -153,7 +153,7 @@ frappe.Application = Class.extend({
$.each(frappe.boot.notification_info.open_count_doctype, function(doctype, count) {
if(count) {
$('.open-notification[data-doctype="'+ doctype +'"]')
.removeClass("hide").html(count > 99 ? "99+" : count);
.removeClass("hide").html(count > 20 ? "20+" : count);
} else {
$('.open-notification[data-doctype="'+ doctype +'"]')
.addClass("hide");