refactor: format value using standard formatters
This commit is contained in:
parent
c538a4a31d
commit
5e3c51bf7d
@ -6,6 +6,7 @@ from __future__ import unicode_literals
|
|||||||
import math
|
import math
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
|
from frappe.utils.formatters import format_value
|
||||||
from frappe.utils import time_diff_in_hours, rounded
|
from frappe.utils import time_diff_in_hours, rounded
|
||||||
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_income_account
|
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_income_account
|
||||||
from erpnext.healthcare.doctype.fee_validity.fee_validity import create_fee_validity
|
from erpnext.healthcare.doctype.fee_validity.fee_validity import create_fee_validity
|
||||||
@ -642,11 +643,15 @@ def render_doc_as_html(doctype, docname, exclude_fields = []):
|
|||||||
html += "<table class='table table-condensed table-bordered'>" \
|
html += "<table class='table table-condensed table-bordered'>" \
|
||||||
+ table_head + table_row + "</table>"
|
+ table_head + table_row + "</table>"
|
||||||
continue
|
continue
|
||||||
|
|
||||||
#on other field types add label and value to html
|
#on other field types add label and value to html
|
||||||
if not df.hidden and not df.print_hide and doc.get(df.fieldname) and df.fieldname not in exclude_fields:
|
if not df.hidden and not df.print_hide and doc.get(df.fieldname) and df.fieldname not in exclude_fields:
|
||||||
html += '<br>{0} : {1}'.format(df.label or df.fieldname, \
|
if doc.get(df.fieldname):
|
||||||
doc.get(df.fieldname))
|
formatted_value = format_value(doc.get(df.fieldname), meta.get_field(df.fieldname), doc)
|
||||||
|
html += '<br>{0} : {1}'.format(df.label or df.fieldname, formatted_value)
|
||||||
|
|
||||||
if not has_data : has_data = True
|
if not has_data : has_data = True
|
||||||
|
|
||||||
if sec_on and col_on and has_data:
|
if sec_on and col_on and has_data:
|
||||||
doc_html += section_html + html + '</div></div>'
|
doc_html += section_html + html + '</div></div>'
|
||||||
elif sec_on and not col_on and has_data:
|
elif sec_on and not col_on and has_data:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user