Add "before_validate" hook to document.py (#6112)
Reference: https://discuss.erpnext.com/t/override-default-validation/20622/5 The addition of a `before_validate` hook makes it possible to override validation methods. This feature has been requested in numerous threads. See: https://discuss.erpnext.com/t/override-controllers-events/25723/2 https://discuss.erpnext.com/t/is-method-overriding-in-frappe-possible/9225/19 https://discuss.erpnext.com/t/how-to-override-method-in-frappe/28786/8
This commit is contained in:
parent
80e5ae54b3
commit
ce6446adc2
1 changed files with 2 additions and 0 deletions
|
|
@ -875,9 +875,11 @@ class Document(BaseDocument):
|
|||
return
|
||||
|
||||
if self._action=="save":
|
||||
self.run_method("before_validate")
|
||||
self.run_method("validate")
|
||||
self.run_method("before_save")
|
||||
elif self._action=="submit":
|
||||
self.run_method("before_validate")
|
||||
self.run_method("validate")
|
||||
self.run_method("before_submit")
|
||||
elif self._action=="cancel":
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue