tryton-sao 6.0.30 → 6.0.32

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,4 +1,14 @@
1
1
 
2
+ Version 6.0.32 - 2023-11-03
3
+ ---------------------------
4
+ * Bug fixes (see mercurial logs for details)
5
+
6
+
7
+ Version 6.0.31 - 2023-10-04
8
+ ---------------------------
9
+ * Bug fixes (see mercurial logs for details)
10
+
11
+
2
12
  Version 6.0.30 - 2023-05-17
3
13
  ---------------------------
4
14
  * Bug fixes (see mercurial logs for details)
@@ -7238,18 +7238,18 @@ var Sao = {};
7238
7238
  if (this.indexOf(record) < 0) {
7239
7239
  this.splice(position, 0, record);
7240
7240
  }
7241
- for (var record_rm in this.record_removed) {
7241
+ this.record_removed.forEach(function(record_rm) {
7242
7242
  if (record_rm.id == record.id) {
7243
7243
  this.record_removed.splice(
7244
7244
  this.record_removed.indexOf(record_rm), 1);
7245
7245
  }
7246
- }
7247
- for (var record_del in this.record_deleted) {
7246
+ });
7247
+ this.record_deleted.forEach(function(record_del) {
7248
7248
  if (record_del.id == record.id) {
7249
7249
  this.record_deleted.splice(
7250
7250
  this.record_deleted.indexOf(record_del), 1);
7251
7251
  }
7252
- }
7252
+ });
7253
7253
  record._changed.id = true;
7254
7254
  if (changed) {
7255
7255
  this.changed();
@@ -8131,7 +8131,7 @@ var Sao = {};
8131
8131
  get_eval: function() {
8132
8132
  var value = {};
8133
8133
  for (var key in this.model.fields) {
8134
- if (!this.model.fields.hasOwnProperty(key) && this.id >= 0)
8134
+ if (!this._loaded.hasOwnProperty(key) && this.id >= 0)
8135
8135
  continue;
8136
8136
  value[key] = this.model.fields[key].get_eval(this);
8137
8137
  }
@@ -10933,6 +10933,7 @@ var Sao = {};
10933
10933
  revision.add(1, 'milliseconds');
10934
10934
  }
10935
10935
  if ((this.screen.current_view.view_type == 'form') &&
10936
+ revision &&
10936
10937
  (revision < revisions[revisions.length - 1][0])) {
10937
10938
  revision = revisions[revisions.length - 1][0];
10938
10939
  }
@@ -10961,8 +10962,14 @@ var Sao = {};
10961
10962
  return this.screen.model.execute('history_revisions',
10962
10963
  [ids], this.screen.context)
10963
10964
  .then(function(revisions) {
10964
- new Sao.Window.Revision(revisions, set_revision(revisions));
10965
- });
10965
+ var revision = this.screen.context._datetime;
10966
+ if (revision) {
10967
+ // Remove a millisecond as microseconds are truncated
10968
+ revision.add(-1, 'milliseconds');
10969
+ }
10970
+ new Sao.Window.Revision(
10971
+ revisions, revision, set_revision(revisions));
10972
+ }.bind(this));
10966
10973
  }.bind(this));
10967
10974
  },
