Count only for current tab on save, delete and duplicate

issue9591
review298541002
This commit is contained in:
Cédric Krier committed 2020-10-11 16:10:38 +02:00
1 parent ac722091f5
commit 67f49736c7
2 files changed
+21 -8

No files matched your search

+18 -5
View File
@@ -211,7 +211,7 @@
e.preventDefault();
jQuery(this).tab('show');
self.do_search();
self.screen.count_tab_domain();
self.screen.count_tab_domain(true);
});
} else {
this.tab = null;
@@ -342,12 +342,21 @@
this.but_active.attr('aria-label', tooltip);
this.but_active.attr('title', tooltip);
},
get_tab_index: function() {
if (!this.tab) {
return -1;
}
return this.tab.find('li').index(this.tab.find('li.active'));
},
get_tab_domain: function() {
if (!this.tab) {
return [];
}
var i = this.tab.find('li').index(this.tab.find('li.active'));
return this.tab_domain[i][1];
var idx = this.get_tab_index();
if (idx < 0) {
return [];
}
return this.tab_domain[idx][1];
},
set_tab_counter: function(count, idx) {
if (jQuery.isEmptyObject(this.tab_counter) || !this.tab) {
@@ -1117,11 +1126,15 @@
}
return domain;
},
count_tab_domain: function() {
count_tab_domain: function(current) {
if (current === undefined) {
current = false;
}
var screen_domain = this.search_domain(
this.screen_container.get_text(), false, false);
var index = this.screen_container.get_tab_index();
this.screen_container.tab_domain.forEach(function(tab_domain, i) {
if (tab_domain[2]) {
if (tab_domain[2] && (!current || (i == index))) {
var domain = ['AND', tab_domain[1], screen_domain];
this.screen_container.set_tab_counter(null, i);
this.group.model.execute(
+3 -3
View File
@@ -764,7 +764,7 @@
function() {
this.info_bar.message(
Sao.i18n.gettext('Record saved.'), 'info');
this.screen.count_tab_domain();
this.screen.count_tab_domain(true);
}.bind(this),
function() {
this.info_bar.message(
@@ -828,7 +828,7 @@
Sao.i18n.gettext(
'Working now on the duplicated record(s).'),
'info');
this.screen.count_tab_domain();
this.screen.count_tab_domain(true);
}.bind(this));
}.bind(this));
},
@@ -848,7 +848,7 @@
this.info_bar.message(
Sao.i18n.gettext('Records removed.'),
'info');
this.screen.count_tab_domain();
this.screen.count_tab_domain(true);
}.bind(this), function() {
this.info_bar.message(
Sao.i18n.gettext('Records not removed.'),