[minor] [fixes] sort order in list view and markdown in print format

This commit is contained in:
Rushabh Mehta 2016-08-08 10:54:19 +05:30
parent ae659a4ad0
commit 1e3952f262
3 changed files with 15 additions and 4 deletions

View file

@ -468,7 +468,7 @@ frappe.views.DocListView = frappe.ui.Listing.extend({
args.filters.push(f);
});
args.order_by = this.sort_selector.sort_by + ' ' + this.sort_selector.sort_order;
args.order_by = '`tab' + this.doctype + '`.`' + this.sort_selector.sort_by + '` ' + this.sort_selector.sort_order;
return args;
},

View file

@ -8,7 +8,7 @@
data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<span class="dropdown-text">{{ __(sort_by_label) }}</span>
</a>
<ul class="dropdown-menu">
<ul class="dropdown-menu" style="max-height: 300px; overflow-y: scroll;">
{% for value in options %}
<li><a class="option" data-value="{{ value.fieldname }}">
{{ __(value.label) }}</a></li>

View file

@ -9,7 +9,7 @@ from frappe import _
from frappe.modules import get_doc_path
from jinja2 import TemplateNotFound
from frappe.utils import cint, strip_html
from frappe.utils.pdf import get_pdf
from markdown2 import markdown
no_cache = 1
no_sitemap = 1
@ -108,7 +108,7 @@ def get_html(doc, name=None, print_format=None, meta=None,
doc.format_data_map = format_data_map
template = "standard"
elif print_format.standard=="Yes" or print_format.custom_format:
template = jenv.from_string(get_print_format(doc.doctype,
print_format))
@ -125,6 +125,9 @@ def get_html(doc, name=None, print_format=None, meta=None,
template = jenv.get_template(standard_format)
letter_head = frappe._dict(get_letter_head(doc, no_letterhead) or {})
convert_markdown(doc, meta)
args = {
"doc": doc,
"meta": frappe.get_meta(doc.doctype),
@ -143,6 +146,14 @@ def get_html(doc, name=None, print_format=None, meta=None,
return html
def convert_markdown(doc, meta):
'''Convert text field values to markdown if necessary'''
for field in meta.fields:
if field.fieldtype=='Text Editor':
value = doc.get(field.fieldname)
if value and '<!-- markdown -->' in value:
doc.set(field.fieldname, markdown(value))
@frappe.whitelist()
def get_html_and_style(doc, name=None, print_format=None, meta=None,
no_letterhead=None, trigger_print=False):