10968
10975
  update_revision: function() {
@@ -12671,7 +12678,8 @@ var Sao = {};
12671
12678
  var domain = this.search_domain(search_string, true);
12672
12679
 
12673
12680
  var context = this.context;
12674
- if (this.screen_container.but_active.hasClass('active')) {
12681
+ if ((this.screen_container.but_active.css('display') != 'none') &&
12682
+ this.screen_container.but_active.hasClass('active')) {
12675
12683
  context.active_test = false;
12676
12684
  }
12677
12685
  var search = function() {
@@ -12752,7 +12760,8 @@ var Sao = {};
12752
12760
  } else {
12753
12761
  domain = this.domain;
12754
12762
  }
12755
- if (this.screen_container.but_active.hasClass('active')) {
12763
+ if ((this.screen_container.but_active.css('display') != 'none') &&
12764
+ this.screen_container.but_active.hasClass('active')) {
12756
12765
  if (!jQuery.isEmptyObject(domain)) {
12757
12766
  domain = [domain, ['active', '=', false]];
12758
12767
  } else {
@@ -12939,6 +12948,17 @@ var Sao = {};
12939
12948
  deferreds.push(this.views[i].display());
12940
12949
  }
12941
12950
  }
12951
+ if (this.current_view.view_type == 'tree') {
12952
+ var view_tree = this.fields_view_tree[
12953
+ this.current_view.view_id] || {};
12954
+ if ('active' in view_tree.fields) {
12955
+ this.screen_container.but_active.show();
12956
+ } else {
12957
+ this.screen_container.but_active.hide();
12958
+ }
12959
+ } else {
12960
+ this.screen_container.but_active.hide();
12961
+ }
12942
12962
  }
12943
12963
  return jQuery.when.apply(jQuery, deferreds).then(function() {
12944
12964
  return this.set_tree_state().then(function() {
@@ -13377,12 +13397,6 @@ var Sao = {};
13377
13397
  fields = dom_fields;
13378
13398
  }
13379
13399
 
13380
- if ('active' in view_tree.fields) {
13381
- this.screen_container.but_active.show();
13382
- } else {
13383
- this.screen_container.but_active.hide();
13384
- }
13385
-
13386
13400
  // Add common fields
13387
13401
  [
13388
13402
  ['id', Sao.i18n.gettext('ID'), 'integer'],
@@ -23348,8 +23362,7 @@ function eval_pyson(value){
23348
23362
  }
23349
23363
  }.bind(this));
23350
23364
 
23351
- var readonly = (this.screen.attributes.readonly ||
23352
- this.screen.group.readonly);
23365
+ var readonly = this.screen.readonly || this.screen.group.readonly;
23353
23366
 
23354
23367
  this._initial_value = null;
23355
23368
  if (view_type == 'form') {
@@ -23386,7 +23399,7 @@ function eval_pyson(value){
23386
23399
  }.bind(this)));
23387
23400
  }
23388
23401
 
23389
- if (this.save_current) {
23402
+ if (this.save_current && !readonly) {
23390
23403
  dialog.footer.append(jQuery('<button/>', {
23391
23404
  'class': 'btn btn-primary',
23392
23405
  'type': 'submit'
@@ -23542,7 +23555,7 @@ function eval_pyson(value){
23542
23555
  var name = '_';
23543
23556
  var access = Sao.common.MODELACCESS.get(this.screen.model_name);
23544
23557
  var deletable = this.screen.deletable;
23545
- var readonly = this.screen.group.readonly || this.screen.readonly;
23558
+ var readonly = this.screen.readonly || this.screen.group.readonly;
23546
23559
  if (data[0] >= 1) {
23547
23560
  name = data[0];
23548
23561
  if (this.domain) {
@@ -23619,7 +23632,7 @@ function eval_pyson(value){
23619
23632
  response: function(response_id) {
23620
23633
  var result;
23621
23634
  this.screen.current_view.set_value();
23622
- var readonly = this.screen.group.readonly;
23635
+ var readonly = this.screen.readonly || this.screen.group.readonly;
23623
23636
  if (~['RESPONSE_OK', 'RESPONSE_ACCEPT'].indexOf(response_id) &&
23624
23637
  !readonly &&
23625
23638
  this.screen.current_record) {
@@ -24092,7 +24105,7 @@ function eval_pyson(value){
24092
24105
  });
24093
24106
 
24094
24107
  Sao.Window.Revision = Sao.class_(Object, {
24095
- init: function(revisions, callback) {
24108
+ init: function(revisions, revision, callback) {
24096
24109
  this.callback = callback;
24097
24110
  var dialog = new Sao.Dialog(
24098
24111
  Sao.i18n.gettext('Revision'), '', 'lg');
@@ -24133,13 +24146,16 @@ function eval_pyson(value){
24133
24146
  }));
24134
24147
  revisions.forEach(function(revision) {
24135
24148
  var name = revision[2];
24136
- revision = revision[0];
24149
+ rev = revision[0];
24137
24150
  this.select.append(jQuery('<option/>', {
24138
- value: revision.valueOf(),
24151
+ value: rev.valueOf(),
24139
24152
  text: Sao.common.format_datetime(
24140
- date_format + ' ' + time_format, revision) + ' ' + name,
24153
+ date_format + ' ' + time_format, rev) + ' ' + name,
24141
24154
  }));
24142
24155
  }.bind(this));
24156
+ if (revision) {
24157
+ this.select.val(revision.valueOf());
24158
+ }
24143
24159
  this.el.modal('show');
24144
24160
  this.el.on('hidden.bs.modal', function(event) {
24145
24161
  jQuery(this).remove();