From fb5d678b0cc3a7af4363d2edc10623b1dc5a99cc Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 11 Apr 2018 00:38:19 -0800 Subject: [PATCH] [minor] cache refactor and workflow docs (#13598) --- .../docs/user/manual/en/setting-up/workflows.md | 16 ++++++++++++++-- erpnext/setup/doctype/company/company.py | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/erpnext/docs/user/manual/en/setting-up/workflows.md b/erpnext/docs/user/manual/en/setting-up/workflows.md index 731fb3d48b..e5e4c443a5 100644 --- a/erpnext/docs/user/manual/en/setting-up/workflows.md +++ b/erpnext/docs/user/manual/en/setting-up/workflows.md @@ -42,9 +42,21 @@ submit button / option if you have not specified it in the workflow. > Note 4: If you wish to give the option to cancel, you will have to write a workflow transition step that says from submitted you can cancel. - +#### Conditions -#### Example of a Leave Application Process: +> New in Version 11 + +In Version 11, you can also add a condition for the transition to be applicable. For example in this case if someone applies to leave for more than 5 days, a particular role must approve. For this in the particular transition you can set a property for `Condition` as: + +``` +doc.total_leave_days <= 5 +``` + +Then if someone applied for leave for less than 5 days, only that particular transition will apply. + +This can be extended to any property of the document. + +#### Example of a Leave Application Process: When a Leave Application is saved by Employee, the status of the document changes to "Applied" diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index edb36fc771..cdcb0591c7 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -7,7 +7,7 @@ from frappe import _ from frappe.utils import cint, today, formatdate import frappe.defaults - +from frappe.cache_manager import clear_defaults_cache from frappe.model.document import Document from frappe.contacts.address_and_contact import load_address_and_contact @@ -240,7 +240,7 @@ class Company(Document): frappe.db.sql("""update `tabDefaultValue` set defvalue=%s where defkey='Company' and defvalue=%s""", (newdn, olddn)) - frappe.defaults.clear_cache() + clear_defaults_cache() def abbreviate(self): self.abbr = ''.join([c[0].upper() for c in self.company_name.split()])