tryton-sao 7.0.43 → 7.0.45

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 7.0.45 - 2026-02-18
3
+ ---------------------------
4
+ * Bug fixes (see mercurial logs for details)
5
+
6
+
7
+ Version 7.0.44 - 2026-02-01
8
+ ---------------------------
9
+ * Bug fixes (see mercurial logs for details)
10
+
11
+
2
12
  Version 7.0.43 - 2026-01-15
3
13
  ---------------------------
4
14
  * Bug fixes (see mercurial logs for details)
package/COPYRIGHT CHANGED
@@ -1,7 +1,7 @@
1
1
  Copyright (C) 2012-2025 Nicolas Évrard.
2
- Copyright (C) 2012-2025 Cédric Krier.
2
+ Copyright (C) 2012-2026 Cédric Krier.
3
3
  Copyright (C) 2012-2014 Bertrand Chenal.
4
- Copyright (C) 2012-2025 B2CK SPRL.
4
+ Copyright (C) 2012-2026 B2CK SPRL.
5
5
  Copyright (C) 2019 Jitbit.
6
6
  Copyright (C) 2013 Thomas Park
7
7
  Copyright (C) 2020-2021 Maxime Richez
@@ -3,7 +3,7 @@
3
3
 
4
4
  /* eslint-disable no-redeclare */
5
5
  var Sao = {
6
- __version__: '7.0.43',
6
+ __version__: '7.0.45',
7
7
  };
8
8
  /* eslint-enable no-redeclare */
9
9
 
@@ -3266,16 +3266,59 @@ var Sao = {
3266
3266
  };
3267
3267
 
