tryton-sao 7.8.6 → 7.8.8

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.8.8 - 2026-04-16
3
+ --------------------------
4
+ * Bug fixes (see mercurial logs for details)
5
+
6
+
7
+ Version 7.8.7 - 2026-03-18
8
+ --------------------------
9
+ * Bug fixes (see mercurial logs for details)
10
+
11
+
2
12
  Version 7.8.6 - 2026-03-02
3
13
  --------------------------
4
14
  * Bug fixes (see mercurial logs for details)
package/COPYRIGHT CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (C) 2012-2025 Nicolas Évrard.
1
+ Copyright (C) 2012-2026 Nicolas Évrard.
2
2
  Copyright (C) 2012-2026 Cédric Krier.
3
3
  Copyright (C) 2012-2014 Bertrand Chenal.
4
4
  Copyright (C) 2012-2026 B2CK SPRL.
@@ -3,7 +3,7 @@
3
3
 
4
4
  /* eslint-disable no-redeclare */
5
5
  var Sao = {
6
- __version__: '7.8.6',
6
+ __version__: '7.8.8',
7
7
  };
8
8
  /* eslint-enable no-redeclare */
9
9
 
@@ -326,7 +326,7 @@ var Sao = {
326
326
  navigator.userLanguage ||
327
327
  'en').replace('-', '_');
328
328
  }
329
- jQuery('html').attr('lang', lang);
329
+ jQuery('html').attr('lang', Sao.i18n.BC47(lang));
330
330
  Sao.i18n.setLocale(lang);
331
331
  moment.locale(lang.slice(0, 2));
332
332
  return jQuery.getJSON('locale/' + lang + '.json').then(function(data) {
@@ -2986,6 +2986,7 @@ var Sao = {
2986
2986
  if (service_window.closed) {
2987
2987
  window.clearInterval(timer);
2988
2988
  session.database = database;
2989
+ session.login = null;
2989
2990
  session.restore();
2990
2991
  if (session.session) {
2991
2992
  dfd.resolve(session);
@@ -3204,6 +3205,9 @@ var Sao = {
3204
3205
  });
3205
3206
  }).prependTo(dialog.footer);
3206
3207
  dialog.modal.find('.modal-dialog').removeClass('modal-sm');
3208
+ prm.fail(() => {
3209
+ session.login = null;
3210
+ });
3207
3211
  return dialog;
3208
3212
  },
3209
3213
  });
@@ -5389,6 +5393,7 @@ var Sao = {
5389
5393
  let [, thousandSeparator] = /^10(.)?000/.exec(format(10000));
5390
5394
  let [, decimalSign] = /^0(.)1$/.exec(format(0.1));
5391
5395
  return Number(string
5396
+ .replaceAll(' ', '')
5392
5397
  .replaceAll(thousandSeparator, '')
5393
5398
  .replace(decimalSign, '.'));
5394
5399
  }
@@ -5526,6 +5531,7 @@ var Sao = {
5526
5531
  }
5527
5532
  var factor = Number(field.factor || 1);
5528
5533
  digit -= Math.round(Math.log10(factor));
5534
+ digit = Math.max(digit, 0);
5529
5535
  return (value * factor).toLocaleString(
5530
5536
  Sao.i18n.BC47(Sao.i18n.getlang()), {
5531
5537
  useGrouping: true,
@@ -10371,10 +10377,7 @@ var Sao = {
10371
10377
  if (record2) {
10372
10378
  let to_update = Object.fromEntries(
10373
10379
  Object.entries(vals).filter(
10374
- ([k, v]) => {
10375
- !Object.prototype.hasOwnProperty.call(
10376
- vals_to_set, k)
10377
- }
10380
+ ([k, v]) => !Object.hasOwn(vals_to_set, k)
10378
10381
  ));
10379
10382
  record2.set_on_change(to_update);
10380
10383
  }
@@ -10953,6 +10956,8 @@ var Sao = {
10953
10956
  if (this.info_bar) {
10954
10957
  this.el.append(this.info_bar.el);
10955
10958
  }
10959
+
10960
+ this._chat = null;
10956
10961
  },
10957
10962
  set_menu: function(menu) {
10958
10963
  var previous;
@@ -11162,6 +11167,9 @@ var Sao = {
11162
11167
  tabs.trigger('ready');
11163
11168
  if (this._chat) {
11164
11169
  this._chat.unregister();
11170
+ let chat = this.sidebar_content.find('.chat');
11171
+ chat.remove();
11172
+ this._chat = null;
11165
11173
  }
11166
11174
  });
11167
11175
  },
@@ -11758,6 +11766,8 @@ var Sao = {
11758
11766
  }
11759
11767
  return set_cursor;
11760
11768
  });
11769
+ } else {
11770
+ this.refresh_resources(true);
11761
11771
  }
11762
11772
  return set_cursor;
11763
11773
  })
@@ -12221,6 +12231,8 @@ var Sao = {
12221
12231
  let chat = this.sidebar_content.find('.chat');
12222
12232
  if (chat.length) {
12223
12233
  chat.remove();
12234
+ this._chat.unregister()
12235
+ this._chat = null;
12224
12236
  } else {
12225
12237
  if (this.screen.current_reference) {
12226
12238
  this._chat = new Sao.Chat(this.screen.current_reference);
@@ -13104,8 +13116,14 @@ var Sao = {
13104
13116
  break;
13105
13117
  case 'selection':
13106
13118
  case 'multiselection':
13119
+ var selection = jQuery.extend([], field.selection);
13120
+ if (field.sort === undefined || field.sort) {
13121
+ selection.sort(function(a, b) {
13122
+ return a[1].localeCompare(b[1]);
13123
+ });
13124
+ }
13107
13125
  entry = new Sao.ScreenContainer.Selection(
13108
- field.selection, prefix + field.name);
13126
+ selection, prefix + field.name);
13109
13127
  input = entry.el;
13110
13128
  input.prop('size', field.selection.length);
13111
13129
  break;
@@ -13349,7 +13367,7 @@ var Sao = {
13349
13367
  'class': 'form-control input-sm',
13350
13368
  'type': 'number',
13351
13369
  'step': 'any',
13352
- 'lang': Sao.i18n.getlang(),
13370
+ 'lang': Sao.i18n.BC47(Sao.i18n.getlang()),
13353
13371
  }).appendTo(el);
13354
13372
  return entry;
13355
13373
  },
@@ -14735,7 +14753,7 @@ var Sao = {
14735
14753
  if (this.current_view &&
14736
14754
  ~['tree', 'graph', 'calendar'].indexOf(this.current_view.view_type) &&
14737
14755
  !this.group.parent) {
14738
- return this.search_filter();
14756
+ return this.search_filter(this.screen_container.get_text());
14739
14757
  }
14740
14758
  } else if (action == 'reload menu') {
14741
14759
  return Sao.Session.current_session.reload_context()
@@ -17204,7 +17222,7 @@ function eval_pyson(value){
17204
17222
  input_text.attr('type', 'text');
17205
17223
  input.attr('type', 'number');
17206
17224
  input.attr('step', 1);
17207
- input.attr('lang', Sao.i18n.getlang());
17225
+ input.attr('lang', Sao.i18n.BC47(Sao.i18n.getlang()));
17208
17226
 
17209
17227
  input.hide().on('focusout', function() {
17210
17228
  if (input[0].checkValidity()) {
@@ -21489,6 +21507,8 @@ function eval_pyson(value){
21489
21507
  'reset_width',
21490
21508
  [this.screen.model_name, window.screen.width],
21491
21509
  {});
21510
+ Sao.Session.current_session.cache.clear(
21511
+ `model.${this.screen.model_name}.fields_view_get`);
21492
21512
 
21493
21513
  for (let column of this.columns) {
21494
21514
  if (column.col.data('default-width')) {
@@ -21538,7 +21558,7 @@ function eval_pyson(value){
21538
21558
 
21539
21559
  let tree_column_width = (
21540
21560
  Sao.Screen.tree_column_width[this.screen.model_name] || {});
21541
- let width = tree_column_width[name];
21561
+ let width = tree_column_width[column.attributes.name];
21542
21562
  if (width || column.attributes.width) {
21543
21563
  if (!width) {
21544
21564
  width = column.attributes.width;
@@ -25047,7 +25067,7 @@ function eval_pyson(value){
25047
25067
  this.view.screen.context.calendar_scroll_time ||
25048
25068
  Sao.Time(6)).toString(),
25049
25069
  events: this.view.get_events.bind(this.view),
25050
- locale: Sao.i18n.getlang().slice(0, 2),
25070
+ locale: Sao.i18n.BC47(Sao.i18n.getlang()).toLowerCase(),
25051
25071
  isRTL: Sao.i18n.rtl,
25052
25072
  themeSystem: 'bootstrap3',
25053
25073
  bootstrapGlyphicons: {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "tryton-sao",
3
3
  "title": "sao",
4
4
  "description": "Tryton webclient",
5
- "version": "7.8.6",
5
+ "version": "7.8.8",
6
6
  "homepage": "https://www.tryton.org/",
7
7
  "author": {
8
8
  "name": "Tryton"
package/src/common.js CHANGED
@@ -2086,6 +2086,7 @@
2086
2086
  let [, thousandSeparator] = /^10(.)?000/.exec(format(10000));
2087
2087
  let [, decimalSign] = /^0(.)1$/.exec(format(0.1));
2088
2088
  return Number(string
2089
+ .replaceAll(' ', '')
2089
2090
  .replaceAll(thousandSeparator, '')
2090
2091
  .replace(decimalSign, '.'));
2091
2092
  }
@@ -2223,6 +2224,7 @@
2223
2224
  }
2224
2225
  var factor = Number(field.factor || 1);
2225
2226
  digit -= Math.round(Math.log10(factor));
2227
+ digit = Math.max(digit, 0);
2226
2228
  return (value * factor).toLocaleString(
2227
2229
  Sao.i18n.BC47(Sao.i18n.getlang()), {
2228
2230
  useGrouping: true,
package/src/model.js CHANGED
@@ -2571,10 +2571,7 @@
2571
2571
  if (record2) {
2572
2572
  let to_update = Object.fromEntries(
2573
2573
  Object.entries(vals).filter(
2574
- ([k, v]) => {
2575
- !Object.prototype.hasOwnProperty.call(
2576
- vals_to_set, k)
2577
- }
2574
+ ([k, v]) => !Object.hasOwn(vals_to_set, k)
2578
2575
  ));
2579
2576
  record2.set_on_change(to_update);
2580
2577
  }
package/src/sao.js CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  /* eslint-disable no-redeclare */
5
5
  var Sao = {
6
- __version__: '7.8.6',
6
+ __version__: '7.8.8',
7
7
  };
8
8
  /* eslint-enable no-redeclare */
9
9
 
@@ -326,7 +326,7 @@ var Sao = {
326
326
  navigator.userLanguage ||
327
327
  'en').replace('-', '_');
328
328
  }
329
- jQuery('html').attr('lang', lang);
329
+ jQuery('html').attr('lang', Sao.i18n.BC47(lang));
330
330
  Sao.i18n.setLocale(lang);
331
331
  moment.locale(lang.slice(0, 2));
332
332
  return jQuery.getJSON('locale/' + lang + '.json').then(function(data) {
package/src/screen.js CHANGED
@@ -501,8 +501,14 @@
501
501
  break;
502
502
  case 'selection':
503
503
  case 'multiselection':
504
+ var selection = jQuery.extend([], field.selection);
505
+ if (field.sort === undefined || field.sort) {
506
+ selection.sort(function(a, b) {
507
+ return a[1].localeCompare(b[1]);
508
+ });
509
+ }
504
510
  entry = new Sao.ScreenContainer.Selection(
505
- field.selection, prefix + field.name);
511
+ selection, prefix + field.name);
506
512
  input = entry.el;
507
513
  input.prop('size', field.selection.length);
508
514
  break;
@@ -746,7 +752,7 @@
746
752
  'class': 'form-control input-sm',
747
753
  'type': 'number',
748
754
  'step': 'any',
749
- 'lang': Sao.i18n.getlang(),
755
+ 'lang': Sao.i18n.BC47(Sao.i18n.getlang()),
750
756
  }).appendTo(el);
751
757
  return entry;
752
758
  },
@@ -2132,7 +2138,7 @@
2132
2138
  if (this.current_view &&
2133
2139
  ~['tree', 'graph', 'calendar'].indexOf(this.current_view.view_type) &&
2134
2140
  !this.group.parent) {
2135
- return this.search_filter();
2141
+ return this.search_filter(this.screen_container.get_text());
2136
2142
  }
2137
2143
  } else if (action == 'reload menu') {
2138
2144
  return Sao.Session.current_session.reload_context()
package/src/session.js CHANGED
@@ -346,6 +346,7 @@
346
346
  if (service_window.closed) {
347
347
  window.clearInterval(timer);
348
348
  session.database = database;
349
+ session.login = null;
349
350
  session.restore();
350
351
  if (session.session) {
351
352
  dfd.resolve(session);
@@ -564,6 +565,9 @@
564
565
  });
565
566
  }).prependTo(dialog.footer);
566
567
  dialog.modal.find('.modal-dialog').removeClass('modal-sm');
568
+ prm.fail(() => {
569
+ session.login = null;
570
+ });
567
571
  return dialog;
568
572
  },
569
573
  });
package/src/tab.js CHANGED
@@ -141,6 +141,8 @@
141
141
  if (this.info_bar) {
142
142
  this.el.append(this.info_bar.el);
143
143
  }
144
+
145
+ this._chat = null;
144
146
  },
145
147
  set_menu: function(menu) {
146
148
  var previous;
@@ -350,6 +352,9 @@
350
352
  tabs.trigger('ready');
351
353
  if (this._chat) {
352
354
  this._chat.unregister();
355
+ let chat = this.sidebar_content.find('.chat');
356
+ chat.remove();
357
+ this._chat = null;
353
358
  }
354
359
  });
355
360
  },
@@ -946,6 +951,8 @@
946
951
  }
947
952
  return set_cursor;
948
953
  });
