Merge branch 'develop' of https://github.com/frappe/frappe into doctype-fix

This commit is contained in:
deepeshgarg007 2019-04-16 21:26:46 +05:30
commit 21bc4552df
8 changed files with 37 additions and 10 deletions

View file

@ -35,7 +35,7 @@ class TestComment(unittest.TestCase):
frappe.db.sql("delete from `tabComment` where reference_doctype = 'Blog Post'")
from frappe.templates.includes.comments.comments import add_comment
add_comment('hello', 'test@test.com', 'Good Tester',
add_comment('Good comment with 10 chars', 'test@test.com', 'Good Tester',
'Blog Post', test_blog.name, test_blog.route)
self.assertEqual(frappe.get_all('Comment', fields = ['*'], filters = dict(

View file

@ -37,6 +37,15 @@ class PreparedReport(Document):
def run_background(instance):
report = frappe.get_doc("Report", instance.ref_report_doctype)
report.custom_columns = []
if report.report_type == 'Custom Report':
custom_report_doc = report
reference_report = custom_report_doc.reference_report
report = frappe.get_doc("Report", reference_report)
report.custom_columns = custom_report_doc.json
result = generate_report_result(report, filters=instance.filters, user=instance.owner)
create_json_gz_file(result['result'], 'Prepared Report', instance.name)

View file

@ -145,7 +145,9 @@ def get_next_expected_date(date, timegrain):
def get_period_ending(date, timegrain):
date = getdate(date)
if timegrain=='Weekly':
if timegrain=='Daily':
pass
elif timegrain=='Weekly':
date = get_week_ending(date)
elif timegrain=='Monthly':
date = get_month_ending(date)

View file

@ -137,7 +137,7 @@ def search_widget(doctype, txt, query=None, searchfield=None, start=0,
from frappe.model.db_query import get_order_by
order_by_based_on_meta = get_order_by(doctype, meta)
# 2 is the index of _relevance column
order_by = "2 , {0}, `tab{1}`.idx desc".format(order_by_based_on_meta, doctype)
order_by = "_relevance, {0}, `tab{1}`.idx desc".format(order_by_based_on_meta, doctype)
ignore_permissions = True if doctype == "DocType" else (cint(ignore_user_permissions) and has_permission(doctype))

View file

@ -297,7 +297,6 @@ input.list-row-checkbox {
justify-content: center;
position: relative;
height: 200px;
padding: 15px;
}
.image-view-container .image-field img {
max-height: 100%;

View file

@ -30,7 +30,8 @@ frappe.call = function(opts) {
indicator: 'orange',
message: __('You are not connected to Internet. Retry after sometime.')
}, 3);
return;
opts.always && opts.always();
return $.ajax();
}
if (typeof arguments[0]==='string') {
opts = {

View file

@ -23,6 +23,7 @@ frappe.views.ImageView = class ImageView extends frappe.views.ListView {
set_fields() {
this.fields = [
'name',
...this.get_fields_in_list_view().map((el)=> el.fieldname),
this.meta.title_field,
this.meta.image_field
];
@ -61,6 +62,19 @@ frappe.views.ImageView = class ImageView extends frappe.views.ListView {
`);
}
item_details_html(item) {
const info_fields = this.get_fields_in_list_view().map((el)=> el.fieldname) || [];
let info_html = `<div><ul class="list-unstyled image-view-info">`;
info_fields.forEach((field, index) => {
if (item[field]) {
if (index == 0) info_html += `<li>${item[field]}</li>`;
else info_html += `<li class="text-muted">${item[field]}</li>`;
}
})
info_html += `</ul></div>`;
return info_html;
}
item_html(item) {
item._name = encodeURI(item.name);
const encoded_name = item._name;
@ -72,6 +86,8 @@ frappe.views.ImageView = class ImageView extends frappe.views.ListView {
${ frappe.get_abbr(title) }
</span>`;
let details = this.item_details_html(item);
return `
<div class="image-view-item">
<div class="image-view-header">
@ -94,6 +110,7 @@ frappe.views.ImageView = class ImageView extends frappe.views.ListView {
</div>
</a>
</div>
${details}
</div>
`;
}

View file

@ -312,15 +312,15 @@ input.list-check-all, input.list-row-checkbox {
.image-view-item:nth-child(4n) {
border-right: none;
}
.image-view-item:nth-last-child(-n + 4):nth-child(4n + 1),
.image-view-item:nth-last-child(-n + 4):nth-child(4n + 1) ~ .image-view-item {
border-bottom: none;
}
.image-view-header {
margin-bottom: 10px;
}
.image-view-info {
margin-top: 10px;
}
.image-view-body {
&:hover .zoom-view {
opacity: 0.7;
@ -338,7 +338,6 @@ input.list-check-all, input.list-row-checkbox {
justify-content: center;
position: relative;
height: 200px;
padding: 15px;
img {
max-height: 100%;