Run Method, call hook methods even if method does not exist in controller
This commit is contained in:
parent
a905ce48eb
commit
521ea1a7ac
2 changed files with 6 additions and 2 deletions
|
|
@ -267,6 +267,7 @@ class BaseDocument(object):
|
|||
|
||||
docname = self.get(df.fieldname)
|
||||
if docname:
|
||||
# MySQL is case insensitive. Preserve case of the original docname in the Link Field.
|
||||
value = frappe.db.get_value(doctype, docname)
|
||||
setattr(self, df.fieldname, value)
|
||||
if docname and not value:
|
||||
|
|
|
|||
|
|
@ -371,8 +371,11 @@ class Document(BaseDocument):
|
|||
"""run standard triggers, plus those in frappe"""
|
||||
if hasattr(self, method):
|
||||
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
|
||||
fn.__name__ = method.encode("utf-8")
|
||||
return Document.hook(fn)(self, *args, **kwargs)
|
||||
else:
|
||||
fn = lambda self, *args, **kwargs: None
|
||||
|
||||
fn.__name__ = method.encode("utf-8")
|
||||
return Document.hook(fn)(self, *args, **kwargs)
|
||||
|
||||
def submit(self):
|
||||
self.docstatus = 1
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue