tryton-sao 6.4.0 → 6.4.3

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.4.3 - 2022-07-01
2
+ * Bug fixes (see mercurial logs for details)
3
+
4
+ Version 6.4.2 - 2022-06-15
5
+ * Bug fixes (see mercurial logs for details)
6
+
7
+ Version 6.4.1 - 2022-06-03
8
+ * Bug fixes (see mercurial logs for details)
9
+
1
10
  Version 6.4.0 - 2022-05-02
2
11
  * Bug fixes (see mercurial logs for details)
3
12
  * Support notification message
@@ -4271,7 +4271,7 @@ var Sao = {};
4271
4271
 
4272
4272
  var pslice = function(string, depth) {
4273
4273
  if (depth > 0) {
4274
- return string.substring(0, depth);
4274
+ return string.substring(0, string.length - depth);
4275
4275
  }
4276
4276
  return string;
4277
4277
  };
@@ -4381,15 +4381,15 @@ var Sao = {};
4381
4381
  }
4382
4382
  return results;
4383
4383
  },
4384
- is_leaf: function(element) {
4385
- return ((element instanceof Array) && element.clause);
4384
+ is_subdomain: function(element) {
4385
+ return (element instanceof Array) && !element.clause;
4386
4386
  },
4387
4387
  ending_clause: function(domain, depth=0) {
4388
4388
  if (domain.length === 0) {
4389
4389
  return [null, depth];
4390
4390
  }
4391
4391
  var last_element = domain[domain.length - 1];
4392
- if (!this.is_leaf(last_element)) {
4392
+ if (this.is_subdomain(last_element)) {
4393
4393
  return this.ending_clause(last_element, depth + 1);
4394
4394
  }
4395
4395
  return [last_element, depth];
@@ -4400,9 +4400,9 @@ var Sao = {};
4400
4400
  for (i = 0, len=domain.length - 1; i < len; i++) {
4401
4401
  results.push(domain[i]);
4402
4402
  }
4403
- if (!this.is_leaf(domain[i])) {
4404
- results = results.concat(this.replace_ending_clause(domain[i],
4405
- clause));
4403
+ if (this.is_subdomain(domain[i])) {
4404
+ results.push(
4405
+ this.replace_ending_clause(domain[i], clause));
4406
4406
  } else {
4407
4407
  results.push(clause);
4408
4408
  }
@@ -4414,7 +4414,7 @@ var Sao = {};
4414
4414
  }
4415
4415
  var results = domain.slice(0, -1);
4416
4416
  var last_element = domain[domain.length - 1];
4417
- if (!this.is_leaf(last_element)) {
4417
+ if (this.is_subdomain(last_element)) {
4418
4418
  results.push(this.append_ending_clause(last_element, clause,
4419
4419
  depth - 1));
4420
4420
  } else {
@@ -5139,19 +5139,17 @@ var Sao = {};
5139
5139
  }
5140
5140
  },
5141
5141
  simplify: function(value) {
5142
- if ((value instanceof Array) && !this.is_leaf(value)) {
5143
- if ((value.length == 1) && (value[0] instanceof Array) &&
5144
- ((value[0][0] == 'AND') || (value[0][0] == 'OR') ||
5145
- (value[0][0] instanceof Array))) {
5142
+ if (this.is_subdomain(value)) {
5143
+ if ((value.length == 1) && this.is_subdomain(value[0])) {
5146
5144
  return this.simplify(value[0]);
5147
5145
  } else if ((value.length == 2) &&
5148
- ((value[0] == 'AND') || (value[0] == 'OR')) &&
5149
- (value[1] instanceof Array)) {
5146
+ ((value[0] == 'AND') || (value[0] == 'OR')) &&
5147
+ this.is_subdomain(value[1])) {
5150
5148
  return this.simplify(value[1]);
5151
5149
  } else if ((value.length == 3) &&
5152
- ((value[0] == 'AND') || (value[0] == 'OR')) &&
5153
- (value[1] instanceof Array) &&
5154
- (value[0] == value[1][0])) {
5150
+ ((value[0] == 'AND') || (value[0] == 'OR')) &&
5151
+ this.is_subdomain(value[1]) &&
5152
+ (value[0] == value[1][0])) {
5155
5153
  value = this.simplify(value[1]).concat([value[2]]);
5156
5154
  }
5157
5155
  return value.map(v => this.simplify(v));
@@ -6836,8 +6834,7 @@ var Sao = {};
6836
6834
 
6837
6835
  Sao.common.download_file = function(data, name, options) {
6838
6836
  if (options === undefined) {
6839
- var type = Sao.common.guess_mimetype(
6840
- name ? name.split('.').pop() : undefined);
6837
+ var type = Sao.common.guess_mimetype(name);
6841
6838
  options = {type: type};
6842
6839
  }
6843
6840
  var blob = new Blob([data], options);
@@ -6916,8 +6913,7 @@ var Sao = {};
6916
6913
  };
6917
6914
 
6918
6915
  Sao.common.debounce = function(func, wait) {
6919
- return () => {
6920
- var args = [].slice(arguments);
6916
+ return (...args) => {
6921
6917
  clearTimeout(func._debounceTimeout);
6922
6918
  func._debounceTimeout = setTimeout(() => {
6923
6919
  func.apply(this, args);
@@ -7945,7 +7941,7 @@ var Sao = {};
7945
7941
  }
7946
7942
  delete value[key];
7947
7943
  }
7948
- record.set(value);
7944
+ record.set(value, false);
7949
7945
  }
7950
7946
  }
7951
7947
  };
@@ -9447,7 +9443,7 @@ var Sao = {};
9447
9443
  return this._set_value(record, value, false, true);
9448
9444
  }
9449
9445
  var new_field_names = {};
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 adding_values = [];
@@ -9486,7 +9482,7 @@ var Sao = {};
9486
9482
  }
9487
9483
 
9488
9484
  var group = record._values[this.name];
9489
- if (value.delete) {
9485
+ if (value && value.delete) {
9490
9486
  for (const record_id of value.delete) {
9491
9487
  const record2 = group.get(record_id);
9492
9488
  if (record2) {
@@ -9494,7 +9490,7 @@ var Sao = {};
9494
9490
  }
9495
9491
  }
9496
9492
  }
9497
- if (value.remove) {
9493
+ if (value && value.remove) {
9498
9494
  for (const record_id of value.remove) {
9499
9495
  const record2 = group.get(record_id);
9500
9496
  if (record2) {
@@ -9503,7 +9499,7 @@ var Sao = {};
9503
9499
  }
9504
9500
  }
9505
9501
 
9506
- if (value.add || value.update) {
9502
+ if (value && (value.add || value.update)) {
9507
9503
  // First set already added fields to prevent triggering a
9508
9504
  // second on_change call
9509
9505
  if (value.update) {
@@ -9844,7 +9840,8 @@ var Sao = {};
9844
9840
  },
9845
9841
  get_size: function(record) {
9846
9842
  var data = record._values[this.name] || 0;
9847
- if (data instanceof Uint8Array) {
9843
+ if ((data instanceof Uint8Array) ||
9844
+ (typeof(data) == 'string')) {
9848
9845
  return data.length;
9849
9846
  }
9850
9847
  return data;
@@ -9852,7 +9849,8 @@ var Sao = {};
9852
9849
  get_data: function(record) {
9853
9850
  var data = record._values[this.name] || [];
9854
9851
  var prm = jQuery.when(data);
9855
- if (!(data instanceof Uint8Array)) {
9852
+ if (!(data instanceof Uint8Array) &&
9853
+ (typeof(data) != 'string')) {
9856
9854
  if (record.id < 0) {
9857
9855
  return prm;
9858
9856
  }
@@ -13657,11 +13655,11 @@ var Sao = {};
13657
13655
  (attributes.states || {})).pre_validate || [];
13658
13656
  prms.push(record.validate(fields, false, domain));
13659
13657
  }
13660
- return jQuery.when.apply(jQuery, prms).then(() => {
13658
+ return jQuery.when.apply(jQuery, prms).then((...args) => {
13661
13659
  var record;
13662
13660
  for (var i = 0; i < selected_records.length; i++) {
13663
13661
  record = selected_records[i];
13664
- var result = arguments[i];
13662
+ var result = args[i];
13665
13663
  if (result) {
13666
13664
  continue;
13667
13665
  }
@@ -15875,7 +15873,7 @@ function eval_pyson(value){
15875
15873
  this.date.val(this._format(this.get_format(), value));
15876
15874
  },
15877
15875
  focus: function() {
15878
- this.input.focus();
15876
+ this.date.focus();
15879
15877
  },
15880
15878
  get modified() {
15881
15879
  if (this.record && this.field) {
@@ -18424,8 +18422,8 @@ function eval_pyson(value){
18424
18422
  },
18425
18423
  set_readonly: function(readonly) {
18426
18424
  Sao.View.Form.Image._super.set_readonly.call(this, readonly);
18427
- this.but_select.prop('disable', readonly);
18428
- this.but_clear.prop('disable', readonly);
18425
+ this.but_select.prop('disabled', readonly);
18426
+ this.but_clear.prop('disabled', readonly);
18429
18427
  },
18430
18428
  clear: function() {
18431
18429
  Sao.View.Form.Image._super.clear.call(this);
@@ -20342,8 +20340,6 @@ function eval_pyson(value){
20342
20340
  }
20343
20341
  this.table.css('min-width', 'calc(' + min_width.join(' + ') + ')');
20344
20342
  this.scrollbar.css('min-width', this.table.css('min-width'));
20345
- this.tbody.find('tr.more-row > td').attr(
20346
- 'colspan', visible_columns);
20347
20343
 
20348
20344
  if (!this.table.hasClass('no-responsive') &
20349
20345
  (this.columns.filter(function(c) {
@@ -20373,7 +20369,9 @@ function eval_pyson(value){
20373
20369
  var more_row = jQuery('<tr/>', {
20374
20370
  'class': 'more-row',
20375
20371
  });
20376
- var more_cell = jQuery('<td/>');
20372
+ var more_cell = jQuery('<td/>', {
20373
+ 'colspan': visible_columns,
20374
+ });
20377
20375
  var more_button = jQuery('<button/>', {
20378
20376
  'class': 'btn btn-default btn-block',
20379
20377
  'type': 'button',
@@ -21520,7 +21518,8 @@ function eval_pyson(value){
21520
21518
  (event_.which != Sao.common.DOWN_KEYCODE) &&
21521
21519
  (event_.which != Sao.common.ESC_KEYCODE) &&
21522
21520
  (event_.which != Sao.common.RETURN_KEYCODE)) ||
21523
- jQuery(event_.currentTarget).find('.dropdown-menu').length) {
21521
+ jQuery(event_.currentTarget)
21522
+ .find('.dropdown-menu:visible').length) {
21524
21523
  return;
21525
21524
  }
21526
21525
  var td = this._get_column_td(this.edited_column);
@@ -23714,6 +23713,9 @@ function eval_pyson(value){
23714
23713
  this.__messages = new Set();
23715
23714
  },
23716
23715
  add: function(message, type) {
23716
+ if (!message) {
23717
+ return;
23718
+ }
23717
23719
  var key = JSON.stringify([message, type]);
23718
23720
  if (!this.__messages.has(key)) {
23719
23721
  var infobar = jQuery('<div/>', {
@@ -25768,7 +25770,10 @@ function eval_pyson(value){
25768
25770
  val, {'s': 1, 'm': 60, 'h': 60 * 60});
25769
25771
  } else if (!isNaN(Number(val))) {
25770
25772
  val = val.toLocaleString(
25771
- Sao.i18n.BC47(Sao.i18n.getlang()));
25773
+ Sao.i18n.BC47(Sao.i18n.getlang()), {
25774
+ 'minimumFractionDigits': 0,
25775
+ 'maximumFractionDigits': 20,
25776
+ });
25772
25777
  }
25773
25778
  } else if (val.isTimeDelta) {
25774
25779
  val = val.asSeconds();
@@ -26908,6 +26913,9 @@ SOFTWARE.
26908
26913
  }
26909
26914
  } else {
26910
26915
  new_node = document.createDocumentFragment();
26916
+ if (node.tagName != 'SCRIPT') {
26917
+ new_node.textContent = node.textContent;
26918
+ }
26911
26919
  }
26912
26920
  return new_node;
26913
26921
  }