From 296fbcb52cb400aaeeac16df4d7792d09ee53ebe Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 29 May 2014 19:46:34 +0530 Subject: [PATCH] On cancel, check if doc is linked with other docs --- frappe/model/document.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frappe/model/document.py b/frappe/model/document.py index 8ff78e119d..276ea16470 100644 --- a/frappe/model/document.py +++ b/frappe/model/document.py @@ -400,9 +400,15 @@ class Document(BaseDocument): self.run_method("on_submit") elif self._action=="cancel": self.run_method("on_cancel") + self.check_no_back_links_exist() elif self._action=="update_after_submit": self.run_method("on_update_after_submit") + def check_no_back_links_exist(self): + from frappe.model.delete_doc import check_if_doc_is_linked + if not self.get("ignore_links"): + check_if_doc_is_linked(self, method="Cancel") + @staticmethod def whitelist(f): f.whitelisted = True