tryton-sao 6.2.8 → 6.2.11

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.11 - 2022-07-01
2
+ * Bug fixes (see mercurial logs for details)
3
+
4
+ Version 6.2.10 - 2022-06-15
5
+ * Bug fixes (see mercurial logs for details)
6
+
7
+ Version 6.2.9 - 2022-06-03
8
+ * Bug fixes (see mercurial logs for details)
9
+
1
10
  Version 6.2.8 - 2022-05-06
2
11
  * Bug fixes (see mercurial logs for details)
3
12
 
@@ -4246,7 +4246,7 @@ var Sao = {};
4246
4246
 
4247
4247
  var pslice = function(string, depth) {
4248
4248
  if (depth > 0) {
4249
- return string.substring(0, depth);
4249
+ return string.substring(0, string.length - depth);
4250
4250
  }
4251
4251
  return string;
4252
4252
  };
@@ -4356,8 +4356,8 @@ var Sao = {};
4356
4356
  }
4357
4357
  return results;
4358
4358
  },
4359
- is_leaf: function(element) {
4360
- return ((element instanceof Array) && element.clause);
4359
+ is_subdomain: function(element) {
4360
+ return (element instanceof Array) && !element.clause;
4361
4361
  },
4362
4362
  ending_clause: function(domain, depth) {
4363
4363
  if (depth === undefined) {
@@ -4367,7 +4367,7 @@ var Sao = {};
4367
4367
  return [null, depth];
4368
4368
  }
4369
4369
  var last_element = domain[domain.length - 1];
4370
- if (!this.is_leaf(last_element)) {
4370
+ if (this.is_subdomain(last_element)) {
4371
4371
  return this.ending_clause(last_element, depth + 1);
4372
4372
  }
4373
4373
  return [last_element, depth];
@@ -4378,9 +4378,9 @@ var Sao = {};
4378
4378
  for (i = 0, len=domain.length - 1; i < len; i++) {
4379
4379
  results.push(domain[i]);
4380
4380
  }
4381
- if (!this.is_leaf(domain[i])) {
4382
- results = results.concat(this.replace_ending_clause(domain[i],
4383
- clause));
4381
+ if (this.is_subdomain(domain[i])) {
4382
+ results.push(
4383
+ this.replace_ending_clause(domain[i], clause));
4384
4384
  } else {
4385
4385
  results.push(clause);
4386
4386
  }
@@ -4392,7 +4392,7 @@ var Sao = {};
4392
4392
  }
4393
4393
  var results = domain.slice(0, -1);
4394
4394
  var last_element = domain[domain.length - 1];
4395
- if (!this.is_leaf(last_element)) {
4395
+ if (this.is_subdomain(last_element)) {
4396
4396
  results.push(this.append_ending_clause(last_element, clause,
4397
4397
  depth - 1));
4398
4398
  } else {
@@ -5133,19 +5133,17 @@ var Sao = {};
5133
5133
  }
5134
5134
  },
5135
5135
  simplify: function(value) {
5136
- if ((value instanceof Array) && !this.is_leaf(value)) {
5137
- if ((value.length == 1) && (value[0] instanceof Array) &&
5138
- ((value[0][0] == 'AND') || (value[0][0] == 'OR') ||
5139
- (value[0][0] instanceof Array))) {
5136
+ if (this.is_subdomain(value)) {
5137
+ if ((value.length == 1) && this.is_subdomain(value[0])) {
5140
5138
  return this.simplify(value[0]);
5141
5139
  } else if ((value.length == 2) &&
5142
- ((value[0] == 'AND') || (value[0] == 'OR')) &&
5143
- (value[1] instanceof Array)) {
5140
+ ((value[0] == 'AND') || (value[0] == 'OR')) &&
5141
+ this.is_subdomain(value[1])) {
5144
5142
  return this.simplify(value[1]);
5145
5143
  } else if ((value.length == 3) &&
5146
- ((value[0] == 'AND') || (value[0] == 'OR')) &&
5147
- (value[1] instanceof Array) &&
5148
- (value[0] == value[1][0])) {
5144
+ ((value[0] == 'AND') || (value[0] == 'OR')) &&
5145
+ this.is_subdomain(value[1]) &&
5146
+ (value[0] == value[1][0])) {
5149
5147
  value = this.simplify(value[1]).concat([value[2]]);
5150
5148
  }
5151
5149
  return value.map(this.simplify.bind(this));
@@ -6774,8 +6772,7 @@ var Sao = {};
6774
6772
 
6775
6773
  Sao.common.download_file = function(data, name, options) {
6776
6774
  if (options === undefined) {
6777
- var type = Sao.common.guess_mimetype(
6778
- name ? name.split('.').pop() : undefined);
6775
+ var type = Sao.common.guess_mimetype(name);
6779
6776
  options = {type: type};
6780
6777
  }
6781
6778
  var blob = new Blob([data], options);
@@ -9446,7 +9443,7 @@ var Sao = {};
9446
9443
  if (value instanceof Array) {
9447
9444
  return this._set_value(record, value, false, true);
9448
9445
  }
9449
- if (value.add || value.update) {
9446
+ if (value && (value.add || value.update)) {
9450
9447
  var context = this.get_context(record);
9451
9448
  fields = record._values[this.name].model.fields;
9452
9449
  var new_field_names = {};
@@ -9486,7 +9483,7 @@ var Sao = {};
9486
9483
  }
9487
9484
 
9488
9485
  var group = record._values[this.name];
9489
- if (value.delete) {
9486
+ if (value && value.delete) {
9490
9487
  value.delete.forEach(function(record_id) {
9491
9488
  var record2 = group.get(record_id);
9492
9489
  if (record2) {
@@ -9494,7 +9491,7 @@ var Sao = {};
9494
9491
  }
9495
9492
  }.bind(this));
9496
9493
  }
9497
- if (value.remove) {
9494
+ if (value && value.remove) {
9498
9495
  value.remove.forEach(function(record_id) {
9499
9496
  var record2 = group.get(record_id);
9500
9497
  if (record2) {
@@ -9503,7 +9500,7 @@ var Sao = {};
9503
9500
  }.bind(this));
9504
9501
  }
9505
9502
 
9506
- if (value.add || value.update) {
9503
+ if (value && (value.add || value.update)) {
9507
9504
  // First set already added fields to prevent triggering a
9508
9505
  // second on_change call
9509
9506
  if (value.update) {
@@ -9829,7 +9826,8 @@ var Sao = {};
9829
9826
  },
9830
9827
  get_size: function(record) {
9831
9828
  var data = record._values[this.name] || 0;
9832
- if (data instanceof Uint8Array) {
9829
+ if ((data instanceof Uint8Array) ||
9830
+ (typeof(data) == 'string')) {
9833
9831
  return data.length;
9834
9832
  }
9835
9833
  return data;
@@ -9837,7 +9835,8 @@ var Sao = {};
9837
9835
  get_data: function(record) {
9838
9836
  var data = record._values[this.name] || [];
9839
9837
  var prm = jQuery.when(data);
9840
- if (!(data instanceof Uint8Array)) {
9838
+ if (!(data instanceof Uint8Array) &&
9839
+ (typeof(data) != 'string')) {
9841
9840
  if (record.id < 0) {
9842
9841
  return prm;
9843
9842
  }
@@ -15816,7 +15815,7 @@ function eval_pyson(value){
15816
15815
  this.date.val(this._format(this.get_format(), value));
15817
15816
  },
15818
15817
  focus: function() {
15819
- this.input.focus();
15818
+ this.date.focus();
15820
15819
  },
15821
15820
  get modified() {
15822
15821
  if (this.record && this.field) {
@@ -16691,7 +16690,7 @@ function eval_pyson(value){
16691
16690
  if (this.has_target(value)) {
16692
16691
  var m2o_id =
16693
16692
  this.id_from_value(record.field_get(this.field_name));
16694
- if (evt && evt.ctrlKey) {
16693
+ if (evt && (evt.ctrlKey || evt.metaKey)) {
16695
16694
  var params = {};
16696
16695
  params.model = this.get_model();
16697
16696
  params.res_id = m2o_id;
@@ -18362,8 +18361,8 @@ function eval_pyson(value){
18362
18361
  },
18363
18362
  set_readonly: function(readonly) {
18364
18363
  Sao.View.Form.Image._super.set_readonly.call(this, readonly);
18365
- this.but_select.prop('disable', readonly);
18366
- this.but_clear.prop('disable', readonly);
18364
+ this.but_select.prop('disabled', readonly);
18365
+ this.but_clear.prop('disabled', readonly);
18367
18366
  },
18368
18367
  clear: function() {
18369
18368
  Sao.View.Form.Image._super.clear.call(this);
@@ -19878,7 +19877,7 @@ function eval_pyson(value){
19878
19877
 
19879
19878
  var parent_row = null;
19880
19879
  var dest_position;
19881
- if (evt.ctrlKey && this.children_field) {
19880
+ if ((evt.ctrlKey || evt.metaKey) && this.children_field) {
19882
19881
  parent_row = this._find_row(row.el.prev());
19883
19882
  dest_position = (parent_row || this).rows.length;
19884
19883
  } else {
@@ -20195,8 +20194,6 @@ function eval_pyson(value){
20195
20194
  }
20196
20195
  this.table.css('min-width', 'calc(' + min_width.join(' + ') + ')');
20197
20196
  this.scrollbar.css('min-width', this.table.css('min-width'));
20198
- this.tbody.find('tr.more-row > td').attr(
20199
- 'colspan', visible_columns);
20200
20197
 
20201
20198
  if (!this.table.hasClass('no-responsive') &
20202
20199
  (this.columns.filter(function(c) {
@@ -20226,7 +20223,9 @@ function eval_pyson(value){
20226
20223
  var more_row = jQuery('<tr/>', {
20227
20224
  'class': 'more-row',
20228
20225
  });
20229
- var more_cell = jQuery('<td/>');
20226
+ var more_cell = jQuery('<td/>', {
20227
+ 'colspan': visible_columns,
20228
+ });
20230
20229
  var more_button = jQuery('<button/>', {
20231
20230
  'class': 'btn btn-default btn-block',
20232
20231
  'type': 'button',
@@ -21093,7 +21092,7 @@ function eval_pyson(value){
21093
21092
  current_record = this.tree.screen.current_record;
21094
21093
  this.tree.select_records(current_record, this.record);
21095
21094
  } else {
21096
- if (!event_.ctrlKey ||
21095
+ if (!(event_.ctrlKey || event_.metaKey) ||
21097
21096
  this.tree.selection_mode ==
21098
21097
  Sao.common.SELECTION_SINGLE) {
21099
21098
  this.tree.select_records(null, null);
@@ -21287,7 +21286,7 @@ function eval_pyson(value){
21287
21286
 
21288
21287
  Sao.View.Tree.RowEditable._super.select_row.call(this, event_);
21289
21288
 
21290
- if (!event_.shiftKey && !event_.ctrlKey) {
21289
+ if (!event_.shiftKey && !(event_.ctrlKey || event_.metaKey)) {
21291
21290
  this.tree.edit_row(this);
21292
21291
  }
21293
21292
  },
@@ -21364,7 +21363,8 @@ function eval_pyson(value){
21364
21363
  (event_.which != Sao.common.DOWN_KEYCODE) &&
21365
21364
  (event_.which != Sao.common.ESC_KEYCODE) &&
21366
21365
  (event_.which != Sao.common.RETURN_KEYCODE)) ||
21367
- jQuery(event_.currentTarget).find('.dropdown-menu').length) {
21366
+ jQuery(event_.currentTarget)
21367
+ .find('.dropdown-menu:visible').length) {
21368
21368
  return;
21369
21369
  }
21370
21370
  var td = this._get_column_td(this.edited_column);
@@ -23191,7 +23191,7 @@ function eval_pyson(value){
23191
23191
  }
23192
23192
  this.select_records(i, view_form_idx);
23193
23193
  } else {
23194
- if (!event_.ctrlKey) {
23194
+ if (!(event_.ctrlKey || event_.metaKey)) {
23195
23195
  this.select_records(null, null);
23196
23196
  }
23197
23197
  this.record = view_form.record;
@@ -24734,7 +24734,7 @@ function eval_pyson(value){
24734
24734
  }).text(el_field.attr('name')).prepend(
24735
24735
  Sao.common.ICONFACTORY.get_icon_img('tryton-drag')
24736
24736
  ).click(function(e) {
24737
- if (e.ctrlKey) {
24737
+ if (e.ctrlKey || e.metaKey) {
24738
24738
  node.toggleClass('bg-primary');
24739
24739
  } else {
24740
24740
  jQuery(e.target).addClass('bg-primary')
@@ -24758,7 +24758,7 @@ function eval_pyson(value){
24758
24758
  'field': parent_node[field].field,
24759
24759
  'name': parent_node[field].name
24760
24760
  }).text(name).click(function(e) {
24761
- if(e.ctrlKey) {
24761
+ if (e.ctrlKey || e.metaKey) {
24762
24762
  node.toggleClass('bg-primary');
24763
24763
  } else {
24764
24764
  this.fields_all.find('li').removeClass('bg-primary');
@@ -25117,7 +25117,7 @@ function eval_pyson(value){
25117
25117
  var node = jQuery('<li/>', {
25118
25118
  'path': path
25119
25119
  }).text(parent_node[name].string).click(function(e) {
25120
- if(e.ctrlKey) {
25120
+ if (e.ctrlKey || e.metaKey) {
25121
25121
  node.toggleClass('bg-primary');
25122
25122
  } else {
25123
25123
  this.fields_all.find('li')
@@ -25366,7 +25366,7 @@ function eval_pyson(value){
25366
25366
  'path': name,
25367
25367
  'class': 'draggable-handle',
25368
25368
  }).text(long_string).click(function(e) {
25369
- if(e.ctrlKey) {
25369
+ if (e.ctrlKey || e.metaKey) {
25370
25370
  node.toggleClass('bg-primary');
25371
25371
  } else {
25372
25372
  jQuery(e.target).addClass('bg-primary')
@@ -25537,7 +25537,10 @@ function eval_pyson(value){
25537
25537
  val, {'s': 1, 'm': 60, 'h': 60 * 60});
25538
25538
  } else if (!isNaN(Number(val))) {
25539
25539
  val = val.toLocaleString(
25540
- Sao.i18n.BC47(Sao.i18n.getlang()));
25540
+ Sao.i18n.BC47(Sao.i18n.getlang()), {
25541
+ 'minimumFractionDigits': 0,
25542
+ 'maximumFractionDigits': 20,
25543
+ });
25541
25544
  }
25542
25545
  } else if (val.isTimeDelta) {
25543
25546
  val = val.asSeconds();
@@ -26643,6 +26646,9 @@ SOFTWARE.
26643
26646
  }
26644
26647
  } else {
26645
26648
  new_node = document.createDocumentFragment();
26649
+ if (node.tagName != 'SCRIPT') {
26650
+ new_node.textContent = node.textContent;
26651
+ }
26646
26652
  }
26647
26653
  return new_node;
26648
26654
  }