tryton-sao 6.6.9 → 6.6.11

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.6.11 - 2023-11-03
3
+ ---------------------------
4
+ * Bug fixes (see mercurial logs for details)
5
+
6
+
7
+ Version 6.6.10 - 2023-10-04
8
+ ---------------------------
9
+ * Bug fixes (see mercurial logs for details)
10
+
11
+
2
12
  Version 6.6.9 - 2023-09-06
3
13
  --------------------------
4
14
  * Bug fixes (see mercurial logs for details)
@@ -1,7 +1,7 @@
1
1
  /* This file is part of Tryton. The COPYRIGHT file at the top level of
2
2
  this repository contains the full copyright notices and license terms. */
3
3
  var Sao = {
4
- __version__: '6.6.9',
4
+ __version__: '6.6.11',
5
5
  };
6
6
 
7
7
  (function() {
@@ -7553,13 +7553,13 @@ var Sao = {
7553
7553
  if (this.indexOf(record) < 0) {
7554
7554
  this.splice(position, 0, record);
7555
7555
  }
7556
- for (var record_rm in this.record_removed) {
7556
+ for (var record_rm of this.record_removed) {
7557
7557
  if (record_rm.id == record.id) {
7558
7558
  this.record_removed.splice(
7559
7559
  this.record_removed.indexOf(record_rm), 1);
7560
7560
  }
7561
7561
  }
7562
- for (var record_del in this.record_deleted) {
7562
+ for (var record_del of this.record_deleted) {
7563
7563
  if (record_del.id == record.id) {
7564
7564
  this.record_deleted.splice(
7565
7565
  this.record_deleted.indexOf(record_del), 1);
@@ -8412,7 +8412,7 @@ var Sao = {
8412
8412
  get_eval: function() {
8413
8413
  var value = {};
8414
8414
  for (var key in this.model.fields) {
8415
- if (!this.model.fields.hasOwnProperty(key) && this.id >= 0)
8415
+ if (!this._loaded.hasOwnProperty(key) && this.id >= 0)
8416
8416
  continue;
8417
8417
  value[key] = this.model.fields[key].get_eval(this);
8418
8418
  }
@@ -11256,6 +11256,7 @@ var Sao = {
11256
11256
  revision.add(1, 'milliseconds');
11257
11257
  }
11258
11258
  if ((this.screen.current_view.view_type == 'form') &&
11259
+ revision &&
11259
11260
  (revision < revisions[revisions.length - 1][0])) {
11260
11261
  revision = revisions[revisions.length - 1][0];
11261
11262
  }
@@ -11282,7 +11283,13 @@ var Sao = {
11282
11283
  return this.screen.model.execute('history_revisions',
11283
11284
  [ids], this.screen.context)
11284
11285
  .then(revisions => {
11285
- new Sao.Window.Revision(revisions, set_revision(revisions));
11286
+ const revision = this.screen.context._datetime;
11287
+ if (revision) {
11288
+ // Remove a millisecond as microseconds are truncated
11289
+ revision.add(-1, 'milliseconds');
11290
+ }
11291
+ new Sao.Window.Revision(
11292
+ revisions, revision, set_revision(revisions));
11286
11293
  });
11287
11294
  });
11288
11295
  },
@@ -12991,7 +12998,8 @@ var Sao = {
12991
12998
  var domain = this.search_domain(search_string, true);
12992
12999
 
12993
13000
  var context = this.context;
12994
- if (this.screen_container.but_active.hasClass('active')) {
13001
+ if ((this.screen_container.but_active.css('display') != 'none') &&
13002
+ this.screen_container.but_active.hasClass('active')) {
12995
13003
  context.active_test = false;
12996
13004
  }
12997
13005
  const search = () => {
@@ -13072,7 +13080,8 @@ var Sao = {
13072
13080
  } else {
13073
13081
  domain = this.domain;
13074
13082
  }
13075
- if (this.screen_container.but_active.hasClass('active')) {
13083
+ if ((this.screen_container.but_active.css('display') != 'none') &&
13084
+ this.screen_container.but_active.hasClass('active')) {
13076
13085
  if (!jQuery.isEmptyObject(domain)) {
13077
13086
  domain = [domain, ['active', '=', false]];
13078
13087
  } else {
@@ -13300,6 +13309,17 @@ var Sao = {
13300
13309
  deferreds.push(view.display());
13301
13310
  }
13302
13311
  }
13312
+ if (this.current_view.view_type == 'tree') {
13313
+ let view_tree = this.fields_view_tree[
13314
+ this.current_view.view_id] || {};
13315
+ if ('active' in view_tree.fields) {
13316
+ this.screen_container.but_active.show();
13317
+ } else {
13318
+ this.screen_container.but_active.hide();
13319
+ }
13320
+ } else {
13321
+ this.screen_container.but_active.hide();
13322
+ }
13303
13323
  }
13304
13324
  return jQuery.when.apply(jQuery, deferreds).then(
13305
13325
  () => this.set_tree_state().then(() => {
@@ -13742,12 +13762,6 @@ var Sao = {
13742
13762
  fields = dom_fields;
13743
13763
  }
13744
13764
 
13745
- if ('active' in view_tree.fields) {
13746
- this.screen_container.but_active.show();
13747
- } else {
13748
- this.screen_container.but_active.hide();
13749
- }
13750
-
13751
13765
  // Add common fields
13752
13766
  const common_fields = new Set([
13753
13767
  ['id', Sao.i18n.gettext('ID'), 'integer'],
@@ -24146,8 +24160,7 @@ function eval_pyson(value){
24146
24160
  }
24147
24161
  });
24148
24162
 
24149
- var readonly = (this.screen.attributes.readonly ||
24150
- this.screen.group.readonly);
24163
+ var readonly = this.screen.readonly || this.screen.group.readonly;
24151
24164
 
24152
24165
  this.but_ok = null;
24153
24166
  this.but_new = null;
@@ -24190,7 +24203,7 @@ function eval_pyson(value){
24190
24203
  }));
24191
24204
  }
24192
24205
 
24193
- if (this.save_current) {
24206
+ if (this.save_current && !readonly) {
24194
24207
  this.but_ok = jQuery('<button/>', {
24195
24208
  'class': 'btn btn-primary',
24196
24209
  'type': 'submit',
@@ -24363,7 +24376,7 @@ function eval_pyson(value){
24363
24376
  var name = '_';
24364
24377
  var access = Sao.common.MODELACCESS.get(this.screen.model_name);
24365
24378
  var deletable = this.screen.deletable;
24366
- var readonly = this.screen.group.readonly || this.screen.readonly;
24379
+ var readonly = this.screen.readonly || this.screen.group.readonly;
24367
24380
  if (position >= 1) {
24368
24381
  name = position;
24369
24382
  if (this.domain) {
@@ -24453,7 +24466,7 @@ function eval_pyson(value){
24453
24466
  response: function(response_id) {
24454
24467
  var result;
24455
24468
  this.screen.current_view.set_value();
24456
- var readonly = this.screen.group.readonly;
24469
+ var readonly = this.screen.readonly || this.screen.group.readonly;
24457
24470
  if (~['RESPONSE_OK', 'RESPONSE_ACCEPT'].indexOf(response_id) &&
24458
24471
  !readonly &&
24459
24472
  this.screen.current_record) {
@@ -24931,7 +24944,7 @@ function eval_pyson(value){
24931
24944
  });
24932
24945
 
24933
24946
  Sao.Window.Revision = Sao.class_(Object, {
24934
- init: function(revisions, callback) {
24947
+ init: function(revisions, revision, callback) {
24935
24948
  this.callback = callback;
24936
24949
  var dialog = new Sao.Dialog(
24937
24950
  Sao.i18n.gettext('Revision'), '', 'lg');
@@ -24972,15 +24985,18 @@ function eval_pyson(value){
24972
24985
  value: null,
24973
24986
  text: ''
24974
24987
  }));
24975
- for (let revision of revisions) {
24976
- var name = revision[2];
24977
- revision = revision[0];
24988
+ for (let rev of revisions) {
24989
+ var name = rev[2];
24990
+ rev = rev[0];
24978
24991
  this.select.append(jQuery('<option/>', {
24979
- value: revision.valueOf(),
24992
+ value: rev.valueOf(),
24980
24993
  text: Sao.common.format_datetime(
24981
- date_format + ' ' + time_format, revision) + ' ' + name,
24994
+ date_format + ' ' + time_format, rev) + ' ' + name,
24982
24995
  }));
24983
24996
  }
24997
+ if (revision) {
24998
+ this.select.val(revision.valueOf());
24999
+ }
24984
25000
  this.el.modal('show');
24985
25001
  this.el.on('hidden.bs.modal', function(event) {
24986
25002
  jQuery(this).remove();