tryton-sao 6.2.5 → 6.2.8

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.8 - 2022-05-06
2
+ * Bug fixes (see mercurial logs for details)
3
+
4
+ Version 6.2.7 - 2022-04-15
5
+ * Bug fixes (see mercurial logs for details)
6
+
7
+ Version 6.2.6 - 2022-03-01
8
+ * Bug fixes (see mercurial logs for details)
9
+
1
10
  Version 6.2.5 - 2022-02-16
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) {
@@ -6135,8 +6139,8 @@ var Sao = {};
6135
6139
  dialog.body.append(jQuery('<div/>', {
6136
6140
  'class': 'checkbox',
6137
6141
  }).append(jQuery('<label/>')
6138
- .append(always)
6139
- .text(Sao.i18n.gettext('Always ignore this warning.')))
6142
+ .text(Sao.i18n.gettext("Always ignore this warning."))
6143
+ .prepend(always))
6140
6144
  );
6141
6145
  dialog.body.append(jQuery('<p/>')
6142
6146
  .text(Sao.i18n.gettext('Do you want to proceed?')));
@@ -7783,7 +7787,7 @@ var Sao = {};
7783
7787
  return;
7784
7788
  }
7785
7789
  }
7786
- if (this.group.prm.state() == 'pending') {
7790
+ if (async && this.group.prm.state() == 'pending') {
7787
7791
  return this.group.prm.then(function() {
7788
7792
  return this.load(name);
7789
7793
  }.bind(this));
@@ -8134,10 +8138,11 @@ var Sao = {};
8134
8138
  this.on_change_with(fieldnames);
8135
8139
  var callback = function() {
8136
8140
  if (display) {
8137
- return this.group.root_group.screens
8138
- .forEach(function(screen) {
8141
+ return jQuery.when.apply(
8142
+ jQuery, this.group.root_group.screens
8143
+ .map(function(screen) {
8139
8144
  return screen.display();
8140
- });
8145
+ }));
8141
8146
  }
8142
8147
  }.bind(this);
8143
8148
  if (validate) {
@@ -8938,10 +8943,8 @@ var Sao = {};
8938
8943
  value = null;
8939
8944
  }
8940
8945
  } else if (value.isDate) {
8941
- current_value = this.get(record);
8942
- if (current_value) {
8943
- value = Sao.DateTime.combine(value, current_value);
8944
- }
8946
+ current_value = this.get(record) || Sao.Time();
8947
+ value = Sao.DateTime.combine(value, current_value);
8945
8948
  }
8946
8949
  }
8947
8950
  Sao.field.DateTime._super.set_client.call(this, record, value,
@@ -9185,27 +9188,16 @@ var Sao = {};
9185
9188
  set: function(record, value) {
9186
9189
  var rec_name = (
9187
9190
  record._values[this.name + '.'] || {}).rec_name || '';
9188
- var store_rec_name = function(rec_name) {
9189
- Sao.setdefault(
9190
- record._values, this.name + '.', {})
9191
- .rec_name = rec_name[0].rec_name;
9192
- };
9193
9191
  if (!rec_name && (value >= 0) && (value !== null)) {
9194
9192
  var model_name = record.model.fields[this.name].description
9195
9193
  .relation;
9196
- Sao.rpc({
9194
+ rec_name = Sao.rpc({
9197
9195
  'method': 'model.' + model_name + '.read',
9198
9196
  'params': [[value], ['rec_name'], record.get_context()]
9199
- }, record.model.session).done(store_rec_name.bind(this)).done(
9200
- function() {
9201
- record.group.root_group.screens.forEach(
9202
- function(screen) {
9203
- screen.display();
9204
- });
9205
- });
9206
- } else {
9207
- store_rec_name.call(this, [{'rec_name': rec_name}]);
9197
+ }, record.model.session, false)[0].rec_name;
9208
9198
  }
9199
+ Sao.setdefault(
9200
+ record._values, this.name + '.', {}).rec_name = rec_name;
9209
9201
  record._values[this.name] = value;
9210
9202
  },
9211
9203
  set_client: function(record, value, force_change) {
@@ -9756,26 +9748,21 @@ var Sao = {};
9756
9748
  }
9757
9749
  var rec_name = (
9758
9750
  record._values[this.name + '.'] || {}).rec_name || '';
9759
- var store_rec_name = function(rec_name) {
9760
- Sao.setdefault(
9761
- record._values, this.name + '.', {}).rec_name = rec_name;
9762
- }.bind(this);
9763
9751
  if (ref_model && ref_id !== null && ref_id >= 0) {
9764
9752
  if (!rec_name && ref_id >= 0) {
9765
- Sao.rpc({
9753
+ rec_name = Sao.rpc({
9766
9754
  'method': 'model.' + ref_model + '.read',
9767
9755
  'params': [[ref_id], ['rec_name'], record.get_context()]
9768
- }, record.model.session).done(function(result) {
9769
- store_rec_name(result[0].rec_name);
9770
- });
9756
+ }, record.model.session, false)[0].rec_name;
9771
9757
  }
9772
9758
  } else if (ref_model) {
9773
9759
  rec_name = '';
9774
9760
  } else {
9775
9761
  rec_name = ref_id;
9776
9762
  }
9763
+ Sao.setdefault(
9764
+ record._values, this.name + '.', {}).rec_name = rec_name;
9777
9765
  record._values[this.name] = [ref_model, ref_id];
9778
- store_rec_name(rec_name);
9779
9766
  },
