tryton-sao 5.0.50 → 5.0.53

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 5.0.53 - 2022-06-03
2
+ * Bug fixes (see mercurial logs for details)
3
+
4
+ Version 5.0.52 - 2022-05-06
5
+ * Bug fixes (see mercurial logs for details)
6
+
7
+ Version 5.0.51 - 2022-04-15
8
+ * Bug fixes (see mercurial logs for details)
9
+
1
10
  Version 5.0.50 - 2022-03-01
2
11
  * Bug fixes (see mercurial logs for details)
3
12
 
@@ -1187,7 +1187,7 @@ var Sao = {};
1187
1187
  name = data.error[1][0];
1188
1188
  msg = data.error[1][1];
1189
1189
  description = data.error[1][2];
1190
- Sao.common.userwarning.run(msg, description)
1190
+ Sao.common.userwarning.run(description, msg)
1191
1191
  .then(function(result) {
1192
1192
  if (!~['always', 'ok'].indexOf(result)) {
1193
1193
  dfd.reject();
@@ -2072,10 +2072,14 @@ var Sao = {};
2072
2072
  });
2073
2073
 
2074
2074
  Sao.PYSON.In.eval_ = function(value, context) {
2075
- if (value.v.indexOf) {
2076
- return Boolean(~value.v.indexOf(value.k));
2075
+ if (value.v) {
2076
+ if (value.v.indexOf) {
2077
+ return Boolean(~value.v.indexOf(value.k));
2078
+ } else {
2079
+ return !!value.v[value.k];
2080
+ }
2077
2081
  } else {
2078
- return !!value.v[value.k];
2082
+ return false;
2079
2083
  }
2080
2084
  };
2081
2085
  Sao.PYSON.In.init_from_object = function(obj) {
@@ -4380,10 +4384,8 @@ var Sao = {};
4380
4384
  value = null;
4381
4385
  }
4382
4386
  } else if (value.isDate) {
4383
- current_value = this.get(record);
4384
- if (current_value) {
4385
- value = Sao.DateTime.combine(value, current_value);
4386
- }
4387
+ current_value = this.get(record) || Sao.Time();
4388
+ value = Sao.DateTime.combine(value, current_value);
4387
4389
  }
4388
4390
  }
4389
4391
  Sao.field.DateTime._super.set_client.call(this, record, value,
@@ -4845,7 +4847,7 @@ var Sao = {};
4845
4847
  return this._set_value(record, value, false, true);
4846
4848
  }
4847
4849
  var prm = jQuery.when();
4848
- if (value.add || value.update) {
4850
+ if (value && (value.add || value.update)) {
4849
4851
  var context = this.get_context(record);
4850
4852
  var fields = record._values[this.name].model.fields;
4851
4853
  var field_names = {};
@@ -4885,7 +4887,7 @@ var Sao = {};
4885
4887
  to_remove.push(record2);
4886
4888
  }
4887
4889
  });