3268
3268
  Sao.common.scrollIntoViewIfNeeded = function(element) {
3269
- element = element[0];
3270
- if (element) {
3271
- var rect = element.getBoundingClientRect();
3272
- if (rect.bottom > window.innerHeight) {
3273
- element.scrollIntoView(false);
3269
+ function isScrollable(el) {
3270
+ let style = getComputedStyle(el);
3271
+ return /(auto|scroll|overlay)/.test(
3272
+ style.overflow + style.overflowY + style.overflowX
3273
+ );
3274
+ }
3275
+
3276
+ function getScrollableAncestors(el) {
3277
+ let ancestors = [];
3278
+ let parent = el.parentElement;
3279
+ while (parent && parent !== document.body) {
3280
+ if (isScrollable(parent)) {
3281
+ ancestors.push(parent);
3282
+ }
3283
+ parent = parent.parentElement;
3274
3284
  }
3275
- if (rect.top < 0) {
3276
- element.scrollIntoView();
3285
+ ancestors.push(window);
3286
+ return ancestors;
3287
+ }
3288
+
3289
+ function scrollIntoViewWithin(el, container) {
3290
+ let rect = el.getBoundingClientRect();
3291
+
3292
+ if (container === window) {
3293
+ if (rect.top < 0 || rect.bottom > window.innerHeight) {
3294
+ el.scrollIntoView({
3295
+ block: 'center',
3296
+ });
3297
+ }
3298
+ } else {
3299
+ let container_rect = container.getBoundingClientRect();
3300
+ let top_ = rect.top - container_rect.top;
3301
+ let bottom = top_ + rect.height;
3302
+
3303
+ let target_top = container.scrollTop;
3304
+
3305
+ if (top_ < 0) {
3306
+ target_top += top_ - container.clientHeight / 2;
3307
+ } else if (bottom > container.clientHeight) {
3308
+ target_top += bottom - container.clientHeight / 2
3309
+ }
3310
+ container.scrollTo({
3311
+ top: Math.max(0, target_top),
3312
+ });
3277
3313
  }
3278
3314
  }
3315
+
3316
+ element.each(function() {
3317
+ let ancestors = getScrollableAncestors(this);
3318
+ for (let ancestor of ancestors) {
3319
+ scrollIntoViewWithin(this, ancestor);
3320
+ }
3321
+ });
3279
3322
  };
3280
3323
 
3281
3324
  // Handle click and Return press event
@@ -8095,11 +8138,14 @@ var Sao = {
8095
8138
  } else {
8096
8139
  cmp = function(a, b) { return a < b; };
8097
8140
  }
8141
+ let max_id = Math.max(0, ...this.map((r) => r.id));
8098
8142
  for (const record of this) {
8099
8143
  if (record.get_loaded([field]) || changed || record.id < 0) {
8144
+ let prev_id = null;
8100
8145
  if (prev) {
8101
8146
  prev.load(field, false);
8102
8147
  index = prev.field_get(field);
8148
+ prev_id = prev.id >= 0 ? prev.id : max_id++;
8103
8149
  } else {
8104
8150
  index = null;
8105
8151
  }
@@ -8110,7 +8156,7 @@ var Sao = {
8110
8156
  update = true;
8111
8157
  } else if (prev) {
8112
8158
  if (record.id >= 0) {
8113
- update = cmp(record.id, prev.id);
8159
+ update = cmp(record.id, prev_id);
8114
8160
  } else if (position === 0) {
8115
8161
  update = true;
8116
8162
  }
@@ -8118,7 +8164,7 @@ var Sao = {
8118
8164
  } else if (value === index) {
8119
8165
  if (prev) {
8120
8166
  if (record.id >= 0) {
8121
- update = cmp(record.id, prev.id);
8167
+ update = cmp(record.id, prev_id);
8122
8168
  } else if (position === 0) {
8123
8169
  update = true;
8124
8170
  }
@@ -10198,11 +10244,6 @@ var Sao = {
10198
10244
  }
10199
10245
  return result;
10200
10246
  },
10201
- get_removed_ids: function(record) {
10202
- return record._values[this.name].record_removed.map(function(r) {
10203
- return r.id;
10204
- });
10205
- },
10206
10247
  get_domain: function(record) {
10207
10248
  var domains = this.get_domains(record);
10208
10249
  var attr_domain = domains[1];
@@ -18258,8 +18299,6 @@ function eval_pyson(value){
18258
18299
  var context = this.field.get_search_context(this.record);
18259
18300
  domain = [domain,
18260
18301
  this.record.expr_eval(this.attributes.add_remove)];
18261
- var removed_ids = this.field.get_removed_ids(this.record);
18262
- domain = ['OR', domain, ['id', 'in', removed_ids]];
18263
18302
  var text = this.wid_text.val();
18264
18303
 
18265
18304
  var sequence = this._sequence();
@@ -18525,8 +18564,6 @@ function eval_pyson(value){
18525
18564
  var domain = this.field.get_domain(this.record);
18526
18565
  domain = [domain,
18527
18566
  this.record.expr_eval(this.attributes.add_remove)];
18528
- var removed_ids = this.field.get_removed_ids(this.record);
18529
- domain = ['OR', domain, ['id', 'in', removed_ids]];
18530
18567
  return Sao.common.update_completion(
18531
18568
  this.wid_text, this.record, this.field, model, domain);
18532
18569
  },
@@ -22671,11 +22708,14 @@ function eval_pyson(value){
22671
22708
  cell.text(value);
22672
22709
  }
22673
22710
  };
22711
+ let prm = jQuery.when();
22674
22712
  if (!record.is_loaded(this.attributes.name)) {
22675
- record.load(this.attributes.name, true, false).done(render);
22676
- } else {
22677
- render();
22713
+ prm = prm.then(() => record.load(this.attributes.name, true, false));
22714
+ }
22715
+ if (this.icon && (this.icon in record.model.fields)) {
22716
+ prm = prm.then(() => record.load(this.icon, true, false));
22678
22717
  }
22718
+ prm.done(render);
22679
22719
  return cell;
22680
22720
  },
22681
22721
  clicked: function(event) {