merge_request775.diff [sao] Set visibility of active button when screen is displayed

This commit is contained in:
Raimon Esteve 2023-09-13 18:35:53 +02:00
parent 71c0e8562e
commit 43441b4c1e
2 changed files with 57 additions and 0 deletions

55
merge_request775.diff Normal file
View File

@ -0,0 +1,55 @@
diff --git a/sao/src/screen.js b/sao/src/screen.js
index 6424e3294f..de1ca95456 100644
--- a/sao/src/screen.js
+++ b/sao/src/screen.js
@@ -1037,7 +1037,8 @@
var domain = this.search_domain(search_string, true);
var context = this.context;
- if (this.screen_container.but_active.hasClass('active')) {
+ if ((this.screen_container.but_active.css('display') != 'none') &&
+ this.screen_container.but_active.hasClass('active')) {
context.active_test = false;
}
const search = () => {
@@ -1118,7 +1119,8 @@
} else {
domain = this.domain;
}
- if (this.screen_container.but_active.hasClass('active')) {
+ if ((this.screen_container.but_active.css('display') != 'none') &&
+ this.screen_container.but_active.hasClass('active')) {
if (!jQuery.isEmptyObject(domain)) {
domain = [domain, ['active', '=', false]];
} else {
@@ -1347,6 +1349,17 @@
}
}
}
+ if (this.current_view.view_type == 'tree') {
+ let view_tree = this.fields_view_tree[
+ this.current_view.view_id] || {};
+ if ('active' in view_tree.fields) {
+ this.screen_container.but_active.show();
+ } else {
+ this.screen_container.but_active.hide();
+ }
+ } else {
+ this.screen_container.but_active.hide();
+ }
return jQuery.when.apply(jQuery, deferreds).then(
() => this.set_tree_state().then(() => {
this.current_record = this.current_record;
@@ -1788,12 +1801,6 @@
fields = dom_fields;
}
- if ('active' in view_tree.fields) {
- this.screen_container.but_active.show();
- } else {
- this.screen_container.but_active.hide();
- }
-
// Add common fields
const common_fields = new Set([
['id', Sao.i18n.gettext('ID'), 'integer'],

2
series
View File

@ -101,3 +101,5 @@ issue12541.diff # [stock] _set_transit may try to copy() an empty list
issue12497.diff # [purchase] Use the last 10 purchases to set default currency, payment term and invoice method
merge_request779.diff # [account_payment] Warn when submitting, approving or proceeding payment with reconciled line
merge_request775.diff # [sao] Set visibility of active button when screen is displayed