Browse Source

Merge pull request #4947 from tundebabzy/issue-4946

List View does not show all records when the creation time is same. #4946
version-14
tundebabzy 7 years ago
committed by GitHub
parent
commit
cc303d9cc5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 43 deletions
  1. +3
    -16
      frappe/public/js/frappe/list/list_renderer.js
  2. +0
    -6
      frappe/public/js/frappe/list/list_view.js
  3. +1
    -9
      frappe/public/js/frappe/ui/base_list.js
  4. +0
    -12
      frappe/public/js/frappe/ui/filters/filters.js

+ 3
- 16
frappe/public/js/frappe/list/list_renderer.js View File

@@ -3,10 +3,9 @@


frappe.provide('frappe.views'); frappe.provide('frappe.views');


/**
* Renders customized list. Usually based on `in_list_view` property.
* It carries information that is used in frappe.views.ListView
*/
// Renders customized list
// usually based on `in_list_view` property

frappe.views.ListRenderer = Class.extend({ frappe.views.ListRenderer = Class.extend({
name: 'List', name: 'List',
init: function (opts) { init: function (opts) {
@@ -39,7 +38,6 @@ frappe.views.ListRenderer = Class.extend({


// default settings // default settings
this.order_by = this.order_by || 'modified desc'; this.order_by = this.order_by || 'modified desc';
this.group_by = this.group_by || '';
this.filters = this.filters || []; this.filters = this.filters || [];
this.page_length = this.page_length || 20; this.page_length = this.page_length || 20;
}, },
@@ -55,7 +53,6 @@ frappe.views.ListRenderer = Class.extend({
this.init_user_settings(); this.init_user_settings();


this.order_by = this.user_settings.order_by || this.settings.order_by; this.order_by = this.user_settings.order_by || this.settings.order_by;
this.group_by = this.get_group_by();
this.filters = this.user_settings.filters || this.settings.filters; this.filters = this.user_settings.filters || this.settings.filters;
this.page_length = this.settings.page_length; this.page_length = this.settings.page_length;


@@ -64,16 +61,6 @@ frappe.views.ListRenderer = Class.extend({
this.filters = [[this.doctype, "docstatus", "!=", 2]]; this.filters = [[this.doctype, "docstatus", "!=", 2]];
} }
}, },

/**
* Get the name of the column to use in SQL `group by`.
* It defaults to 'creation'
*/
get_group_by: function() {
const default_column = this.settings.group_by || 'creation';
const group_by = $.format('`tab{0}`.`{1}`', [this.doctype, default_column]);
return group_by;
},
init_user_settings: function () { init_user_settings: function () {
frappe.provide('frappe.model.user_settings.' + this.doctype + '.' + this.name); frappe.provide('frappe.model.user_settings.' + this.doctype + '.' + this.name);
this.user_settings = frappe.get_user_settings(this.doctype)[this.name]; this.user_settings = frappe.get_user_settings(this.doctype)[this.name];


+ 0
- 6
frappe/public/js/frappe/list/list_view.js View File

@@ -536,22 +536,16 @@ frappe.views.ListView = frappe.ui.BaseList.extend({
}) })
}, },


/*
* Prepares extra information for the SQL query to fetch
* records for the list view.
*/
get_args: function () { get_args: function () {
var args = { var args = {
doctype: this.doctype, doctype: this.doctype,
fields: this.list_renderer.fields, fields: this.list_renderer.fields,
filters: this.get_filters_args(), filters: this.get_filters_args(),
order_by: this.get_order_by_args(), order_by: this.get_order_by_args(),
group_by: this.list_renderer.group_by,
with_comment_count: true with_comment_count: true
} }
return args; return args;
}, },

get_filters_args: function() { get_filters_args: function() {
var filters = []; var filters = [];
if(this.filter_list) { if(this.filter_list) {


+ 1
- 9
frappe/public/js/frappe/ui/base_list.js View File

@@ -265,10 +265,6 @@ frappe.ui.BaseList = Class.extend({
this.onreset && this.onreset(); this.onreset && this.onreset();
}, },


/*
* Uses the value of `frappe.route_options` to automatically set
* a filter in a list view.
*/
set_filters_from_route_options: function ({clear_filters=true} = {}) { set_filters_from_route_options: function ({clear_filters=true} = {}) {
var me = this; var me = this;
if(this.filter_list && clear_filters) { if(this.filter_list && clear_filters) {
@@ -372,12 +368,8 @@ frappe.ui.BaseList = Class.extend({
} }
} }
}, },

/*
* Prepares arguments that will be used to query the database to
* return the desired records for the list view
*/
get_call_args: function () { get_call_args: function () {
// load query
if (!this.method) { if (!this.method) {
var query = this.get_query && this.get_query() || this.query; var query = this.get_query && this.get_query() || this.query;
query = this.add_limits(query); query = this.add_limits(query);


+ 0
- 12
frappe/public/js/frappe/ui/filters/filters.js View File

@@ -46,9 +46,6 @@ frappe.ui.FilterList = Class.extend({
} }
}, },


/*
* Removes all filters.
*/
clear_filters: function() { clear_filters: function() {
$.each(this.filters, function(i, f) { f.remove(true); }); $.each(this.filters, function(i, f) { f.remove(true); });
if(this.base_list.page.fields_dict) { if(this.base_list.page.fields_dict) {
@@ -59,15 +56,6 @@ frappe.ui.FilterList = Class.extend({
this.filters = []; this.filters = [];
}, },


/*
* Adds a new filter.
* @param {string} doctype
* @param {string} fieldname
* @param {string} condition
* @param {string} value
* @param {string} hidden
* @returns {Boolean} - Returns true if filter is added
*/
add_filter: function(doctype, fieldname, condition, value, hidden) { add_filter: function(doctype, fieldname, condition, value, hidden) {
// adds a new filter, returns true if filter has been added // adds a new filter, returns true if filter has been added




Loading…
Cancel
Save