Merge branch 'staging' into develop
This commit is contained in:
commit
22f4433406
11 changed files with 73 additions and 48 deletions
|
|
@ -17,7 +17,7 @@ from faker import Faker
|
|||
from .exceptions import *
|
||||
from .utils.jinja import (get_jenv, get_template, render_template, get_email_from_template, get_jloader)
|
||||
|
||||
__version__ = '10.1.60'
|
||||
__version__ = '10.1.61'
|
||||
__title__ = "Frappe Framework"
|
||||
|
||||
local = Local()
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ def create_csv_file(columns, data, dt, dn):
|
|||
new_row = []
|
||||
for col in columns:
|
||||
key = col.get('fieldname') or col.get('label')
|
||||
new_row.append(frappe.format(row.get(key, ''), col))
|
||||
new_row.append(row.get(key, ''))
|
||||
rows.append(new_row)
|
||||
|
||||
rows = [tuple(columns_without_meta)] + rows
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ source_link = "https://github.com/frappe/frappe"
|
|||
app_license = "MIT"
|
||||
|
||||
develop_version = '12.x.x-develop'
|
||||
staging_version = '11.0.3-beta.25'
|
||||
staging_version = '11.0.3-beta.26'
|
||||
|
||||
app_email = "info@frappe.io"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.flags.in_patch = True
|
||||
frappe.reload_doc('core', 'doctype', 'user_permission')
|
||||
frappe.db.commit()
|
||||
frappe.db.commit()
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import cint
|
||||
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
|
@ -31,3 +32,11 @@ class PrintSettings(Document):
|
|||
except ValidationError:
|
||||
frappe.throw(_("Failed to connect to server"))
|
||||
return printer_list
|
||||
|
||||
@frappe.whitelist()
|
||||
def is_print_server_enabled():
|
||||
if not hasattr(frappe.local, 'enable_print_server'):
|
||||
frappe.local.enable_print_server = cint(frappe.db.get_single_value('Print Settings',
|
||||
'enable_print_server'))
|
||||
|
||||
return frappe.local.enable_print_server
|
||||
|
|
|
|||
|
|
@ -171,7 +171,9 @@ frappe.ui.form.ControlTextEditor = frappe.ui.form.ControlCode.extend({
|
|||
return;
|
||||
}
|
||||
|
||||
this.quill.root.innerHTML = value;
|
||||
// set html without triggering a focus
|
||||
const delta = this.quill.clipboard.convert({ html: value, text: '' });
|
||||
this.quill.setContents(delta);
|
||||
},
|
||||
|
||||
get_input_value() {
|
||||
|
|
|
|||
|
|
@ -158,35 +158,25 @@ frappe.ui.form.PrintPreview = Class.extend({
|
|||
let print_server ;
|
||||
var me = this;
|
||||
frappe.call({
|
||||
async: false,
|
||||
"method": "frappe.client.get",
|
||||
args: {
|
||||
doctype: "Print Settings",
|
||||
name: "enable_print_server"
|
||||
},
|
||||
method: "frappe.printing.doctype.print_settings.print_settings.is_print_server_enabled",
|
||||
callback: function (data) {
|
||||
print_server = data.message.enable_print_server;
|
||||
if (data.message) {
|
||||
frappe.call({
|
||||
"method": "frappe.utils.print_format.print_by_server",
|
||||
args: {
|
||||
doctype: me.frm.doc.doctype,
|
||||
name: me.frm.doc.name,
|
||||
print_format: me.selected_format(),
|
||||
no_letterhead: me.with_letterhead()
|
||||
},
|
||||
callback: function (data) {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
me.new_page_preview(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if(print_server){
|
||||
frappe.call({
|
||||
async: false,
|
||||
"method": "frappe.utils.print_format.print_by_server",
|
||||
args: {
|
||||
doctype: me.frm.doc.doctype,
|
||||
name: me.frm.doc.name,
|
||||
print_format: me.selected_format(),
|
||||
no_letterhead: me.with_letterhead()
|
||||
},
|
||||
callback: function (data) {
|
||||
}
|
||||
});
|
||||
|
||||
}else{
|
||||
this.new_page_preview(true);
|
||||
}
|
||||
|
||||
},
|
||||
new_page_preview: function (printit) {
|
||||
var me = this;
|
||||
|
|
|
|||
|
|
@ -1127,7 +1127,7 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
|
|||
let doctype = null;
|
||||
let value = frappe.route_options[field];
|
||||
|
||||
if (value.startsWith('[') && value.endsWith(']')) {
|
||||
if (typeof value === 'string' && value.startsWith('[') && value.endsWith(']')) {
|
||||
value = JSON.parse(value);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ frappe.ui.FieldSelect = Class.extend({
|
|||
|
||||
// child tables
|
||||
$.each(me.table_fields, function(i, table_df) {
|
||||
if(table_df.options && !table_df.hidden) {
|
||||
if(table_df.options) {
|
||||
var child_table_fields = [].concat(frappe.meta.docfield_list[table_df.options]);
|
||||
$.each(frappe.utils.sort(child_table_fields, "label", "string"), function(i, df) {
|
||||
// show fields where user has read access and if report hide flag is not set
|
||||
|
|
@ -145,7 +145,7 @@ frappe.ui.FieldSelect = Class.extend({
|
|||
}
|
||||
|
||||
if(frappe.model.no_value_type.indexOf(df.fieldtype) == -1 &&
|
||||
!(me.fields_by_name[df.parent] && me.fields_by_name[df.parent][df.fieldname]) && !df.hidden) {
|
||||
!(me.fields_by_name[df.parent] && me.fields_by_name[df.parent][df.fieldname])) {
|
||||
this.options.push({
|
||||
label: label,
|
||||
value: table + "." + df.fieldname,
|
||||
|
|
|
|||
|
|
@ -642,7 +642,7 @@ frappe.ui.FieldSelect = Class.extend({
|
|||
|
||||
// child tables
|
||||
$.each(me.table_fields, function(i, table_df) {
|
||||
if(table_df.options && !table_df.hidden) {
|
||||
if(table_df.options) {
|
||||
var child_table_fields = [].concat(frappe.meta.docfield_list[table_df.options]);
|
||||
$.each(frappe.utils.sort(child_table_fields, "label", "string"), function(i, df) {
|
||||
// show fields where user has read access and if report hide flag is not set
|
||||
|
|
@ -664,7 +664,7 @@ frappe.ui.FieldSelect = Class.extend({
|
|||
var table = df.parent;
|
||||
}
|
||||
if(frappe.model.no_value_type.indexOf(df.fieldtype) == -1 &&
|
||||
!(me.fields_by_name[df.parent] && me.fields_by_name[df.parent][df.fieldname]) && !df.hidden) {
|
||||
!(me.fields_by_name[df.parent] && me.fields_by_name[df.parent][df.fieldname])) {
|
||||
this.options.push({
|
||||
label: label,
|
||||
value: table + "." + df.fieldname,
|
||||
|
|
|
|||
|
|
@ -732,17 +732,29 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
|
|||
return;
|
||||
}
|
||||
|
||||
this.export_dialog = frappe.prompt({
|
||||
label: __('Select File Format'),
|
||||
fieldname: 'file_format',
|
||||
fieldtype: 'Select',
|
||||
options: ['Excel', 'CSV'],
|
||||
default: 'Excel',
|
||||
reqd: 1
|
||||
}, ({ file_format }) => {
|
||||
this.export_dialog = frappe.prompt([
|
||||
{
|
||||
label: __('Select File Format'),
|
||||
fieldname: 'file_format',
|
||||
fieldtype: 'Select',
|
||||
options: ['Excel', 'CSV'],
|
||||
default: 'Excel',
|
||||
reqd: 1,
|
||||
onchange: () => {
|
||||
this.export_dialog.set_df_property('with_indentation',
|
||||
'hidden', this.export_dialog.get_value('file_format') !== 'CSV');
|
||||
}
|
||||
},
|
||||
{
|
||||
label: __('With Group Indentation'),
|
||||
fieldname: 'with_indentation',
|
||||
fieldtype: 'Check',
|
||||
hidden: 1
|
||||
}
|
||||
], ({ file_format, with_indentation }) => {
|
||||
if (file_format === 'CSV') {
|
||||
const column_row = this.columns.map(col => col.label);
|
||||
const data = this.get_data_for_csv();
|
||||
const data = this.get_data_for_csv(with_indentation);
|
||||
const out = [column_row].concat(data);
|
||||
|
||||
frappe.tools.downloadify(out, null, this.report_name);
|
||||
|
|
@ -765,10 +777,21 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
|
|||
}, __('Export Report: '+ this.report_name), __('Download'));
|
||||
}
|
||||
|
||||
get_data_for_csv() {
|
||||
get_data_for_csv(with_indentation = false) {
|
||||
|
||||
const indices = this.datatable.datamanager.getFilteredRowIndices();
|
||||
const out = indices.map(i => this.datatable.datamanager.getRow(i).map(c => c.content));
|
||||
return out.map(row => row.slice(1));
|
||||
const rows = indices.map(i => this.datatable.datamanager.getRow(i));
|
||||
return rows.map(row => {
|
||||
const standard_column_count = this.datatable.datamanager.getStandardColumnCount();
|
||||
return row
|
||||
.slice(standard_column_count)
|
||||
.map((cell, i) => {
|
||||
if (with_indentation && i === 0) {
|
||||
return ' '.repeat(row.meta.indent) + cell.content;
|
||||
}
|
||||
return cell.content;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
get_data_for_print() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue