tryton-sao 6.2.7 → 6.2.10

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.10 - 2022-06-15
2
+ * Bug fixes (see mercurial logs for details)
3
+
4
+ Version 6.2.9 - 2022-06-03
5
+ * Bug fixes (see mercurial logs for details)
6
+
7
+ Version 6.2.8 - 2022-05-06
8
+ * Bug fixes (see mercurial logs for details)
9
+
1
10
  Version 6.2.7 - 2022-04-15
2
11
  * Bug fixes (see mercurial logs for details)
3
12
 
@@ -3179,7 +3179,7 @@ var Sao = {};
3179
3179
  };
3180
3180
 
3181
3181
  Sao.common.parse_time = function(format, value) {
3182
- if (jQuery.isEmptyObject(value)) {
3182
+ if (!value) {
3183
3183
  return null;
3184
3184
  }
3185
3185
  var getNumber = function(pattern) {
@@ -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);
@@ -8138,10 +8135,11 @@ var Sao = {};
8138
8135
  this.on_change_with(fieldnames);
8139
8136
  var callback = function() {
8140
8137
  if (display) {
8141
- return this.group.root_group.screens
8142
- .forEach(function(screen) {
8138
+ return jQuery.when.apply(
8139
+ jQuery, this.group.root_group.screens
8140
+ .map(function(screen) {
8143
8141
  return screen.display();
8144
- });
8142
+ }));
8145
8143
  }
8146
8144
  }.bind(this);
8147
8145
  if (validate) {
@@ -8942,10 +8940,8 @@ var Sao = {};
8942
8940
  value = null;
8943
8941
  }
8944
8942
  } else if (value.isDate) {
8945
- current_value = this.get(record);
8946
- if (current_value) {
8947
- value = Sao.DateTime.combine(value, current_value);
8948
- }
8943
+ current_value = this.get(record) || Sao.Time();
8944
+ value = Sao.DateTime.combine(value, current_value);
8949
8945
  }
8950
8946
  }
8951
8947
  Sao.field.DateTime._super.set_client.call(this, record, value,
@@ -9447,7 +9443,7 @@ var Sao = {};
9447
9443
  if (value instanceof Array) {
9448
9444
  return this._set_value(record, value, false, true);
9449
9445
  }
9450
- if (value.add || value.update) {
9446
+ if (value && (value.add || value.update)) {
9451
9447
  var context = this.get_context(record);
9452
9448
  fields = record._values[this.name].model.fields;
9453
9449
  var new_field_names = {};
@@ -9487,7 +9483,7 @@ var Sao = {};
9487
9483
  }
9488
9484
 
9489
9485
  var group = record._values[this.name];
9490
- if (value.delete) {
9486
+ if (value && value.delete) {
9491
9487
  value.delete.forEach(function(record_id) {
9492
9488
  var record2 = group.get(record_id);
9493
9489
  if (record2) {
@@ -9495,7 +9491,7 @@ var Sao = {};
9495
9491
  }
9496
9492
  }.bind(this));
9497
9493
  }
9498
- if (value.remove) {
9494
+ if (value && value.remove) {
9499
9495
  value.remove.forEach(function(record_id) {
9500
9496
  var record2 = group.get(record_id);
9501
9497
  if (record2) {
@@ -9504,7 +9500,7 @@ var Sao = {};
9504
9500
  }.bind(this));
9505
9501
  }
9506
9502
 
9507
- if (value.add || value.update) {
9503
+ if (value && (value.add || value.update)) {
9508
9504
  // First set already added fields to prevent triggering a
9509
9505
  // second on_change call
9510
9506
  if (value.update) {
@@ -9830,7 +9826,8 @@ var Sao = {};
9830
9826
  },
9831
9827
  get_size: function(record) {
9832
9828
  var data = record._values[this.name] || 0;
9833
- if (data instanceof Uint8Array) {
9829
+ if ((data instanceof Uint8Array) ||
9830
+ (typeof(data) == 'string')) {
9834
9831
  return data.length;
9835
9832
  }
9836
9833
  return data;
@@ -9838,7 +9835,8 @@ var Sao = {};
9838
9835
  get_data: function(record) {
9839
9836
  var data = record._values[this.name] || [];
9840
9837
  var prm = jQuery.when(data);
9841
- if (!(data instanceof Uint8Array)) {
9838
+ if (!(data instanceof Uint8Array) &&
9839
+ (typeof(data) != 'string')) {
9842
9840
  if (record.id < 0) {
9843
9841
  return prm;
9844
9842
  }
@@ -15817,7 +15815,7 @@ function eval_pyson(value){
15817
15815
  this.date.val(this._format(this.get_format(), value));
15818
15816
  },
15819
15817
  focus: function() {
15820
- this.input.focus();
15818
+ this.date.focus();
15821
15819
  },
15822
15820
  get modified() {
15823
15821
  if (this.record && this.field) {
@@ -16692,7 +16690,7 @@ function eval_pyson(value){
16692
16690
  if (this.has_target(value)) {
16693
16691
  var m2o_id =
16694
16692
  this.id_from_value(record.field_get(this.field_name));
16695
- if (evt && evt.ctrlKey) {
16693
+ if (evt && (evt.ctrlKey || evt.metaKey)) {
16696
16694
  var params = {};
16697
16695
  params.model = this.get_model();
16698
16696
  params.res_id = m2o_id;
@@ -18363,8 +18361,8 @@ function eval_pyson(value){
18363
18361
  },
18364
18362
  set_readonly: function(readonly) {
18365
18363
  Sao.View.Form.Image._super.set_readonly.call(this, readonly);
18366
- this.but_select.prop('disable', readonly);
18367
- this.but_clear.prop('disable', readonly);
18364
+ this.but_select.prop('disabled', readonly);
18365
+ this.but_clear.prop('disabled', readonly);
18368
18366
  },
18369
18367
  clear: function() {
18370
18368
  Sao.View.Form.Image._super.clear.call(this);
@@ -19879,7 +19877,7 @@ function eval_pyson(value){
19879
19877
 
19880
19878
  var parent_row = null;
19881
19879
  var dest_position;
19882
- if (evt.ctrlKey && this.children_field) {
19880
+ if ((evt.ctrlKey || evt.metaKey) && this.children_field) {
19883
19881
  parent_row = this._find_row(row.el.prev());
19884
19882
  dest_position = (parent_row || this).rows.length;
19885
19883
  } else {
@@ -20196,8 +20194,6 @@ function eval_pyson(value){
20196
20194
  }
20197
20195
  this.table.css('min-width', 'calc(' + min_width.join(' + ') + ')');
20198
20196
  this.scrollbar.css('min-width', this.table.css('min-width'));
20199
- this.tbody.find('tr.more-row > td').attr(
20200
- 'colspan', visible_columns);
20201
20197
 
20202
20198
  if (!this.table.hasClass('no-responsive') &
20203
20199
  (this.columns.filter(function(c) {
@@ -20227,7 +20223,9 @@ function eval_pyson(value){
20227
20223
  var more_row = jQuery('<tr/>', {
20228
20224
  'class': 'more-row',
20229
20225
  });
20230
- var more_cell = jQuery('<td/>');
20226
+ var more_cell = jQuery('<td/>', {
20227
+ 'colspan': visible_columns,
20228
+ });
20231
20229
  var more_button = jQuery('<button/>', {
20232
20230
  'class': 'btn btn-default btn-block',
20233
20231
  'type': 'button',
@@ -21094,7 +21092,7 @@ function eval_pyson(value){
21094
21092
  current_record = this.tree.screen.current_record;
21095
21093
  this.tree.select_records(current_record, this.record);
21096
21094
  } else {
21097
- if (!event_.ctrlKey ||
21095
+ if (!(event_.ctrlKey || event_.metaKey) ||
21098
21096
  this.tree.selection_mode ==
21099
21097
  Sao.common.SELECTION_SINGLE) {
21100
21098
  this.tree.select_records(null, null);
@@ -21288,7 +21286,7 @@ function eval_pyson(value){
21288
21286
 
21289
21287
  Sao.View.Tree.RowEditable._super.select_row.call(this, event_);
21290
21288
 
21291
- if (!event_.shiftKey && !event_.ctrlKey) {
21289
+ if (!event_.shiftKey && !(event_.ctrlKey || event_.metaKey)) {
21292
21290
  this.tree.edit_row(this);
21293
21291
  }
21294
21292
  },
@@ -21365,7 +21363,8 @@ function eval_pyson(value){
21365
21363
  (event_.which != Sao.common.DOWN_KEYCODE) &&
21366
21364
  (event_.which != Sao.common.ESC_KEYCODE) &&
21367
21365
  (event_.which != Sao.common.RETURN_KEYCODE)) ||
21368
- jQuery(event_.currentTarget).find('.dropdown-menu').length) {
21366
+ jQuery(event_.currentTarget)
21367
+ .find('.dropdown-menu:visible').length) {
21369
21368
  return;
21370
21369
  }
21371
21370
  var td = this._get_column_td(this.edited_column);
@@ -23192,7 +23191,7 @@ function eval_pyson(value){
23192
23191
  }
23193
23192
  this.select_records(i, view_form_idx);
23194
23193
  } else {
23195
- if (!event_.ctrlKey) {
23194
+ if (!(event_.ctrlKey || event_.metaKey)) {
23196
23195
  this.select_records(null, null);
23197
23196
  }
23198
23197
  this.record = view_form.record;
@@ -24735,7 +24734,7 @@ function eval_pyson(value){
24735
24734
  }).text(el_field.attr('name')).prepend(
24736
24735
  Sao.common.ICONFACTORY.get_icon_img('tryton-drag')
24737
24736
  ).click(function(e) {
24738
- if (e.ctrlKey) {
24737
+ if (e.ctrlKey || e.metaKey) {
24739
24738
  node.toggleClass('bg-primary');
24740
24739
  } else {
24741
24740
  jQuery(e.target).addClass('bg-primary')
@@ -24759,7 +24758,7 @@ function eval_pyson(value){
24759
24758
  'field': parent_node[field].field,
24760
24759
  'name': parent_node[field].name
24761
24760
  }).text(name).click(function(e) {
24762
- if(e.ctrlKey) {
24761
+ if (e.ctrlKey || e.metaKey) {
24763
24762
  node.toggleClass('bg-primary');
24764
24763
  } else {
24765
24764
  this.fields_all.find('li').removeClass('bg-primary');
@@ -25118,7 +25117,7 @@ function eval_pyson(value){
25118
25117
  var node = jQuery('<li/>', {
25119
25118
  'path': path
25120
25119
  }).text(parent_node[name].string).click(function(e) {
25121
- if(e.ctrlKey) {
25120
+ if (e.ctrlKey || e.metaKey) {
25122
25121
  node.toggleClass('bg-primary');
25123
25122
  } else {
25124
25123
  this.fields_all.find('li')
@@ -25367,7 +25366,7 @@ function eval_pyson(value){
25367
25366
  'path': name,
25368
25367
  'class': 'draggable-handle',
25369
25368
  }).text(long_string).click(function(e) {
25370
- if(e.ctrlKey) {
25369
+ if (e.ctrlKey || e.metaKey) {
25371
25370
  node.toggleClass('bg-primary');
25372
25371
  } else {
25373
25372
  jQuery(e.target).addClass('bg-primary')
@@ -26644,6 +26643,9 @@ SOFTWARE.
26644
26643
  }
26645
26644
  } else {
26646
26645
  new_node = document.createDocumentFragment();
26646
+ if (node.tagName != 'SCRIPT') {
26647
+ new_node.textContent = node.textContent;
26648
+ }
26647
26649
  }
26648
26650
  return new_node;
26649
26651
  }