issue7707.diff # [sao] Improve tree view

#163452
This commit is contained in:
Raimon Esteve 2023-11-23 14:35:43 +01:00
parent d57ce0078d
commit b5a3b00fb9
2 changed files with 110 additions and 0 deletions

108
issue7707.diff Normal file
View File

@ -0,0 +1,108 @@
diff --git a/tryton/sao/src/sao.js b/tryton/sao/src/sao.js
index f803f49f40..686ae2a6fe 100644
--- a/tryton/sao/src/sao.js
+++ b/tryton/sao/src/sao.js
@@ -778,11 +778,14 @@ var Sao = {
Sao.main_menu_row_activate = function() {
var screen = Sao.main_menu_screen;
- // ids is not defined to prevent to add suffix
- return Sao.Action.exec_keyword('tree_open', {
- 'model': screen.model_name,
- 'id': screen.get_id(),
- }, null, false);
+ const id = screen.get_id();
+ if (id) {
+ // ids is not defined to prevent to add suffix
+ Sao.Action.exec_keyword('tree_open', {
+ 'model': screen.model_name,
+ 'id': screen.get_id(),
+ }, null, false);
+ }
};
Sao.menu = function(preferences) {
@@ -824,6 +827,7 @@ var Sao = {
view.table.removeClass('table table-bordered');
view.table.addClass('no-responsive');
view.table.find('thead').hide();
+ view.table.find('colgroup > col.tree-menu').css('width', 0);
var gs = new Sao.GlobalSearch();
jQuery('#global-search').empty();
jQuery('#global-search').append(gs.el);
diff --git a/tryton/sao/src/sao.less b/tryton/sao/src/sao.less
index 46118c95ff..6cee9df988 100644
--- a/tryton/sao/src/sao.less
+++ b/tryton/sao/src/sao.less
@@ -451,11 +451,13 @@ img.icon {
}
td.draggable-handle, td.optional {
- cursor: grab;
> img {
.center-block();
}
}
+ td.draggable-handle {
+ cursor: grab;
+ }
th.selection-state, td.selection-state {
> input {
.center-block();
@@ -603,12 +605,13 @@ img.icon {
cursor: pointer;
> img {
float: left;
- margin-right: 5px;
+ margin-right: 1em;
[dir="rtl"] & {
float: right;
- margin-left: 5px;
+ margin-left: 1em;
}
- width: 1em;
+ width: unit(@line-height-base, em);
+ height: unit(@line-height-base, em);
}
}
label {
diff --git a/tryton/sao/src/screen.js b/tryton/sao/src/screen.js
index da51d8ffa1..1ffb0f5672 100644
--- a/tryton/sao/src/screen.js
+++ b/tryton/sao/src/screen.js
@@ -1476,11 +1476,14 @@
default_row_activate: function() {
if ((this.current_view.view_type == 'tree') &&
(this.current_view.attributes.keyword_open == 1)) {
- Sao.Action.exec_keyword('tree_open', {
- 'model': this.model_name,
- 'id': this.get_id(),
- 'ids': [this.get_id()]
- }, this.local_context, false);
+ const id = this.get_id();
+ if (id) {
+ Sao.Action.exec_keyword('tree_open', {
+ 'model': this.model_name,
+ 'id': this.get_id(),
+ 'ids': [this.get_id()]
+ }, this.local_context, false);
+ }
} else {
if (!this.modified()) {
this.switch_view('form');
diff --git a/tryton/sao/src/view/tree.js b/tryton/sao/src/view/tree.js
index 8d8c8b1685..e3f73178a3 100644
--- a/tryton/sao/src/view/tree.js
+++ b/tryton/sao/src/view/tree.js
@@ -1523,6 +1523,11 @@
this.expander.children().html(' ');
this.expander.on('click keypress',
Sao.common.click_press(this.toggle_row.bind(this)));
+ this.expander.dblclick((evt) => {
+ // prevent calling switch_row on td
+ evt.preventDefault();
+ evt.stopImmediatePropagation();
+ });
}
for (var i = 0; i < this.tree.columns.length; i++) {

2
series
View File

@ -134,6 +134,8 @@ issue12553.diff # [sao] Select first visible siblings when page is hidden
update_trees_chart_accounts.diff # [account_account] Update trees of chart of accounts with 2 passes
issue7707.diff # [sao] Improve tree view #163452
issue12799.diff # [sao] Convert negative id value as None when set by the client
issue12547.diff # [stock_lot] Check lot required only when changing move to done