9780
9767
  get_on_change_value: function(record) {
9781
9768
  if ((record.group.parent_name == this.name) &&
@@ -10241,10 +10228,16 @@ var Sao = {};
10241
10228
  this.buttons[item.id].click(item, function(event) {
10242
10229
  var item = event.data;
10243
10230
  var button = this.buttons[item.id];
10244
- button.prop('disabled', true);
10231
+ // Use data instead of disabled prop because the action may
10232
+ // actually disable the button.
10233
+ if (button.data('disabled')) {
10234
+ event.preventDefault();
10235
+ return;
10236
+ }
10237
+ button.data('disabled', true);
10245
10238
  (this[item.id](this) || jQuery.when())
10246
10239
  .always(function() {
10247
- button.prop('disabled', false);
10240
+ button.data('disabled', false);
10248
10241
  });
10249
10242
  }.bind(this));
10250
10243
  };
@@ -10687,13 +10680,14 @@ var Sao = {};
10687
10680
  menu.children().length);
10688
10681
  }
10689
10682
 
10690
- if (menu_action[0] == 'print') {
10691
- if (toolbars.exports.length && toolbars.print.length) {
10683
+ if ((menu_action[0] == 'print') &&
10684
+ toolbars.exports.length) {
10685
+ button._can_be_sensitive = true;
10686
+ if (toolbars.print.length) {
10692
10687
  menu.append(jQuery('<li/>', {
10693
10688
  'role': 'separator',
10694
10689
  'class': 'divider',
10695
10690
  }));
10696
- button._can_be_sensitive = true;
10697
10691
  }
10698
10692
  toolbars.exports.forEach(function(export_) {
10699
10693
  var item = jQuery('<li/>', {
@@ -12370,11 +12364,11 @@ var Sao = {};
12370
12364
  var value = this._parse(this.format, date.val());
12371
12365
  value = this._format(this.format, value);
12372
12366
  date.val(value);
12373
- });
12367
+ }.bind(this));
12374
12368
  mousetrap.bind('=', function(e, combo) {
12375
12369
  e.preventDefault();
12376
12370
  date.val(this._format(this.format, moment()));
12377
- });
12371
+ }.bind(this));
12378
12372
 
12379
12373
  Sao.common.DATE_OPERATORS.forEach(function(operator) {
12380
12374
  mousetrap.bind(operator[0], function(e, combo) {
@@ -21457,9 +21451,13 @@ function eval_pyson(value){
21457
21451
  }.bind(this));
21458
21452
  }
21459
21453
  } else {
21460
- this._get_column_td(next_column, next_row)
21461
- .trigger('click')
21462
- .find(':input,[tabindex=0]').focus();
21454
+ prm.then(function() {
21455
+ this._get_column_td(
21456
+ next_column, next_row)
21457
+ .trigger('click')
21458
+ .find(':input,[tabindex=0]')
21459
+ .focus();
21460
+ }.bind(this));
21463
21461
  }
21464
21462
  }
21465
21463
  }.bind(this));