tryton-sao 6.2.0 → 6.2.4

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,15 @@
1
+ Version 6.2.4 - 2022-02-01
2
+ * Bug fixes (see mercurial logs for details)
3
+
4
+ Version 6.2.3 - 2022-01-15
5
+ * Bug fixes (see mercurial logs for details)
6
+
7
+ Version 6.2.2 - 2022-01-01
8
+ * Bug fixes (see mercurial logs for details)
9
+
10
+ Version 6.2.1 - 2021-12-03
11
+ * Bug fixes (see mercurial logs for details)
12
+
1
13
  Version 6.2.0 - 2021-11-01
2
14
  * Bug fixes (see mercurial logs for details)
3
15
  * Support grouping attribute
package/COPYRIGHT CHANGED
@@ -1,7 +1,7 @@
1
- Copyright (C) 2012-2021 Nicolas Évrard.
2
- Copyright (C) 2012-2021 Cédric Krier.
1
+ Copyright (C) 2012-2022 Nicolas Évrard.
2
+ Copyright (C) 2012-2022 Cédric Krier.
3
3
  Copyright (C) 2012-2014 Bertrand Chenal.
4
- Copyright (C) 2012-2021 B2CK SPRL.
4
+ Copyright (C) 2012-2022 B2CK SPRL.
5
5
  Copyright (C) 2019 Jitbit.
6
6
  Copyright (C) 2013 Thomas Park
7
7
  Copyright (C) 2020-2021 Maxime Richez
@@ -8687,6 +8687,9 @@ html[theme="default"] .input-group-sm > .form-control,
8687
8687
  html[theme="default"] .input-group-sm > .input-group-addon {
8688
8688
  padding: 0 5px;
8689
8689
  }