4888
- if (value.remove) {
4890
+ if (value && value.remove) {
4889
4891
  value.remove.forEach(function(record_id) {
4890
4892
  var record2 = group.get(record_id);
4891
4893
  if (record2) {
@@ -4897,7 +4899,7 @@ var Sao = {};
4897
4899
  group.remove(record2, false, true, false, false);
4898
4900
  }.bind(this));
4899
4901
 
4900
- if (value.add || value.update) {
4902
+ if (value && (value.add || value.update)) {
4901
4903
  prm = prm.then(function(fields) {
4902
4904
  var promises = [];
4903
4905
  group.add_fields(fields);
@@ -5586,10 +5588,16 @@ var Sao = {};
5586
5588
  this.buttons[item.id].click(item, function(event) {
5587
5589
  var item = event.data;
5588
5590
  var button = this.buttons[item.id];
5589
- button.prop('disabled', true);
5591
+ // Use data instead of disabled prop because the action may
5592
+ // actually disable the button.
5593
+ if (button.data('disabled')) {
5594
+ event.preventDefault();
5595
+ return;
5596
+ }
5597
+ button.data('disabled', true);
5590
5598
  (this[item.id](this) || jQuery.when())
5591
5599
  .always(function() {
5592
- button.prop('disabled', false);
5600
+ button.data('disabled', false);
5593
5601
  });
5594
5602
  }.bind(this));
5595
5603
  };
@@ -11069,13 +11077,13 @@ function eval_pyson(value){
11069
11077
  if (this.has_target(value)) {
11070
11078
  var m2o_id =
11071
11079
  this.id_from_value(record.field_get(this.field_name));
11072
- if (evt && evt.ctrlKey) {
11080
+ if (evt && (evt.ctrlKey || evt.metaKey)) {
11073
11081
  var params = {};
11074
11082
  params.model = this.get_model();
11075
11083
  params.res_id = m2o_id;
11076
11084
  params.mode = ['form'];
11077
11085
  params.name = this.attributes.string;
11078
- params.context = this.field.get_context(this.record);
11086
+ params.context = this.field().get_context(record);
11079
11087
  Sao.Tab.create(params);
11080
11088
  return;
11081
11089
  }
@@ -12508,8 +12516,8 @@ function eval_pyson(value){
12508
12516
  },
12509
12517
  set_readonly: function(readonly) {
12510
12518
  Sao.View.Form.Image._super.set_readonly.call(this, readonly);
12511
- this.but_select.prop('disable', readonly);
12512
- this.but_clear.prop('disable', readonly);
12519
+ this.but_select.prop('disabled', readonly);
12520
+ this.but_clear.prop('disabled', readonly);
12513
12521
  },
12514
12522
  clear: function() {
12515
12523
  Sao.View.Form.Image._super.clear.call(this);
@@ -14379,7 +14387,7 @@ function eval_pyson(value){
14379
14387
  this.tree.select_changed(this.record);
14380
14388
  this.switch_row();
14381
14389
  } else {
14382
- if (!event_.ctrlKey ||
14390
+ if (!(event_.ctrlKey || event_.metaKey) ||
14383
14391
  this.tree.selection_mode ==
14384
14392
  Sao.common.SELECTION_SINGLE) {
14385
14393
  this.tree.rows.forEach(function(row) {
@@ -16597,7 +16605,7 @@ function eval_pyson(value){
16597
16605
  };
16598
16606
 
16599
16607
  Sao.common.parse_time = function(format, value) {
16600
- if (jQuery.isEmptyObject(value)) {
16608
+ if (!value) {
16601
16609
  return null;
16602
16610
  }
16603
16611
  var getNumber = function(pattern) {
@@ -17576,7 +17584,7 @@ function eval_pyson(value){
17576
17584
 
17577
17585
  var pslice = function(string, depth) {
17578
17586
  if (depth > 0) {
17579
- return string.substring(0, depth);
17587
+ return string.substring(0, string.length - depth);
17580
17588
  }
17581
17589
  return string;
17582
17590
  };
@@ -17686,8 +17694,8 @@ function eval_pyson(value){
17686
17694
  }
17687
17695
  return results;
17688
17696
  },
17689
- is_leaf: function(element) {
17690
- return ((element instanceof Array) && element.clause);
17697
+ is_subdomain: function(element) {
17698
+ return (element instanceof Array) && !element.clause;
17691
17699
  },
17692
17700
  ending_clause: function(domain, depth) {
17693
17701
  if (depth === undefined) {
@@ -17697,7 +17705,7 @@ function eval_pyson(value){
17697
17705
  return [null, depth];
17698
17706
  }
17699
17707
  var last_element = domain[domain.length - 1];
17700
- if (!this.is_leaf(last_element)) {
17708
+ if (this.is_subdomain(last_element)) {
17701
17709
  return this.ending_clause(last_element, depth + 1);
17702
17710
  }
17703
17711
  return [last_element, depth];
@@ -17708,9 +17716,9 @@ function eval_pyson(value){
17708
17716
  for (i = 0, len=domain.length - 1; i < len; i++) {
17709
17717
  results.push(domain[i]);
17710
17718
  }
17711
- if (!this.is_leaf(domain[i])) {
17712
- results = results.concat(this.replace_ending_clause(domain[i],
17713
- clause));
17719
+ if (this.is_subdomain(domain[i])) {
17720
+ results.push(
17721
+ this.replace_ending_clause(domain[i], clause));
17714
17722
  } else {
17715
17723
  results.push(clause);
17716
17724
  }
@@ -17722,7 +17730,7 @@ function eval_pyson(value){
17722
17730
  }
17723
17731
  var results = domain.slice(0, -1);
17724
17732
  var last_element = domain[domain.length - 1];
17725
- if (!this.is_leaf(last_element)) {
17733
+ if (this.is_subdomain(last_element)) {
17726
17734
  results.push(this.append_ending_clause(last_element, clause,
17727
17735
  depth - 1));
17728
17736
  } else {
@@ -18441,19 +18449,17 @@ function eval_pyson(value){
18441
18449
  }
18442
18450
  },
18443
18451
  simplify: function(value) {
18444
- if ((value instanceof Array) && !this.is_leaf(value)) {
18445
- if ((value.length == 1) && (value[0] instanceof Array) &&
18446
- ((value[0][0] == 'AND') || (value[0][0] == 'OR') ||
18447
- (value[0][0] instanceof Array))) {
18452
+ if (this.is_subdomain(value)) {
18453
+ if ((value.length == 1) && this.is_subdomain(value[0])) {
18448
18454
  return this.simplify(value[0]);
18449
18455
  } else if ((value.length == 2) &&
18450
- ((value[0] == 'AND') || (value[0] == 'OR')) &&
18451
- (value[1] instanceof Array)) {
18456
+ ((value[0] == 'AND') || (value[0] == 'OR')) &&
18457
+ this.is_subdomain(value[1])) {
18452
18458
  return this.simplify(value[1]);
18453
18459
  } else if ((value.length == 3) &&
18454
- ((value[0] == 'AND') || (value[0] == 'OR')) &&
18455
- (value[1] instanceof Array) &&
18456
- (value[0] == value[1][0])) {
18460
+ ((value[0] == 'AND') || (value[0] == 'OR')) &&
18461
+ this.is_subdomain(value[1]) &&
18462
+ (value[0] == value[1][0])) {
18457
18463
  value = this.simplify(value[1]).concat([value[2]]);
18458
18464
  }
18459
18465
  return value.map(this.simplify.bind(this));
@@ -19399,8 +19405,8 @@ function eval_pyson(value){
19399
19405
  dialog.body.append(jQuery('<div/>', {
19400
19406
  'class': 'checkbox',
19401
19407
  }).append(jQuery('<label/>')
19402
- .append(always)
19403
- .text(Sao.i18n.gettext('Always ignore this warning.')))
19408
+ .text(Sao.i18n.gettext("Always ignore this warning."))
19409
+ .prepend(always))
19404
19410
  );
19405
19411
  dialog.body.append(jQuery('<p/>')
19406
19412
  .text(Sao.i18n.gettext('Do you want to proceed?')));
@@ -21260,7 +21266,7 @@ function eval_pyson(value){
21260
21266
  var node = jQuery('<li/>', {
21261
21267
  'field': field,
21262
21268
  }).text(el_field.attr('name')).click(function(e) {
21263
- if (e.ctrlKey) {
21269
+ if (e.ctrlKey || e.metaKey) {
21264
21270
  node.toggleClass('bg-primary');
21265
21271
  } else {
21266
21272
  jQuery(e.target).addClass('bg-primary')
@@ -21284,7 +21290,7 @@ function eval_pyson(value){
21284
21290
  'field': parent_node[field].field,
21285
21291
  'name': parent_node[field].name
21286
21292
  }).text(name).click(function(e) {
21287
- if(e.ctrlKey) {
21293
+ if (e.ctrlKey || e.metaKey) {
21288
21294
  node.toggleClass('bg-primary');
21289
21295
  } else {
21290
21296
  this.fields_all.find('li').removeClass('bg-primary');
@@ -21579,7 +21585,7 @@ function eval_pyson(value){
21579
21585
  var node = jQuery('<li/>', {
21580
21586
  'path': path
21581
21587
  }).text(parent_node[name].string).click(function(e) {
21582
- if(e.ctrlKey) {
21588
+ if (e.ctrlKey || e.metaKey) {
21583
21589
  node.toggleClass('bg-primary');
21584
21590
  } else {
21585
21591
  this.fields_all.find('li')
@@ -21857,7 +21863,7 @@ function eval_pyson(value){
21857
21863
  var node = jQuery('<li/>', {
21858
21864
  'path': name,
21859
21865
  }).text(long_string).click(function(e) {
21860
- if(e.ctrlKey) {
21866
+ if (e.ctrlKey || e.metaKey) {
21861
21867
  node.toggleClass('bg-primary');
21862
21868
  } else {
21863
21869
  jQuery(e.target).addClass('bg-primary')