tryton-sao 7.0.44 → 7.0.46

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.46 - 2026-03-02
3
+ ---------------------------
4
+ * Bug fixes (see mercurial logs for details)
5
+
6
+
7
+ Version 7.0.45 - 2026-02-18
8
+ ---------------------------
9
+ * Bug fixes (see mercurial logs for details)
10
+
11
+
2
12
  Version 7.0.44 - 2026-02-01
3
13
  ---------------------------
4
14
  * Bug fixes (see mercurial logs for details)
@@ -3,7 +3,7 @@
3
3
 
4
4
  /* eslint-disable no-redeclare */
5
5
  var Sao = {
6
- __version__: '7.0.44',
6
+ __version__: '7.0.46',
7
7
  };
8
8
  /* eslint-enable no-redeclare */
9
9
 
@@ -1311,13 +1311,13 @@ var Sao = {
1311
1311
  var modalZIndex = 1040;
1312
1312
  jQuery('.modal.in').each(function(index) {
1313
1313
  var $modal = jQuery(this);
1314
- modalZIndex++;
1314
+ modalZIndex += 10;
1315
1315
  $modal.css('zIndex', modalZIndex);
1316
- $modal.next('.modal-backdrop.in').addClass('hidden')
1317
- .css('zIndex', modalZIndex - 1);
1316
+ $modal.prev('.modal-backdrop.in').addClass('hidden')
1317
+ .css('zIndex', modalZIndex - 5);
1318
1318
  });
1319
1319
  jQuery('.modal.in:visible:last').focus()
1320
- .next('.modal-backdrop.in').removeClass('hidden');
1320
+ .prev('.modal-backdrop.in').removeClass('hidden');
1321
1321
  }
1322
1322
 
1323
1323
  }());
@@ -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
@@ -10201,11 +10244,6 @@ var Sao = {
10201
10244
  }
10202
10245
  return result;
10203
10246
  },
10204
- get_removed_ids: function(record) {
10205
- return record._values[this.name].record_removed.map(function(r) {
10206
- return r.id;
10207
- });
10208
- },
10209
10247
  get_domain: function(record) {
10210
10248
  var domains = this.get_domains(record);
10211
10249
  var attr_domain = domains[1];
@@ -11438,7 +11476,9 @@ var Sao = {
11438
11476
  });
11439
11477
  },
11440
11478
  switch_: function() {
11441
- return this.modified_save().then(() => this.screen.switch_view());
11479
+ return this.modified_save().then(
11480
+ () => this.screen.switch_view(),
11481
+ (result) => result ? this.screen.switch_view() : null);
11442
11482
  },
11443
11483
  reload: function(test_modified=true) {
11444
11484
  const reload = () => {
@@ -11568,10 +11608,12 @@ var Sao = {
11568
11608
  revision = revisions[revisions.length - 1][0];
11569
11609
  }
11570
11610
  if (revision != this.screen.context._datetime) {
11571
- this.screen.clear();
11572
11611
  // Update group context that will be propagated by
11573
11612
  // recreating new group
11574
11613
  this.screen.group._context._datetime = revision;
11614
+ // clear after updating the datetime such that the tab
11615
+ // compute already the right URL
11616
+ this.screen.clear();
11575
11617
  if (this.screen.current_view.view_type != 'form') {
11576
11618
  this.screen.search_filter(
11577
11619
  this.screen.screen_container
@@ -18261,8 +18303,6 @@ function eval_pyson(value){
18261
18303
  var context = this.field.get_search_context(this.record);
18262
18304
  domain = [domain,
18263
18305
  this.record.expr_eval(this.attributes.add_remove)];
18264
- var removed_ids = this.field.get_removed_ids(this.record);
18265
- domain = ['OR', domain, ['id', 'in', removed_ids]];
18266
18306
  var text = this.wid_text.val();
18267
18307
 
18268
18308
  var sequence = this._sequence();
@@ -18528,8 +18568,6 @@ function eval_pyson(value){
18528
18568
  var domain = this.field.get_domain(this.record);
18529
18569
  domain = [domain,
18530
18570
  this.record.expr_eval(this.attributes.add_remove)];
18531
- var removed_ids = this.field.get_removed_ids(this.record);
18532
- domain = ['OR', domain, ['id', 'in', removed_ids]];
18533
18571
  return Sao.common.update_completion(
18534
18572
  this.wid_text, this.record, this.field, model, domain);
18535
18573
  },