8690
+ html[theme="default"] .has-feedback .form-control {
8691
+ padding-right: 42.5px;
8692
+ }
8690
8693
  html[theme="default"] .input-group-addon {
8691
8694
  background-color: transparent;
8692
8695
  border: transparent;
@@ -9165,6 +9168,9 @@ button {
9165
9168
  overflow-y: hidden;
9166
9169
  text-overflow: ellipsis;
9167
9170
  }
9171
+ .input-group > .form-control-feedback {
9172
+ z-index: 3;
9173
+ }
9168
9174
  .navbar-inverse .close {
9169
9175
  color: #6dd1d4;
9170
9176
  }
@@ -9389,7 +9395,7 @@ button.list-group-item-selected.active:focus {
9389
9395
  .table-hover > tbody > tr.danger:hover > th {
9390
9396
  background-color: #ebcccc;
9391
9397
  }
9392
- html.accesskey *[accesskey] + span[data-accesskey]:after,
9398
+ html.accesskey *[accesskey] ~ span[data-accesskey]:after,
9393
9399
  html.accesskey *[accesskey]:after {
9394
9400
  background-color: #71bdc1;
9395
9401
  color: #fff;
@@ -9403,19 +9409,19 @@ html.accesskey *[accesskey]:after {
9403
9409
  html.accesskey input[accesskey][type="checkbox"]:after {
9404
9410
  background-color: initial;
9405
9411
  }
9406
- html.accesskey *[accesskey] + span[data-accesskey] {
9412
+ html.accesskey *[accesskey] ~ span[data-accesskey] {
9407
9413
  float: right;
9408
9414
  position: relative;
9409
9415
  }
9410
- html.accesskey *[accesskey] + span[data-accesskey]:after {
9416
+ html.accesskey *[accesskey] ~ span[data-accesskey]:after {
9411
9417
  content: attr(data-accesskey);
9412
9418
  }
9413
9419
  html.accesskey *[accesskey]:after {
9414
9420
  content: attr(accesskey);
9415
9421
  }
9416
- html.accesskey input[accesskey][type="checkbox"] + span[data-accesskey],
9417
- html.accesskey input[accesskey][type="checkbox"] + span[data-accesskey],
9418
- html.accesskey select[accesskey] + span[data-accesskey] {
9422
+ html.accesskey input[accesskey][type="checkbox"] ~ span[data-accesskey],
9423
+ html.accesskey input[accesskey][type="checkbox"] ~ span[data-accesskey],
9424
+ html.accesskey select[accesskey] ~ span[data-accesskey] {
9419
9425
  bottom: 1em;
9420
9426
  }
9421
9427
  .tab-form nav.toolbar,
@@ -1673,13 +1673,13 @@ 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,
1680
1680
  }, context[value.v.substring(0, idx)] || {});
1681
1681
  }
1682
- if (value.v in context) {
1682
+ if ((value.v in context) && (context[value.v] !== undefined)) {
1683
1683
  return context[value.v];
1684
1684
  } else {
1685
1685
  return value.d;
@@ -4852,7 +4852,7 @@ var Sao = {};
4852
4852
  },
4853
4853
  default_operator: function(field) {
4854
4854
  if (~['char', 'text', 'many2one', 'many2many', 'one2many',
4855
- 'reference'].indexOf(field.type)) {
4855
+ 'reference', 'one2one'].indexOf(field.type)) {
4856
4856
  return 'ilike';
4857
4857
  } else if (field.type == 'multiselection') {
4858
4858
  return 'in';
@@ -8534,7 +8534,11 @@ var Sao = {};
8534
8534
  Object.keys(this._values).reduce(function(values, name) {
8535
8535
  var field = this.model.fields[name];
8536
8536
  if (field) {
8537
- values[name] = field.get(this);
8537
+ if (field instanceof Sao.field.Binary) {
8538
+ values[name] = field.get_size(this);
8539
+ } else {
8540
+ values[name] = field.get(this);
8541
+ }
8538
8542
  }
8539
8543
  return values;
8540
8544
  }.bind(this), {}));
@@ -8667,12 +8671,14 @@ var Sao = {};
8667
8671
  }
8668
8672
  return value;
8669
8673
  },
8674
+ _has_changed: function(previous, value) {
8675
+ // Use stringify to compare object instance like Number for Decimal
8676
+ return JSON.stringify(previous) != JSON.stringify(value);
8677
+ },
8670
8678
  set_client: function(record, value, force_change) {
8671
8679
  var previous_value = this.get(record);
8672
8680
  this.set(record, value);
8673
- // Use stringify to compare object instance like Number for Decimal
8674
- if (JSON.stringify(previous_value) !=
8675
- JSON.stringify(this.get(record))) {
8681
+ if (this._has_changed(previous_value, this.get(record))) {
8676
8682
  record._changed[this.name] = true;
8677
8683
  this.changed(record);
8678
8684
  record.validate(null, true, false, true);
@@ -9831,6 +9837,9 @@ var Sao = {};
9831
9837
 
9832
9838
  Sao.field.Binary = Sao.class_(Sao.field.Field, {
9833
9839
  _default: null,
9840
+ _has_changed: function(previous, value) {
9841
+ return previous != value;
9842
+ },
9834
9843
  get_size: function(record) {
9835
9844
  var data = record._values[this.name] || 0;
9836
9845
  if (data instanceof Uint8Array) {
@@ -11462,7 +11471,9 @@ var Sao = {};
11462
11471
  'disabled', this.screen.readonly);
11463
11472
 
11464
11473
  var msg = name + ' / ' + data[1];
11465
- if ((data[1] < data[2]) && (data[2] > this.screen.limit)) {
11474
+ if ((data[1] < data[2]) &&
11475
+ this.screen.limit !== null &&
11476
+ (data[2] > this.screen.limit)) {
11466
11477
  msg += Sao.i18n.gettext(' of ') + data[2];
11467
11478
  }
11468
11479
  this.status_label.text(msg).attr('title', msg);
@@ -12298,7 +12309,7 @@ var Sao = {};
12298
12309
  init: function(format, id) {
12299
12310
  this.format = format;
12300
12311
  Sao.ScreenContainer.BetweenDates._super.init.call(this, id);
12301
- this.from.on('dp.change', this._from_changed.bind(this));
12312
+ this.from.change(this._from_changed.bind(this));
12302
12313
  },
12303
12314
  _get_value: function(entry, value) {
12304
12315
  return entry.find('input[type=text]').val();
@@ -13397,7 +13408,9 @@ var Sao = {};
13397
13408
  if (props.selection instanceof Array) {
13398
13409
  continue;
13399
13410
  }
13411
+ props = jQuery.extend({}, props);
13400
13412
  props.selection = this.get_selection(props);
13413
+ fields[name] = props;
13401
13414
  }
13402
13415
 
13403
13416
  if ('arch' in view_tree) {
@@ -14181,7 +14194,7 @@ function eval_pyson(value){
14181
14194
  widget.labelled.get(0).tagName)) {
14182
14195
  jQuery('<span/>', {
14183
14196
  'data-accesskey': accesskey,
14184
- }).insertAfter(widget.labelled);
14197
+ }).appendTo(widget.labelled.parent());
14185
14198
  }
14186
14199
  label.label_el.attr('for', widget.labelled.attr('id'));
14187
14200
  }
@@ -14997,14 +15010,12 @@ function eval_pyson(value){
14997
15010
  'aria-controls': this.collapsible.attr('id'),
14998
15011
  'aria-expanded': attributes.expandable == '1',
14999
15012
  }).appendTo(title);
15000
- link.append(jQuery('<div/>', {
15001
- 'class': 'btn btn-sm',
15002
- }).append(jQuery('<span/>', {
15003
- 'class': 'caret',
15004
- })));
15005
15013
  if (attributes.string) {
15006
15014
  link.text(attributes.string);
15007
15015
  }
15016
+ link.append(jQuery('<span/>', {
15017
+ 'class': 'caret',
15018
+ }));
15008
15019
  },
15009
15020
  add: function(widget) {
15010
15021
  this.body.empty();
@@ -19589,6 +19600,23 @@ function eval_pyson(value){
19589
19600
  this.table.append(this.tfoot);
19590
19601
  }
19591
19602
 
19603
+ if (this.children_field) {
19604
+ this.expander = jQuery('<span/>', {
19605
+ 'class': 'expander',
19606
+ }).append(jQuery('<img/>', {
19607
+ 'tabindex': 0,
19608
+ 'class': 'icon',
19609
+ }));
19610
+ this.update_expander('more');
19611
+ this.expander.on('click keypress',
19612
+ Sao.common.click_press(this.unfold.bind(this)));
19613
+ Sao.common.ICONFACTORY.get_icon_url(
19614
+ 'tryton-unfold-' + this.expander.action)
19615
+ .then(function(url) {
19616
+ this.expander.children().attr('src', url);
19617
+ }.bind(this));
19618
+ }
19619
+
19592
19620
  this.columns.forEach(function(column, i) {
19593
19621
  col = jQuery('<col/>', {
19594
19622
  'class': column.attributes.widget,
@@ -19596,23 +19624,6 @@ function eval_pyson(value){
19596
19624
  th = jQuery('<th/>', {
19597
19625
  'class': column.attributes.widget,
19598
19626
  });
19599
- if ((i === 0) && this.children_field) {
19600
- this.expander = jQuery('<img/>', {
19601
- 'tabindex': 0,
19602
- 'class': 'icon',
19603
- });
19604
- this.update_expander('more');
19605
- this.expander.on('click keypress',
19606
- Sao.common.click_press(this.unfold.bind(this)));
19607
- Sao.common.ICONFACTORY.get_icon_url(
19608
- 'tryton-unfold-' + this.expander.action)
19609
- .then(function(url) {
19610
- this.expander.attr('src', url);
19611
- }.bind(this));
19612
- th.append(jQuery('<span>', {
19613
- 'class': 'expander',
19614
- }).append(this.expander));
19615
- }
19616
19627
  var label = jQuery('<label/>')
19617
19628
  .text(column.attributes.string)
19618
19629
  .attr('title', column.attributes.string);
@@ -19703,7 +19714,7 @@ function eval_pyson(value){
19703
19714
  Sao.common.ICONFACTORY.get_icon_url(
19704
19715
  'tryton-unfold-' + this.expander.action)
19705
19716
  .then(function(url) {
19706
- this.expander.attr('src', url);
19717
+ this.expander.children().attr('src', url);
19707
19718
  }.bind(this));
19708
19719
  if (jQuery.isEmptyObject(this.selected_records)) {
19709
19720
  this.expander.css('visibility', 'hidden');
@@ -20145,8 +20156,8 @@ function eval_pyson(value){
20145
20156
  !column.col.hasClass('selection-state') &&
20146
20157
  !column.col.hasClass('favorite')) {
20147
20158
  var width, c_width;
20148
- if (column.width) {
20149
- width = c_width = column.width;
20159
+ if (column.attributes.width) {
20160
+ width = c_width = column.attributes.width;
20150
20161
  min_width.push(width + 'px');
20151
20162
  } else {
20152
20163
  width = {
@@ -20173,6 +20184,19 @@ function eval_pyson(value){
20173
20184
  column.col.show();
20174
20185
  }
20175
20186
  }.bind(this));
20187
+ if (this.children_field) {
20188
+ this.columns.every(function(column) {
20189
+ if (column.col.hasClass('draggable-handle') ||
20190
+ column.header.hasClass('invisible')) {
20191
+ return true;
20192
+ } else {
20193
+ if (this.expander.parent()[0] !== column.header[0]) {
20194
+ column.header.prepend(this.expander);
20195
+ }
20196
+ return false;
20197
+ }
20198
+ }.bind(this));
20199
+ }
20176
20200
  this.table.css('min-width', 'calc(' + min_width.join(' + ') + ')');
20177
20201
  this.scrollbar.css('min-width', this.table.css('min-width'));
20178
20202
  this.tbody.find('tr.more-row > td').attr(
@@ -20768,6 +20792,18 @@ function eval_pyson(value){
20768
20792
  this.select_column(event_.data.index);
20769
20793
  }.bind(this);
20770
20794
 
20795
+ if (this.children_field) {
20796
+ this.expander = jQuery('<span/>', {
20797
+ 'class': 'expander',
20798
+ }).append('<img/>', {
20799
+ 'tabindex': 0,
20800
+ 'class': 'icon',
20801
+ });
20802
+ this.expander.children().html('&nbsp;');
20803
+ this.expander.on('click keypress',
20804
+ Sao.common.click_press(this.toggle_row.bind(this)));
20805
+ }
20806
+
20771
20807
  for (var i = 0; i < this.tree.columns.length; i++) {
20772
20808
  var column = this.tree.columns[i];
20773
20809
  if (column instanceof Sao.View.Tree.ButtonColumn) {
@@ -20795,18 +20831,6 @@ function eval_pyson(value){
20795
20831
  'class': 'cell',
20796
20832
  });
20797
20833
  td.append(cell);
20798
- if ((i === 0) && this.children_field) {
20799
- this.expander = jQuery('<img/>', {
20800
- 'tabindex': 0,
20801
- 'class': 'icon',
20802
- });
20803
- this.expander.html('&nbsp;');
20804
- this.expander.on('click keypress',
20805
- Sao.common.click_press(this.toggle_row.bind(this)));
20806
- cell.append(jQuery('<span/>', {
20807
- 'class': 'expander'
20808
- }).append(this.expander));
20809
- }
20810
20834
  var j;
20811
20835
  if (column.prefixes) {
20812
20836
  for (j = 0; j < column.prefixes.length; j++) {
@@ -20919,6 +20943,21 @@ function eval_pyson(value){
20919
20943
  }
20920
20944
  }
20921
20945
  }
20946
+ if (this.children_field) {
20947
+ this.tree.columns.every(function(column, i) {
20948
+ if (column.col.hasClass('draggable-handle') ||
20949
+ column.header.hasClass('invisible')) {
20950
+ return true;
20951
+ } else {
20952
+ var td = this._get_column_td(i);
20953
+ var cell = td.find('.cell');
20954
+ if (this.expander.parent()[0] !== cell[0]) {
20955
+ cell.prepend(this.expander);
20956
+ }
20957
+ return false;
20958
+ }
20959
+ }.bind(this));
20960
+ }
20922
20961
  this._drawed_record = this.record.identity;
20923
20962
 
20924
20963
  var row_id_path = this.get_id_path();
@@ -20929,7 +20968,7 @@ function eval_pyson(value){
20929
20968
  if (Sao.i18n.rtl) {
20930
20969
  margin = 'margin-right';
20931
20970
  }
20932
- this.expander.css(margin, (depth - 1) + 'em');
20971
+ this.expander.children().css(margin, (depth - 1) + 'em');
20933
20972
 
20934
20973
  var update_expander = function() {
20935
20974
  var length = this.record.field_get_client(
@@ -20993,7 +21032,7 @@ function eval_pyson(value){
20993
21032
  }
20994
21033
  Sao.common.ICONFACTORY.get_icon_url(icon)
20995
21034
  .then(function(url) {
20996
- this.expander.attr('src', url);
21035
+ this.expander.children().attr('src', url);
20997
21036
  }.bind(this));
20998
21037
  },
20999
21038
  collapse_children: function() {
@@ -22095,6 +22134,12 @@ function eval_pyson(value){
22095
22134
  return;
22096
22135
  }
22097
22136
  button.el.prop('disabled', true); // state will be reset at display
22137
+ var row = this.view.rows.find(function(row) {
22138
+ return row.record == record;
22139
+ });
22140
+ if (row) {
22141
+ row._drawed_record = null; // force redraw the row
22142
+ }
22098
22143
  this.view.screen.button(this.attributes);
22099
22144
  }
22100
22145
  });
@@ -23239,7 +23284,7 @@ function eval_pyson(value){
23239
23284
  var ctx = {
23240
23285
  active_model: data.model || null,
23241
23286
  active_id: data.id || null,
23242
- active_ids: data.ids
23287
+ active_ids: data.ids || [],
23243
23288
  };
23244
23289
  ctx = jQuery.extend(ctx, session.context);
23245
23290
  ctx._user = session.user_id;
@@ -8687,6 +8687,9 @@ html[theme="default"] .input-group-sm > .form-control,
8687
8687
  html[theme="default"] .input-group-sm > .input-group-addon {
8688
8688
  padding: 0 5px;
8689
8689
  }
8690
+ html[theme="default"] .has-feedback .form-control {
8691
+ padding-right: 42.5px;
8692
+ }
8690
8693
  html[theme="default"] .input-group-addon {
8691
8694
  background-color: transparent;
8692
8695
  border: transparent;
@@ -9165,6 +9168,9 @@ button {
9165
9168
  overflow-y: hidden;
9166
9169
  text-overflow: ellipsis;
9167
9170
  }
9171
+ .input-group > .form-control-feedback {
9172
+ z-index: 3;
9173
+ }
9168
9174
  .navbar-inverse .close {
9169
9175
  color: #6dd1d4;
9170
9176
  }
@@ -9389,7 +9395,7 @@ button.list-group-item-selected.active:focus {
9389
9395
  .table-hover > tbody > tr.danger:hover > th {
9390
9396
  background-color: #ebcccc;
9391
9397
  }
9392
- html.accesskey *[accesskey] + span[data-accesskey]:after,
9398
+ html.accesskey *[accesskey] ~ span[data-accesskey]:after,
9393
9399
  html.accesskey *[accesskey]:after {
9394
9400
  background-color: #71bdc1;
9395
9401
  color: #fff;
@@ -9403,19 +9409,19 @@ html.accesskey *[accesskey]:after {
9403
9409
  html.accesskey input[accesskey][type="checkbox"]:after {
9404
9410
  background-color: initial;
9405
9411
  }
9406
- html.accesskey *[accesskey] + span[data-accesskey] {
9412
+ html.accesskey *[accesskey] ~ span[data-accesskey] {
9407
9413
  float: right;
9408
9414
  position: relative;
9409
9415
  }
9410
- html.accesskey *[accesskey] + span[data-accesskey]:after {
9416
+ html.accesskey *[accesskey] ~ span[data-accesskey]:after {
9411
9417
  content: attr(data-accesskey);
9412
9418
  }
9413
9419
  html.accesskey *[accesskey]:after {
9414
9420
  content: attr(accesskey);
9415
9421
  }
9416
- html.accesskey input[accesskey][type="checkbox"] + span[data-accesskey],
9417
- html.accesskey input[accesskey][type="checkbox"] + span[data-accesskey],
9418
- html.accesskey select[accesskey] + span[data-accesskey] {
9422
+ html.accesskey input[accesskey][type="checkbox"] ~ span[data-accesskey],
9423
+ html.accesskey input[accesskey][type="checkbox"] ~ span[data-accesskey],
9424
+ html.accesskey select[accesskey] ~ span[data-accesskey] {
9419
9425
  bottom: 1em;
9420
9426
  }
9421
9427
  .tab-form nav.toolbar,