Merge branch 'develop' into show-hidden-fields-report-builder-d

This commit is contained in:
Faris Ansari 2019-04-16 23:57:38 +05:30 committed by GitHub
commit 294b00f93e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 37 additions and 38 deletions

View file

@ -1,4 +1,3 @@
{
"baseUrl": "http://test_site_ui:8000",
"projectId": "92odwv"
"baseUrl": "http://test_site_ui:8000"
}

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

@ -156,22 +156,6 @@ def get_period_ending(date, timegrain):
return getdate(date)
def get_period_beginning(date, timegrain):
if timegrain=='Daily':
return getdate(date)
ending = get_period_ending(date, timegrain)
beginning = None
if timegrain=='Weekly':
beginning = add_to_date(add_to_date(ending, weeks=-1), days = 1)
elif timegrain=='Monthly':
beginning = add_to_date(add_to_date(ending, months=-1), days = 1)
elif timegrain=='Quarterly':
beginning = add_to_date(add_to_date(ending, months=-3), days = 1)
return getdate(beginning)
def get_week_ending(date):
# fun fact: week ends on the day before 1st Jan of the year.
# for 2019 it is Monday

View file

@ -6,7 +6,7 @@ from __future__ import unicode_literals
import unittest, frappe
from frappe.utils import getdate
from frappe.desk.doctype.dashboard_chart.dashboard_chart import (get,
get_period_ending, get_period_beginning)
get_period_ending)
class TestDashboardChart(unittest.TestCase):
def test_period_ending(self):
@ -32,15 +32,6 @@ class TestDashboardChart(unittest.TestCase):
self.assertEqual(get_period_ending('2019-10-01', 'Quarterly'),
getdate('2019-12-31'))
def test_get_period_beginning(self):
self.assertEqual(get_period_beginning('2019-02-02', 'Monthly'),
getdate('2019-02-01'))
self.assertEqual(get_period_beginning('2019-02-02', 'Quarterly'),
getdate('2019-01-01'))
self.assertEqual(get_period_beginning('2019-01-29', 'Weekly'),
getdate('2019-02-01'))
def test_dashboard_chart(self):
if frappe.db.exists('Dashboard Chart', 'Test Dashboard Chart'):
frappe.delete_doc('Dashboard Chart', 'Test Dashboard Chart')

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%;

View file

@ -4,7 +4,7 @@
"build": "node rollup/build.js",
"production": "FRAPPE_ENV=production node rollup/build.js",
"watch": "node rollup/watch.js",
"cypress:run": "cypress run --record --key 14ddd919-b01f-4d5f-b9d1-5af54d34c7f3",
"cypress:run": "cypress run",
"cypress:open": "cypress open"
},
"repository": {