changeset a90f2be79a41 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=a90f2be79a41
description:
Count only for current tab on save, delete and duplicate
issue9591
review298541002
diffstat:
src/screen.js | 23 ++++++++++++++++++-----
src/tab.js | 6 +++---
2 files changed, 21 insertions(+), 8 deletions(-)
diffs (84 lines):
diff -r 1f85e96c0a8f -r a90f2be79a41 src/screen.js
--- a/src/screen.js Fri Oct 09 19:09:06 2020 +0200
+++ b/src/screen.js Sun Oct 11 16:10:38 2020 +0200
@@ -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(
diff -r 1f85e96c0a8f -r a90f2be79a41 src/tab.js
--- a/src/tab.js Fri Oct 09 19:09:06 2020 +0200
+++ b/src/tab.js Sun Oct 11 16:10:38 2020 +0200
@@ -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.'),