[minor] added frappe.format and validate_payment in web_form.html
This commit is contained in:
parent
9fd29e658a
commit
c36055d29e
4 changed files with 15 additions and 0 deletions
|
|
@ -1144,6 +1144,14 @@ def format_value(*args, **kwargs):
|
|||
import frappe.utils.formatters
|
||||
return frappe.utils.formatters.format_value(*args, **kwargs)
|
||||
|
||||
def format(*args, **kwargs):
|
||||
"""Format value with given field properties.
|
||||
|
||||
:param value: Value to be formatted.
|
||||
:param df: (Optional) DocField object with properties `fieldtype`, `options` etc."""
|
||||
import frappe.utils.formatters
|
||||
return frappe.utils.formatters.format_value(*args, **kwargs)
|
||||
|
||||
def get_print(doctype=None, name=None, print_format=None, style=None, html=None, as_pdf=False, doc=None):
|
||||
"""Get Print Format for given document.
|
||||
|
||||
|
|
|
|||
|
|
@ -657,6 +657,9 @@ class Document(BaseDocument):
|
|||
|
||||
return out
|
||||
|
||||
def run_trigger(self, method, *args, **kwargs):
|
||||
return self.run_method(method, *args, **kwargs)
|
||||
|
||||
def run_email_alerts(self, method):
|
||||
'''Run email alerts for this method'''
|
||||
if frappe.flags.in_import or frappe.flags.in_patch or frappe.flags.in_install:
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ import re
|
|||
def format_value(value, df=None, doc=None, currency=None, translated=False):
|
||||
'''Format value based on given fieldtype, document reference, currency reference.
|
||||
If docfield info (df) is not given, it will try and guess based on the datatype of the value'''
|
||||
if isinstance(df, basestring):
|
||||
df = frappe._dict(fieldtype=df)
|
||||
|
||||
if not df:
|
||||
df = frappe._dict()
|
||||
if isinstance(value, datetime.datetime):
|
||||
|
|
|
|||
|
|
@ -358,6 +358,7 @@ def accept(web_form, data, for_payment=False):
|
|||
|
||||
if for_payment:
|
||||
web_form.validate_mandatory(doc)
|
||||
doc.run_method('validate_payment')
|
||||
|
||||
if doc.name:
|
||||
if has_web_form_permission(doc.doctype, doc.name, "write"):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue