diff --git a/frappe/desk/leaderboard.py b/frappe/desk/leaderboard.py index 8d00ea9bc2..2a981f061b 100644 --- a/frappe/desk/leaderboard.py +++ b/frappe/desk/leaderboard.py @@ -16,8 +16,18 @@ def get_leaderboards(): @frappe.whitelist() def get_energy_point_leaderboard(date_range, company = None, field = None, limit = None): + all_users = frappe.db.get_all('User', + filters = { + 'name': ['not in', ['Administrator', 'Guest']], + 'enabled': 1, + 'user_type': ['!=', 'Website User'] + }, + order_by = 'name ASC') + all_users_list = list(map(lambda x: x['name'], all_users)) + filters = [ ['type', '!=', 'Review'], + ['user', 'in', all_users_list] ] if date_range: date_range = frappe.parse_json(date_range) @@ -28,15 +38,7 @@ def get_energy_point_leaderboard(date_range, company = None, field = None, limit group_by = 'user', order_by = 'value desc' ) - all_users = frappe.db.get_all('User', - filters = { - 'name': ['not in', ['Administrator', 'Guest']], - 'enabled': 1, - 'user_type': ['!=', 'Website User'] - }, - order_by = 'name ASC') - all_users_list = list(map(lambda x: x['name'], all_users)) energy_point_users_list = list(map(lambda x: x['name'], energy_point_users)) for user in all_users_list: if user not in energy_point_users_list: diff --git a/frappe/printing/doctype/print_format/print_format.json b/frappe/printing/doctype/print_format/print_format.json index 92d4a67d14..4032cef209 100644 --- a/frappe/printing/doctype/print_format/print_format.json +++ b/frappe/printing/doctype/print_format/print_format.json @@ -171,7 +171,7 @@ "fieldname": "custom_html_help", "fieldtype": "HTML", "label": "Custom HTML Help", - "options": "

Custom CSS Help

\n\n

Notes:

\n\n
    \n
  1. All field groups (label + value) are set attributes data-fieldtype and data-fieldname
  2. \n
  3. All values are given class value
  4. \n
  5. All Section Breaks are given class section-break
  6. \n
  7. All Column Breaks are given class column-break
  8. \n
\n\n

Examples

\n\n

1. Left align integers

\n\n
[data-fieldtype=\"Int\"] .value { text-left: left; }
\n\n

1. Add border to sections except the last section

\n\n
.section-break { padding: 30px 0px; border-bottom: 1px solid #eee; }\n.section-break:last-child { padding-bottom: 0px; border-bottom: 0px;  }
\n" + "options": "

Custom CSS Help

\n\n

Notes:

\n\n
    \n
  1. All field groups (label + value) are set attributes data-fieldtype and data-fieldname
  2. \n
  3. All values are given class value
  4. \n
  5. All Section Breaks are given class section-break
  6. \n
  7. All Column Breaks are given class column-break
  8. \n
\n\n

Examples

\n\n

1. Left align integers

\n\n
[data-fieldtype=\"Int\"] .value { text-align: left; }
\n\n

1. Add border to sections except the last section

\n\n
.section-break { padding: 30px 0px; border-bottom: 1px solid #eee; }\n.section-break:last-child { padding-bottom: 0px; border-bottom: 0px;  }
\n" }, { "depends_on": "custom_format", @@ -211,7 +211,7 @@ "idx": 1, "index_web_pages_for_search": 1, "links": [], - "modified": "2020-12-14 11:38:49.132061", + "modified": "2021-03-01 15:25:46.578863", "modified_by": "Administrator", "module": "Printing", "name": "Print Format", diff --git a/frappe/printing/page/print/print.js b/frappe/printing/page/print/print.js index 0ae8786e95..dfd93c4efa 100644 --- a/frappe/printing/page/print/print.js +++ b/frappe/printing/page/print/print.js @@ -269,6 +269,7 @@ frappe.ui.form.PrintView = class { based_on: data.based_on, }; frappe.set_route('print-format-builder'); + this.print_sel.val(data.print_format_name); }, __('New Custom Print Format'), __('Start') @@ -641,10 +642,13 @@ frappe.ui.form.PrintView = class { refresh_print_options() { this.print_formats = frappe.meta.get_print_formats(this.frm.doctype); - return this.print_sel.empty().add_options([ + const print_format_select_val = this.print_sel.val(); + this.print_sel.empty().add_options([ this.get_default_option_for_select(__('Select Print Format')), ...this.print_formats ]); + return this.print_formats.includes(print_format_select_val) + && this.print_sel.val(print_format_select_val); } selected_format() { diff --git a/frappe/printing/page/print_format_builder/print_format_builder.js b/frappe/printing/page/print_format_builder/print_format_builder.js index eb87190ab5..7e58e295b5 100644 --- a/frappe/printing/page/print_format_builder/print_format_builder.js +++ b/frappe/printing/page/print_format_builder/print_format_builder.js @@ -784,6 +784,7 @@ frappe.PrintFormatBuilder = Class.extend({ btn: this.page.btn_primary, callback: function(r) { me.print_format = r.message; + locals['Print Format'][me.print_format.name] = r.message; frappe.show_alert({message: __("Saved"), indicator: 'green'}); } }); diff --git a/frappe/printing/page/print_format_builder/print_format_builder_sidebar.html b/frappe/printing/page/print_format_builder/print_format_builder_sidebar.html index 0cf8178f82..1ebb87ac31 100644 --- a/frappe/printing/page/print_format_builder/print_format_builder_sidebar.html +++ b/frappe/printing/page/print_format_builder/print_format_builder_sidebar.html @@ -13,7 +13,7 @@ - {%= __(f.label) %} + {%= __(f.label) || __(f.fieldname) %} {% } %} diff --git a/frappe/public/js/frappe/form/controls/select.js b/frappe/public/js/frappe/form/controls/select.js index 026fbbf1e7..2ea32e032c 100644 --- a/frappe/public/js/frappe/form/controls/select.js +++ b/frappe/public/js/frappe/form/controls/select.js @@ -122,6 +122,7 @@ frappe.ui.form.ControlSelect = frappe.ui.form.ControlData.extend({ label = is_label_null ? __(value) : __(v.label); } } + $('