tryton-sao 6.2.3 → 6.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG CHANGED
@@ -1,3 +1,12 @@
1
+ Version 6.2.6 - 2022-03-01
2
+ * Bug fixes (see mercurial logs for details)
3
+
4
+ Version 6.2.5 - 2022-02-16
5
+ * Bug fixes (see mercurial logs for details)
6
+
7
+ Version 6.2.4 - 2022-02-01
8
+ * Bug fixes (see mercurial logs for details)
9
+
1
10
  Version 6.2.3 - 2022-01-15
2
11
  * Bug fixes (see mercurial logs for details)
3
12
 
package/COPYRIGHT CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (C) 2012-2021 Nicolas Évrard.
1
+ Copyright (C) 2012-2022 Nicolas Évrard.
2
2
  Copyright (C) 2012-2022 Cédric Krier.
3
3
  Copyright (C) 2012-2014 Bertrand Chenal.
4
4
  Copyright (C) 2012-2022 B2CK SPRL.
@@ -1673,7 +1673,7 @@ var Sao = {};
1673
1673
 
1674
1674
  Sao.PYSON.Eval.eval_ = function(value, context) {
1675
1675
  var idx = value.v.indexOf('.');
1676
- if (idx >= 0) {
1676
+ if ((idx >= 0) && !(value.v in context)) {
1677
1677
  return Sao.PYSON.Eval.eval_({
1678
1678
  'v': value.v.substring(idx + 1),
1679
1679
  'd': value.d,
@@ -9185,27 +9185,16 @@ var Sao = {};
9185
9185
  set: function(record, value) {
9186
9186
  var rec_name = (
9187
9187
  record._values[this.name + '.'] || {}).rec_name || '';
9188
- var store_rec_name = function(rec_name) {
9189
- Sao.setdefault(
9190
- record._values, this.name + '.', {})
9191
- .rec_name = rec_name[0].rec_name;
9192
- };
9193
9188
  if (!rec_name && (value >= 0) && (value !== null)) {
9194
9189
  var model_name = record.model.fields[this.name].description
9195
9190
  .relation;
9196
- Sao.rpc({
9191
+ rec_name = Sao.rpc({
9197
9192
  'method': 'model.' + model_name + '.read',
9198
9193
  'params': [[value], ['rec_name'], record.get_context()]
9199
- }, record.model.session).done(store_rec_name.bind(this)).done(
9200
- function() {
9201
- record.group.root_group.screens.forEach(
9202
- function(screen) {
9203
- screen.display();
9204
- });
9205
- });
9206
- } else {
9207
- store_rec_name.call(this, [{'rec_name': rec_name}]);
9194
+ }, record.model.session, false)[0].rec_name;
9208
9195
  }
9196
+ Sao.setdefault(
9197
+ record._values, this.name + '.', {}).rec_name = rec_name;
9209
9198
  record._values[this.name] = value;
9210
9199
  },
9211
9200
  set_client: function(record, value, force_change) {
@@ -9756,26 +9745,21 @@ var Sao = {};
9756
9745
  }
9757
9746
  var rec_name = (
9758
9747
  record._values[this.name + '.'] || {}).rec_name || '';
9759
- var store_rec_name = function(rec_name) {
9760
- Sao.setdefault(
9761
- record._values, this.name + '.', {}).rec_name = rec_name;
9762
- }.bind(this);
9763
9748
  if (ref_model && ref_id !== null && ref_id >= 0) {
9764
9749
  if (!rec_name && ref_id >= 0) {
9765
- Sao.rpc({
9750
+ rec_name = Sao.rpc({
9766
9751
  'method': 'model.' + ref_model + '.read',
9767
9752
  'params': [[ref_id], ['rec_name'], record.get_context()]
9768
- }, record.model.session).done(function(result) {
9769
- store_rec_name(result[0].rec_name);
9770
- });
9753
+ }, record.model.session, false)[0].rec_name;
9771
9754
  }
9772
9755
  } else if (ref_model) {
9773
9756
  rec_name = '';
9774
9757
  } else {
9775
9758
  rec_name = ref_id;
9776
9759
  }
9760
+ Sao.setdefault(
9761
+ record._values, this.name + '.', {}).rec_name = rec_name;
9777
9762
  record._values[this.name] = [ref_model, ref_id];
9778
- store_rec_name(rec_name);
9779
9763
  },
9780
9764
  get_on_change_value: function(record) {
9781
9765
  if ((record.group.parent_name == this.name) &&
@@ -13652,6 +13636,7 @@ var Sao = {};
13652
13636
  return record.model.execute(attributes.name, [values],
13653
13637
  this.context).then(function(changes) {
13654
13638
  record.set_on_change(changes);
13639
+ record.group.changed();
13655
13640
  record.group.root_group.screens.forEach(
13656
13641
  function(screen) {
13657
13642
  screen.display();
@@ -15037,6 +15022,7 @@ function eval_pyson(value){
15037
15022
  this.el = jQuery('<button/>', {
15038
15023
  'class': this.class_ + ' btn btn-link',
15039
15024
  'name': attributes.name,
15025
+ 'type': 'button',
15040
15026
  });
15041
15027
  if (attributes.icon) {
15042
15028
  var img = jQuery('<img/>', {
@@ -19600,6 +19586,23 @@ function eval_pyson(value){
19600
19586
  this.table.append(this.tfoot);
19601
19587
  }
19602
19588
 
19589
+ if (this.children_field) {
19590
+ this.expander = jQuery('<span/>', {
19591
+ 'class': 'expander',
19592
+ }).append(jQuery('<img/>', {
19593
+ 'tabindex': 0,
19594
+ 'class': 'icon',
19595
+ }));
19596
+ this.update_expander('more');
19597
+ this.expander.on('click keypress',
19598
+ Sao.common.click_press(this.unfold.bind(this)));
19599
+ Sao.common.ICONFACTORY.get_icon_url(
19600
+ 'tryton-unfold-' + this.expander.action)
19601
+ .then(function(url) {
19602
+ this.expander.children().attr('src', url);
19603
+ }.bind(this));
19604
+ }
19605
+
19603
19606
  this.columns.forEach(function(column, i) {
19604
19607
  col = jQuery('<col/>', {
19605
19608
  'class': column.attributes.widget,
@@ -19607,23 +19610,6 @@ function eval_pyson(value){
19607
19610
  th = jQuery('<th/>', {
19608
19611
  'class': column.attributes.widget,
19609
19612
  });
19610
- if ((i === 0) && this.children_field) {
19611
- this.expander = jQuery('<img/>', {
19612
- 'tabindex': 0,
19613
- 'class': 'icon',
19614
- });
19615
- this.update_expander('more');
19616
- this.expander.on('click keypress',
19617
- Sao.common.click_press(this.unfold.bind(this)));
19618
- Sao.common.ICONFACTORY.get_icon_url(
19619
- 'tryton-unfold-' + this.expander.action)
19620
- .then(function(url) {
19621
- this.expander.attr('src', url);
19622
- }.bind(this));
19623
- th.append(jQuery('<span>', {
19624
- 'class': 'expander',
19625
- }).append(this.expander));
19626
- }
19627
19613
  var label = jQuery('<label/>')
19628
19614
  .text(column.attributes.string)
19629
19615
  .attr('title', column.attributes.string);
@@ -19714,7 +19700,7 @@ function eval_pyson(value){
19714
19700
  Sao.common.ICONFACTORY.get_icon_url(
19715
19701
  'tryton-unfold-' + this.expander.action)
19716
19702
  .then(function(url) {
19717
- this.expander.attr('src', url);
19703
+ this.expander.children().attr('src', url);
19718
19704
  }.bind(this));
19719
19705
  if (jQuery.isEmptyObject(this.selected_records)) {
19720
19706
  this.expander.css('visibility', 'hidden');
@@ -20156,8 +20142,8 @@ function eval_pyson(value){
20156
20142
  !column.col.hasClass('selection-state') &&
20157
20143
  !column.col.hasClass('favorite')) {
20158
20144
  var width, c_width;
20159
- if (column.width) {
20160
- width = c_width = column.width;
20145
+ if (column.attributes.width) {
20146
+ width = c_width = column.attributes.width;
20161
20147
  min_width.push(width + 'px');
20162
20148
  } else {
20163
20149
  width = {
@@ -20184,6 +20170,19 @@ function eval_pyson(value){
20184
20170
  column.col.show();
20185
20171
  }
20186
20172
  }.bind(this));
20173
+ if (this.children_field) {
20174
+ this.columns.every(function(column) {
20175
+ if (column.col.hasClass('draggable-handle') ||
20176
+ column.header.hasClass('invisible')) {
20177
+ return true;
20178
+ } else {
20179
+ if (this.expander.parent()[0] !== column.header[0]) {
20180
+ column.header.prepend(this.expander);
20181
+ }
20182
+ return false;
20183
+ }
20184
+ }.bind(this));
20185
+ }
20187
20186
  this.table.css('min-width', 'calc(' + min_width.join(' + ') + ')');
20188
20187
  this.scrollbar.css('min-width', this.table.css('min-width'));
20189
20188
  this.tbody.find('tr.more-row > td').attr(
@@ -20779,6 +20778,18 @@ function eval_pyson(value){
20779
20778
  this.select_column(event_.data.index);
20780
20779
  }.bind(this);
20781
20780
 
20781
+ if (this.children_field) {
20782
+ this.expander = jQuery('<span/>', {
20783
+ 'class': 'expander',
20784
+ }).append('<img/>', {
20785
+ 'tabindex': 0,
20786
+ 'class': 'icon',
20787
+ });
20788
+ this.expander.children().html('&nbsp;');
20789
+ this.expander.on('click keypress',
20790
+ Sao.common.click_press(this.toggle_row.bind(this)));
20791
+ }
20792
+
20782
20793
  for (var i = 0; i < this.tree.columns.length; i++) {
20783
20794
  var column = this.tree.columns[i];
20784
20795
  if (column instanceof Sao.View.Tree.ButtonColumn) {
@@ -20806,18 +20817,6 @@ function eval_pyson(value){
20806
20817
  'class': 'cell',
20807
20818
  });
20808
20819
  td.append(cell);
20809
- if ((i === 0) && this.children_field) {
20810
- this.expander = jQuery('<img/>', {
20811
- 'tabindex': 0,
20812
- 'class': 'icon',
20813
- });
20814
- this.expander.html('&nbsp;');
20815
- this.expander.on('click keypress',
20816
- Sao.common.click_press(this.toggle_row.bind(this)));
20817
- cell.append(jQuery('<span/>', {
20818
- 'class': 'expander'
20819
- }).append(this.expander));
20820
- }
20821
20820
  var j;
20822
20821
  if (column.prefixes) {
20823
20822
  for (j = 0; j < column.prefixes.length; j++) {
@@ -20930,6 +20929,21 @@ function eval_pyson(value){
20930
20929
  }
20931
20930
  }
20932
20931
  }
20932
+ if (this.children_field) {
20933
+ this.tree.columns.every(function(column, i) {
20934
+ if (column.col.hasClass('draggable-handle') ||
20935
+ column.header.hasClass('invisible')) {
20936
+ return true;
20937
+ } else {
20938
+ var td = this._get_column_td(i);
20939
+ var cell = td.find('.cell');
20940
+ if (this.expander.parent()[0] !== cell[0]) {
20941
+ cell.prepend(this.expander);
20942
+ }
20943
+ return false;
20944
+ }
20945
+ }.bind(this));
20946
+ }
20933
20947
  this._drawed_record = this.record.identity;
20934
20948
 
20935
20949
  var row_id_path = this.get_id_path();
@@ -20940,7 +20954,7 @@ function eval_pyson(value){
20940
20954
  if (Sao.i18n.rtl) {
20941
20955
  margin = 'margin-right';
20942
20956
  }
20943
- this.expander.css(margin, (depth - 1) + 'em');
20957
+ this.expander.children().css(margin, (depth - 1) + 'em');
20944
20958
 
20945
20959
  var update_expander = function() {
20946
20960
  var length = this.record.field_get_client(
@@ -21004,7 +21018,7 @@ function eval_pyson(value){
21004
21018
  }
21005
21019
  Sao.common.ICONFACTORY.get_icon_url(icon)
21006
21020
  .then(function(url) {
21007
- this.expander.attr('src', url);
21021
+ this.expander.children().attr('src', url);
21008
21022
  }.bind(this));
21009
21023
  },
21010
21024
  collapse_children: function() {
@@ -21427,9 +21441,13 @@ function eval_pyson(value){
21427
21441
  }.bind(this));
21428
21442
  }
21429
21443
  } else {
21430
- this._get_column_td(next_column, next_row)
21431
- .trigger('click')
21432
- .find(':input,[tabindex=0]').focus();
21444
+ prm.then(function() {
21445
+ this._get_column_td(
21446
+ next_column, next_row)
21447
+ .trigger('click')
21448
+ .find(':input,[tabindex=0]')
21449
+ .focus();
21450
+ }.bind(this));
21433
21451
  }
21434
21452
  }
21435
21453
  }.bind(this));