tryton-sao 6.2.6 → 6.2.9

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.9 - 2022-06-03
2
+ * Bug fixes (see mercurial logs for details)
3
+
4
+ Version 6.2.8 - 2022-05-06
5
+ * Bug fixes (see mercurial logs for details)
6
+
7
+ Version 6.2.7 - 2022-04-15
8
+ * Bug fixes (see mercurial logs for details)
9
+
1
10
  Version 6.2.6 - 2022-03-01
2
11
  * Bug fixes (see mercurial logs for details)
3
12
 
package/Gruntfile.js CHANGED
@@ -135,6 +135,7 @@ module.exports = function(grunt) {
135
135
  },
136
136
  qunit: {
137
137
  options: {
138
+ timeout: 300000,
138
139
  puppeteer: {
139
140
  headless: true,
140
141
  args: [
@@ -1251,7 +1251,7 @@ var Sao = {};
1251
1251
  name = data.error[1][0];
1252
1252
  msg = data.error[1][1];
1253
1253
  description = data.error[1][2];
1254
- Sao.common.userwarning.run(msg, description)
1254
+ Sao.common.userwarning.run(description, msg)
1255
1255
  .then(function(result) {
1256
1256
  if (!~['always', 'ok'].indexOf(result)) {
1257
1257
  dfd.reject();
@@ -2182,10 +2182,14 @@ var Sao = {};
2182
2182
  });
2183
2183
 
2184
2184
  Sao.PYSON.In.eval_ = function(value, context) {
2185
- if (value.v.indexOf) {
2186
- return Boolean(~value.v.indexOf(value.k));
2185
+ if (value.v) {
2186
+ if (value.v.indexOf) {
2187
+ return Boolean(~value.v.indexOf(value.k));
2188
+ } else {
2189
+ return !!value.v[value.k];
2190
+ }
2187
2191
  } else {
2188
- return !!value.v[value.k];
2192
+ return false;
2189
2193
  }
2190
2194
  };
2191
2195
  Sao.PYSON.In.init_from_object = function(obj) {
@@ -3175,7 +3179,7 @@ var Sao = {};
3175
3179
  };
3176
3180
 
3177
3181
  Sao.common.parse_time = function(format, value) {
3178
- if (jQuery.isEmptyObject(value)) {
3182
+ if (!value) {
3179
3183
  return null;
3180
3184
  }
3181
3185
  var getNumber = function(pattern) {
@@ -4242,7 +4246,7 @@ var Sao = {};
4242
4246
 
4243
4247
  var pslice = function(string, depth) {
4244
4248
  if (depth > 0) {
4245
- return string.substring(0, depth);
4249
+ return string.substring(0, string.length - depth);
4246
4250
  }
4247
4251
  return string;
4248
4252
  };
@@ -4352,8 +4356,8 @@ var Sao = {};
4352
4356
  }
4353
4357
  return results;
4354
4358
  },
4355
- is_leaf: function(element) {
4356
- return ((element instanceof Array) && element.clause);
4359
+ is_subdomain: function(element) {
4360
+ return (element instanceof Array) && !element.clause;
4357
4361
  },
4358
4362
  ending_clause: function(domain, depth) {
4359
4363
  if (depth === undefined) {
@@ -4363,7 +4367,7 @@ var Sao = {};
4363
4367
  return [null, depth];
4364
4368
  }
4365
4369
  var last_element = domain[domain.length - 1];
4366
- if (!this.is_leaf(last_element)) {
4370
+ if (this.is_subdomain(last_element)) {
4367
4371
  return this.ending_clause(last_element, depth + 1);
4368
4372
  }
4369
4373
  return [last_element, depth];
@@ -4374,9 +4378,9 @@ var Sao = {};
4374
4378
  for (i = 0, len=domain.length - 1; i < len; i++) {
4375
4379
  results.push(domain[i]);
4376
4380
  }
4377
- if (!this.is_leaf(domain[i])) {
4378
- results = results.concat(this.replace_ending_clause(domain[i],
4379
- clause));
4381
+ if (this.is_subdomain(domain[i])) {
4382
+ results.push(
4383
+ this.replace_ending_clause(domain[i], clause));
4380
4384
  } else {
4381
4385
  results.push(clause);
4382
4386
  }
@@ -4388,7 +4392,7 @@ var Sao = {};
4388
4392
  }
4389
4393
  var results = domain.slice(0, -1);
4390
4394
  var last_element = domain[domain.length - 1];
4391
- if (!this.is_leaf(last_element)) {
4395
+ if (this.is_subdomain(last_element)) {
4392
4396
  results.push(this.append_ending_clause(last_element, clause,
4393
4397
  depth - 1));
4394
4398
  } else {
@@ -5129,19 +5133,17 @@ var Sao = {};
5129
5133
  }
5130
5134
  },
5131
5135
  simplify: function(value) {
5132
- if ((value instanceof Array) && !this.is_leaf(value)) {
5133
- if ((value.length == 1) && (value[0] instanceof Array) &&
5134
- ((value[0][0] == 'AND') || (value[0][0] == 'OR') ||
5135
- (value[0][0] instanceof Array))) {
5136
+ if (this.is_subdomain(value)) {
5137
+ if ((value.length == 1) && this.is_subdomain(value[0])) {
5136
5138
  return this.simplify(value[0]);
5137
5139
  } else if ((value.length == 2) &&
5138
- ((value[0] == 'AND') || (value[0] == 'OR')) &&
5139
- (value[1] instanceof Array)) {
5140
+ ((value[0] == 'AND') || (value[0] == 'OR')) &&
5141
+ this.is_subdomain(value[1])) {
5140
5142
  return this.simplify(value[1]);
5141
5143
  } else if ((value.length == 3) &&
5142
- ((value[0] == 'AND') || (value[0] == 'OR')) &&
5143
- (value[1] instanceof Array) &&
5144
- (value[0] == value[1][0])) {
5144
+ ((value[0] == 'AND') || (value[0] == 'OR')) &&
5145
+ this.is_subdomain(value[1]) &&
5146
+ (value[0] == value[1][0])) {
5145
5147
  value = this.simplify(value[1]).concat([value[2]]);
5146
5148
  }
5147
5149
  return value.map(this.simplify.bind(this));
@@ -6135,8 +6137,8 @@ var Sao = {};
6135
6137
  dialog.body.append(jQuery('<div/>', {
6136
6138
  'class': 'checkbox',
6137
6139
  }).append(jQuery('<label/>')
6138
- .append(always)
6139
- .text(Sao.i18n.gettext('Always ignore this warning.')))
6140
+ .text(Sao.i18n.gettext("Always ignore this warning."))
6141
+ .prepend(always))
6140
6142
  );
6141
6143
  dialog.body.append(jQuery('<p/>')
6142
6144
  .text(Sao.i18n.gettext('Do you want to proceed?')));
@@ -7783,7 +7785,7 @@ var Sao = {};
7783
7785
  return;
7784
7786
  }
7785
7787
  }
7786
- if (this.group.prm.state() == 'pending') {
7788
+ if (async && this.group.prm.state() == 'pending') {
7787
7789
  return this.group.prm.then(function() {
7788
7790
  return this.load(name);
7789
7791
  }.bind(this));
@@ -8134,10 +8136,11 @@ var Sao = {};
8134
8136
  this.on_change_with(fieldnames);
8135
8137
  var callback = function() {
8136
8138
  if (display) {
8137
- return this.group.root_group.screens
8138
- .forEach(function(screen) {
8139
+ return jQuery.when.apply(
8140
+ jQuery, this.group.root_group.screens
8141
+ .map(function(screen) {
8139
8142
  return screen.display();
8140
- });
8143
+ }));
8141
8144
  }
8142
8145
  }.bind(this);
8143
8146
  if (validate) {
@@ -8938,10 +8941,8 @@ var Sao = {};
8938
8941
  value = null;
8939
8942
  }
8940
8943
  } else if (value.isDate) {
8941
- current_value = this.get(record);
8942
- if (current_value) {
8943
- value = Sao.DateTime.combine(value, current_value);
8944
- }
8944
+ current_value = this.get(record) || Sao.Time();
8945
+ value = Sao.DateTime.combine(value, current_value);
8945
8946
  }
8946
8947
  }
8947
8948
  Sao.field.DateTime._super.set_client.call(this, record, value,
@@ -9443,7 +9444,7 @@ var Sao = {};
9443
9444
  if (value instanceof Array) {
9444
9445
  return this._set_value(record, value, false, true);
9445
9446
  }
9446
- if (value.add || value.update) {
9447
+ if (value && (value.add || value.update)) {
9447
9448
  var context = this.get_context(record);
9448
9449
  fields = record._values[this.name].model.fields;
9449
9450
  var new_field_names = {};
@@ -9483,7 +9484,7 @@ var Sao = {};
9483
9484
  }
9484
9485
 
9485
9486
  var group = record._values[this.name];
9486
- if (value.delete) {
9487
+ if (value && value.delete) {
9487
9488
  value.delete.forEach(function(record_id) {
9488
9489
  var record2 = group.get(record_id);
9489
9490
  if (record2) {
@@ -9491,7 +9492,7 @@ var Sao = {};
9491
9492
  }
9492
9493
  }.bind(this));
9493
9494
  }
9494
- if (value.remove) {
9495
+ if (value && value.remove) {
9495
9496
  value.remove.forEach(function(record_id) {
9496
9497
  var record2 = group.get(record_id);
9497
9498
  if (record2) {
@@ -9500,7 +9501,7 @@ var Sao = {};
9500
9501
  }.bind(this));
9501
9502
  }
9502
9503
 
9503
- if (value.add || value.update) {
9504
+ if (value && (value.add || value.update)) {
9504
9505
  // First set already added fields to prevent triggering a
9505
9506
  // second on_change call
9506
9507
  if (value.update) {
@@ -10225,10 +10226,16 @@ var Sao = {};
10225
10226
  this.buttons[item.id].click(item, function(event) {
10226
10227
  var item = event.data;
10227
10228
  var button = this.buttons[item.id];
10228
- button.prop('disabled', true);
10229
+ // Use data instead of disabled prop because the action may
10230
+ // actually disable the button.
10231
+ if (button.data('disabled')) {
10232
+ event.preventDefault();
10233
+ return;
10234
+ }
10235
+ button.data('disabled', true);
10229
10236
  (this[item.id](this) || jQuery.when())
10230
10237
  .always(function() {
10231
- button.prop('disabled', false);
10238
+ button.data('disabled', false);
10232
10239
  });
10233
10240
  }.bind(this));
10234
10241
  };
@@ -10671,13 +10678,14 @@ var Sao = {};
10671
10678
  menu.children().length);
10672
10679
  }
10673
10680
 
10674
- if (menu_action[0] == 'print') {
10675
- if (toolbars.exports.length && toolbars.print.length) {
10681
+ if ((menu_action[0] == 'print') &&
10682
+ toolbars.exports.length) {
10683
+ button._can_be_sensitive = true;
10684
+ if (toolbars.print.length) {
10676
10685
  menu.append(jQuery('<li/>', {
10677
10686
  'role': 'separator',
10678
10687
  'class': 'divider',
10679
10688
  }));
10680
- button._can_be_sensitive = true;
10681
10689
  }
10682
10690
  toolbars.exports.forEach(function(export_) {
10683
10691
  var item = jQuery('<li/>', {
@@ -12354,11 +12362,11 @@ var Sao = {};
12354
12362
  var value = this._parse(this.format, date.val());
12355
12363
  value = this._format(this.format, value);
12356
12364
  date.val(value);
12357
- });
12365
+ }.bind(this));
12358
12366
  mousetrap.bind('=', function(e, combo) {
12359
12367
  e.preventDefault();
12360
12368
  date.val(this._format(this.format, moment()));
12361
- });
12369
+ }.bind(this));
12362
12370
 
12363
12371
  Sao.common.DATE_OPERATORS.forEach(function(operator) {
12364
12372
  mousetrap.bind(operator[0], function(e, combo) {
@@ -16681,7 +16689,7 @@ function eval_pyson(value){
16681
16689
  if (this.has_target(value)) {
16682
16690
  var m2o_id =
16683
16691
  this.id_from_value(record.field_get(this.field_name));
16684
- if (evt && evt.ctrlKey) {
16692
+ if (evt && (evt.ctrlKey || evt.metaKey)) {
16685
16693
  var params = {};
16686
16694
  params.model = this.get_model();
16687
16695
  params.res_id = m2o_id;
@@ -18352,8 +18360,8 @@ function eval_pyson(value){
18352
18360
  },
18353
18361
  set_readonly: function(readonly) {
18354
18362
  Sao.View.Form.Image._super.set_readonly.call(this, readonly);
18355
- this.but_select.prop('disable', readonly);
18356
- this.but_clear.prop('disable', readonly);
18363
+ this.but_select.prop('disabled', readonly);
18364
+ this.but_clear.prop('disabled', readonly);
18357
18365
  },
18358
18366
  clear: function() {
18359
18367
  Sao.View.Form.Image._super.clear.call(this);
@@ -19868,7 +19876,7 @@ function eval_pyson(value){
19868
19876
 
19869
19877
  var parent_row = null;
19870
19878
  var dest_position;
19871
- if (evt.ctrlKey && this.children_field) {
19879
+ if ((evt.ctrlKey || evt.metaKey) && this.children_field) {
19872
19880
  parent_row = this._find_row(row.el.prev());
19873
19881
  dest_position = (parent_row || this).rows.length;
19874
19882
  } else {
@@ -20185,8 +20193,6 @@ function eval_pyson(value){
20185
20193
  }
20186
20194
  this.table.css('min-width', 'calc(' + min_width.join(' + ') + ')');
20187
20195
  this.scrollbar.css('min-width', this.table.css('min-width'));
20188
- this.tbody.find('tr.more-row > td').attr(
20189
- 'colspan', visible_columns);
20190
20196
 
20191
20197
  if (!this.table.hasClass('no-responsive') &
20192
20198
  (this.columns.filter(function(c) {
@@ -20216,7 +20222,9 @@ function eval_pyson(value){
20216
20222
  var more_row = jQuery('<tr/>', {
20217
20223
  'class': 'more-row',
20218
20224
  });
20219
- var more_cell = jQuery('<td/>');
20225
+ var more_cell = jQuery('<td/>', {
20226
+ 'colspan': visible_columns,
20227
+ });
20220
20228
  var more_button = jQuery('<button/>', {
20221
20229
  'class': 'btn btn-default btn-block',
20222
20230
  'type': 'button',
@@ -21083,7 +21091,7 @@ function eval_pyson(value){
21083
21091
  current_record = this.tree.screen.current_record;
21084
21092
  this.tree.select_records(current_record, this.record);
21085
21093
  } else {
21086
- if (!event_.ctrlKey ||
21094
+ if (!(event_.ctrlKey || event_.metaKey) ||
21087
21095
  this.tree.selection_mode ==
21088
21096
  Sao.common.SELECTION_SINGLE) {
21089
21097
  this.tree.select_records(null, null);
@@ -21277,7 +21285,7 @@ function eval_pyson(value){
21277
21285
 
21278
21286
  Sao.View.Tree.RowEditable._super.select_row.call(this, event_);
21279
21287
 
21280
- if (!event_.shiftKey && !event_.ctrlKey) {
21288
+ if (!event_.shiftKey && !(event_.ctrlKey || event_.metaKey)) {
21281
21289
  this.tree.edit_row(this);
21282
21290
  }
21283
21291
  },
@@ -23181,7 +23189,7 @@ function eval_pyson(value){
23181
23189
  }
23182
23190
  this.select_records(i, view_form_idx);
23183
23191
  } else {
23184
- if (!event_.ctrlKey) {
23192
+ if (!(event_.ctrlKey || event_.metaKey)) {
23185
23193
  this.select_records(null, null);
23186
23194
  }
23187
23195
  this.record = view_form.record;
@@ -24724,7 +24732,7 @@ function eval_pyson(value){
24724
24732
  }).text(el_field.attr('name')).prepend(
24725
24733
  Sao.common.ICONFACTORY.get_icon_img('tryton-drag')
24726
24734
  ).click(function(e) {
24727
- if (e.ctrlKey) {
24735
+ if (e.ctrlKey || e.metaKey) {
24728
24736
  node.toggleClass('bg-primary');
24729
24737
  } else {
24730
24738
  jQuery(e.target).addClass('bg-primary')
@@ -24748,7 +24756,7 @@ function eval_pyson(value){
24748
24756
  'field': parent_node[field].field,
24749
24757
  'name': parent_node[field].name
24750
24758
  }).text(name).click(function(e) {
24751
- if(e.ctrlKey) {
24759
+ if (e.ctrlKey || e.metaKey) {
24752
24760
  node.toggleClass('bg-primary');
24753
24761
  } else {
24754
24762
  this.fields_all.find('li').removeClass('bg-primary');
@@ -25107,7 +25115,7 @@ function eval_pyson(value){
25107
25115
  var node = jQuery('<li/>', {
25108
25116
  'path': path
25109
25117
  }).text(parent_node[name].string).click(function(e) {
25110
- if(e.ctrlKey) {
25118
+ if (e.ctrlKey || e.metaKey) {
25111
25119
  node.toggleClass('bg-primary');
25112
25120
  } else {
25113
25121
  this.fields_all.find('li')
@@ -25356,7 +25364,7 @@ function eval_pyson(value){
25356
25364
  'path': name,
25357
25365
  'class': 'draggable-handle',
25358
25366
  }).text(long_string).click(function(e) {
25359
- if(e.ctrlKey) {
25367
+ if (e.ctrlKey || e.metaKey) {
25360
25368
  node.toggleClass('bg-primary');
25361
25369
  } else {
25362
25370
  jQuery(e.target).addClass('bg-primary')