tryton-sao 5.0.49 → 5.0.52

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.52 - 2022-05-06
2
+ * Bug fixes (see mercurial logs for details)
3
+
4
+ Version 5.0.51 - 2022-04-15
5
+ * Bug fixes (see mercurial logs for details)
6
+
7
+ Version 5.0.50 - 2022-03-01
8
+ * Bug fixes (see mercurial logs for details)
9
+
1
10
  Version 5.0.49 - 2022-02-16
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,
@@ -4583,25 +4585,15 @@ var Sao = {};
4583
4585
  },
4584
4586
  set: function(record, value) {
4585
4587
  var rec_name = record._values[this.name + '.rec_name'] || '';
4586
- var store_rec_name = function(rec_name) {
4587
- record._values[this.name + '.rec_name'] = rec_name[0].rec_name;
4588
- };
4589
4588
  if (!rec_name && (value >= 0) && (value !== null)) {
4590
4589
  var model_name = record.model.fields[this.name].description
4591
4590
  .relation;
4592
- Sao.rpc({
4591
+ rec_name = Sao.rpc({
4593
4592
  'method': 'model.' + model_name + '.read',
4594
4593
  'params': [[value], ['rec_name'], record.get_context()]
4595
- }, record.model.session).done(store_rec_name.bind(this)).done(
4596
- function() {
4597
- record.group.root_group().screens.forEach(
4598
- function(screen) {
4599
- screen.display();
4600
- });
4601
- });
4602
- } else {
4603
- store_rec_name.call(this, [{'rec_name': rec_name}]);
4594
+ }, record.model.session, false)[0].rec_name;
4604
4595
  }
4596
+ record._values[this.name + '.rec_name'] = rec_name;
4605
4597
  record._values[this.name] = value;
4606
4598
  },
4607
4599
  set_client: function(record, value, force_change) {
@@ -5125,25 +5117,20 @@ var Sao = {};
5125
5117
  ref_id = value[1];
5126
5118
  }
5127
5119
  var rec_name = record._values[this.name + '.rec_name'] || '';
5128
- var store_rec_name = function(rec_name) {
5129
- record._values[this.name + '.rec_name'] = rec_name;
5130
- }.bind(this);
5131
5120
  if (ref_model && ref_id !== null && ref_id >= 0) {
5132
5121
  if (!rec_name && ref_id >= 0) {
5133
- Sao.rpc({
5122
+ rec_name = Sao.rpc({
5134
5123
  'method': 'model.' + ref_model + '.read',
5135
5124
  'params': [[ref_id], ['rec_name'], record.get_context()]
5136
- }, record.model.session).done(function(result) {
5137
- store_rec_name(result[0].rec_name);
5138
- });
5125
+ }, record.model.session, false)[0].rec_name;
5139
5126
  }
5140
5127
  } else if (ref_model) {
5141
5128
  rec_name = '';
5142
5129
  } else {
5143
5130
  rec_name = ref_id;
5144
5131
  }
5132
+ record._values[this.name + '.rec_name'] = rec_name;
5145
5133
  record._values[this.name] = [ref_model, ref_id];
5146
- store_rec_name(rec_name);
5147
5134
  },
5148
5135
  get_on_change_value: function(record) {
5149
5136
  if ((record.group.parent_name == this.name) &&
@@ -5601,10 +5588,16 @@ var Sao = {};
5601
5588
  this.buttons[item.id].click(item, function(event) {
5602
5589
  var item = event.data;
5603
5590
  var button = this.buttons[item.id];
5604
- 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);
5605
5598
  (this[item.id](this) || jQuery.when())
5606
5599
  .always(function() {
5607
- button.prop('disabled', false);
5600
+ button.data('disabled', false);
5608
5601
  });
5609
5602
  }.bind(this));
5610
5603
  };
@@ -16612,7 +16605,7 @@ function eval_pyson(value){
16612
16605
  };
16613
16606
 
16614
16607
  Sao.common.parse_time = function(format, value) {
16615
- if (jQuery.isEmptyObject(value)) {
16608
+ if (!value) {
16616
16609
  return null;
16617
16610
  }
16618
16611
  var getNumber = function(pattern) {
@@ -19414,8 +19407,8 @@ function eval_pyson(value){
19414
19407
  dialog.body.append(jQuery('<div/>', {
19415
19408
  'class': 'checkbox',
19416
19409
  }).append(jQuery('<label/>')
19417
- .append(always)
19418
- .text(Sao.i18n.gettext('Always ignore this warning.')))
19410
+ .text(Sao.i18n.gettext("Always ignore this warning."))
19411
+ .prepend(always))
19419
19412
  );
19420
19413
  dialog.body.append(jQuery('<p/>')
19421
19414
  .text(Sao.i18n.gettext('Do you want to proceed?')));