954
+ } else {
955
+ this.refresh_resources(true);
949
956
  }
950
957
  return set_cursor;
951
958
  })
@@ -1409,6 +1416,8 @@
1409
1416
  let chat = this.sidebar_content.find('.chat');
1410
1417
  if (chat.length) {
1411
1418
  chat.remove();
1419
+ this._chat.unregister()
1420
+ this._chat = null;
1412
1421
  } else {
1413
1422
  if (this.screen.current_reference) {
1414
1423
  this._chat = new Sao.Chat(this.screen.current_reference);
@@ -87,7 +87,7 @@
87
87
  this.view.screen.context.calendar_scroll_time ||
88
88
  Sao.Time(6)).toString(),
89
89
  events: this.view.get_events.bind(this.view),
90
- locale: Sao.i18n.getlang().slice(0, 2),
90
+ locale: Sao.i18n.BC47(Sao.i18n.getlang()).toLowerCase(),
91
91
  isRTL: Sao.i18n.rtl,
92
92
  themeSystem: 'bootstrap3',
93
93
  bootstrapGlyphicons: {
package/src/view/form.js CHANGED
@@ -2064,7 +2064,7 @@ function eval_pyson(value){
2064
2064
  input_text.attr('type', 'text');
2065
2065
  input.attr('type', 'number');
2066
2066
  input.attr('step', 1);
2067
- input.attr('lang', Sao.i18n.getlang());
2067
+ input.attr('lang', Sao.i18n.BC47(Sao.i18n.getlang()));
2068
2068
 
2069
2069
  input.hide().on('focusout', function() {
2070
2070
  if (input[0].checkValidity()) {
package/src/view/tree.js CHANGED
@@ -426,6 +426,8 @@
426
426
  'reset_width',
427
427
  [this.screen.model_name, window.screen.width],
428
428
  {});
429
+ Sao.Session.current_session.cache.clear(
430
+ `model.${this.screen.model_name}.fields_view_get`);
429
431
 
430
432
  for (let column of this.columns) {
431
433
  if (column.col.data('default-width')) {
@@ -475,7 +477,7 @@
475
477
 
476
478
  let tree_column_width = (
477
479
  Sao.Screen.tree_column_width[this.screen.model_name] || {});
478
- let width = tree_column_width[name];
480
+ let width = tree_column_width[column.attributes.name];
479
481
  if (width || column.attributes.width) {
480
482
  if (!width) {
481
483
  width = column.attributes.width;